Service SetJsonFromProcessDataStandardFormat(DataPath, FileName) OSREAD Text FROM DataPath:FileName THEN Records = 0; Sequence = -1; HeaderId = -1; SubgroupId = -1; ColumnTitlesLine = 0; FoundEndOfFile = False$; json = '{ "Records": [':@FM; SWAP '|' WITH @VM IN Text; SWAP CRLF$ WITH @FM IN Text; ColumnTitlesIndexCount = 0; LineCount = DCOUNT(Text, @FM); FOR LineLoopIndex = 1 TO LineCount Line = Text; IF FoundEndOfFile = True$ THEN IF Line<1, 1> = 'END_OFFSET' THEN ColumnTitlesLine = LineLoopIndex + 2; END IF ColumnTitlesLine GT 0 THEN Row = '{'; SegmentsCount = DCOUNT(Line, @VM); IF ColumnTitlesIndexCount EQ 0 THEN FOR SegmentLoopIndex = 1 TO SegmentsCount IF SegmentLoopIndex = ColumnTitlesLine THEN ColumnTitlesIndexCount = SegmentsCount - 2; END NEXT SegmentLoopIndex END IF ColumnTitlesIndexCount GT 0 AND SegmentsCount = ColumnTitlesIndexCount THEN FOR SegmentLoopIndex = 1 TO SegmentsCount Value = SRP_String('Trim', Line<1,SegmentLoopIndex>, 'FB'); swap '"' with '\"' in Value; swap '\' with '\\' in Value; Column = Text; IF Column[1,1] = '"' AND Column[-1,1] = '"' THEN Column = Column[2,LEN(Column) - 2]; END Row = Row:'"':Column:'":"':Value:'",'; NEXT SegmentLoopIndex Row = SRP_String('Trim', Row, 'B', ','):'},':@FM; json = json:Row; Records = Records + 1; END END END IF Line = 'EOF' THEN FoundEndOfFile = True$; Line = Text; Convert Tab$ to @FM IN Line SWAP '=' WITH @VM IN Line; SWAP ';' WITH @FM IN Line; IF Line<2, 1> = 'B_HeaderId' THEN HeaderId = Line<2, 2> END IF Line<3, 1> = 'B_SubgroupId' THEN SubgroupId = Line<3, 2> END IF Line<14, 1> = 'B_SEQUENCE' THEN Sequence = Line<14, 2> END END NEXT LineLoopIndex IF ColumnTitlesLine GT 0 AND ColumnTitlesIndexCount GT 0 THEN json = SRP_String('Trim', json, 'B', @FM); json = SRP_String('Trim', json, 'B', ','); json = json:@FM:']':@FM:',"Sequence":':Sequence:',"HeaderId":':HeaderId:',"SubgroupId":':SubgroupId:',"Count":':Records:'}'; SWAP @FM WITH CRLF$ IN json; END IF LEN(json) GT 0 THEN set_status(0); OSWRITE json to DataPath:FileName:'.json' StatusCode = ''; If Get_Status(StatusCode) THEN ErrorMessage = 'Error writing run data file to repository: StatusCode = ' : StatusCode; Metrology_Services('LogResults', '', Machine, 'UID001', Service : ' : ' : ErrorMessage); Set_Status(0); END END END ELSE json = ''; END Response = json; end service Service GetStratus(Handle) Result = ''; // Service ImportStratusData( Offset = 1 FieldPosition = 13 FieldPositionIncrement = 2 Result<1, 1> = SRP_JSON(Handle, 'GETVALUE', 'Count'); Result<1, 2> = SRP_JSON(Handle, 'GETVALUE', 'Sequence'); Result<1, 3> = SRP_JSON(Handle, 'GETVALUE', 'HeaderId'); Result<1, 4> = SRP_JSON(Handle, 'GETVALUE', 'SubgroupId'); FOR RecordIndex = 1 TO Result<1, 1> IF RecordIndex = 1 THEN Result<2> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']DateTime'); // Timestamp Result<3> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']MesEntity'); // Tool Result<4> = 'FQA Thickness'; // DataType Result<5> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Employee'); // Operator Result<6> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Recipe'); // Recipe Result<7> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Reactor'); // Reactor Result<8> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']RDS'); // RDSNo Result<9> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']PSN'); // PSN Result<10> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Batch'); // BatchID Result<11> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Cassette'); // Cassette Result<12> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']GradeMean'); // ThickAvg END ForOffset = (RecordIndex - 1) * FieldPositionIncrement; Result = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Slot'); // Position Result = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Mean'); // DataPoint NEXT RecordIndex Response = Result; end service Service GetBioRadEPPFQA(Handle) Result = ''; // Service ImportBioRadEPPFQAData( Offset = 1 FieldPosition = 13 FieldPositionIncrement = 1 Result<1, 1> = SRP_JSON(Handle, 'GETVALUE', 'Count'); Result<1, 2> = SRP_JSON(Handle, 'GETVALUE', 'Sequence'); Result<1, 3> = SRP_JSON(Handle, 'GETVALUE', 'HeaderId'); Result<1, 4> = SRP_JSON(Handle, 'GETVALUE', 'SubgroupId'); FOR RecordIndex = 1 TO Result<1, 1> IF RecordIndex = 1 THEN Result<2> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']DateTime'); // Timestamp Result<4> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Recipe'); // ScanRecipe Result<5> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Reactor'); // ReactorID Result<6> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']RDS'); // WMOKeyID Result<8> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Layer'); // RunDataLayer END ForOffset = (RecordIndex - 1) * FieldPositionIncrement; Result = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Position'); // Position Result = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Thickness'); // DataPoint NEXT RecordIndex Response = Result; end service Service GetBioRad(Handle) Result = ''; // Service ImportBioRadData( Offset = 1 FieldPosition = 13 FieldPositionIncrement = 2 Result<1, 1> = SRP_JSON(Handle, 'GETVALUE', 'Count'); Result<1, 2> = SRP_JSON(Handle, 'GETVALUE', 'Sequence'); Result<1, 3> = SRP_JSON(Handle, 'GETVALUE', 'HeaderId'); Result<1, 4> = SRP_JSON(Handle, 'GETVALUE', 'SubgroupId'); FOR RecordIndex = 1 TO Result<1, 1> IF RecordIndex = 1 THEN Result<2> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']DateTime'); // TimeStamp Result<4> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Recipe'); // ScanRecipe Result<5> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Reactor'); // ReactorID Result<5> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Reactor'); // ToolID Result<6> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']RDS'); // RDSKeyID Result<7> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']PSN'); // PSN Result<8> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Layer'); // RunDataLayer Result<9> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Zone'); // RunDataZone END ForOffset = (RecordIndex - 1) * FieldPositionIncrement; Result = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Position'); // Position Result = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Thickness'); // DataPoint NEXT RecordIndex Response = Result; end service Service GetCDE(Handle) Result = ''; // Service ImportCDEData( Offset = 3 FieldPosition = 23 FieldPositionIncrement = 5 Result<1, 1> = SRP_JSON(Handle, 'GETVALUE', 'Count'); Result<1, 2> = SRP_JSON(Handle, 'GETVALUE', 'Sequence'); Result<1, 3> = SRP_JSON(Handle, 'GETVALUE', 'HeaderId'); Result<1, 4> = SRP_JSON(Handle, 'GETVALUE', 'SubgroupId'); FOR RecordIndex = 1 TO Result<1, 1> IF RecordIndex = 1 THEN Result<3> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Date'); // Timestamp Result<5> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']RecipeName'); // ScanRecip Result<6> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Reactor'); // ReactorID Result<7> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']RDS'); // RDSKeyID Result<8> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']PSN'); // PSN Result<9> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Layer'); // RunDataLayer Result<10> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Zone'); // RunDataZo END ForOffset = (RecordIndex - 1) * FieldPositionIncrement; Result = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']InferredPoint'); // Position Result = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Data'); // DataPoint Result = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']MeritGOF'); // N/A NEXT RecordIndex Response = Result; end service Service GetHgCV(Handle) Result = ''; // Service ImportHgCVData( Offset = 5 PhaseOffset = 7 FieldPosition = 53 FieldPositionIncrement = 9 Result<1, 1> = SRP_JSON(Handle, 'GETVALUE', 'Count'); Result<1, 2> = SRP_JSON(Handle, 'GETVALUE', 'Sequence'); Result<1, 3> = SRP_JSON(Handle, 'GETVALUE', 'HeaderId'); Result<1, 4> = SRP_JSON(Handle, 'GETVALUE', 'SubgroupId'); FOR RecordIndex = 1 TO Result<1, 1> IF RecordIndex = 1 THEN Result<2> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']MesEntity'); // ToolID Result<3> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Reactor'); // ReactorID Result<4> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']RDS'); // RDSKeyID Result<5> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']PSN'); // PSN Result<8> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Wafer'); // LayerZonePair Result<11> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Date'); // Timestamp END ForOffset = (RecordIndex - 1) * FieldPositionIncrement; Result = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Site'); // Position Result = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']RhoAvg'); // HgCVDataPoint Result = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Phase'); // PhaseDataPoint Result = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Grade'); // N/A NEXT RecordIndex Response = Result; end service Service GetTencor(Handle) Result = ''; // Service ImportTencorData( Result<1, 1> = SRP_JSON(Handle, 'GETVALUE', 'Count'); Result<1, 2> = SRP_JSON(Handle, 'GETVALUE', 'Sequence'); Result<1, 3> = SRP_JSON(Handle, 'GETVALUE', 'HeaderId'); Result<1, 4> = SRP_JSON(Handle, 'GETVALUE', 'SubgroupId'); FOR RecordIndex = 1 TO Result<1, 1> IF RecordIndex = 1 THEN Result<9> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Date'); // Timestamp Result<10> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']HazeAverageAvg'); // HazeAvg Result<28> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']RDS'); // RDSKeyID Result<30> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']WaferRecipe'); // ScanRecipe Result<39> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']SumOfDefectsAvg'); // SoDAvg Result<40> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']SumOfDefectsMax'); // SoDMax Result<41> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']SumOfDefectsMin'); // SoDMin Result<43> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']MesEntity'); // ScanTool END NEXT RecordIndex Response = Result; end service Service GetSP1(Handle) Result = ''; // Service ImportSP1Data( Result<5, 1> = SRP_JSON(Handle, 'GETVALUE', 'Count'); Result<5, 2> = SRP_JSON(Handle, 'GETVALUE', 'Sequence'); Result<5, 3> = SRP_JSON(Handle, 'GETVALUE', 'HeaderId'); Result<5, 4> = SRP_JSON(Handle, 'GETVALUE', 'SubgroupId'); FOR RecordIndex = 1 TO Result<5, 1> IF RecordIndex = 1 THEN Result<9> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Date'); // Timestamp Result<10> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']DcnHazeAvgMean'); // HazeAvg Result<28> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']RDS'); // RDSKeyID Result<30> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']Session'); // ScanRecipe IsMisfit = IndexC(Result<30>, 'MISFIT', 1) IF IsMisfit THEN Result<3> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']DcnAllMean'); // SoDAvg Result<2> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']DcnAllMax'); // SoDMax Result<1> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']DcnAllMin'); // SoDMin END ELSE Result<39> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']DcnAllMean'); // SoDAvg Result<40> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']DcnAllMax'); // SoDMax Result<41> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']DcnAllMin'); // SoDMin END Result<43> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']MesEntity'); // ScanTool Result<44> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:']DcnAreaMean'); // DCNMM2 END NEXT RecordIndex Response = Result; end service