Function Test_Francois()
#pragma precomp SRP_PreCompiler

Declare subroutine Set_Property,  Set_Status, ErrMsg, Set_Property, obj_AppWindow, Send_Message, Logging_Services
Declare subroutine Btree.Extract, Send_Event, Security_Err_Msg, Forward_Event, End_Window, Start_Window, FTP_Services
Declare subroutine EditCell, obj_NCR, obj_Notes, Post_Event, obj_WO_Mat, obj_WO_Mat_Log, obj_WO_Wfr, obj_Tables, obj_RDS
Declare subroutine Error_Services, RDS_Services, Dialog_Box, Insert, Unlock, QA_Services, Validate, Development_Services
Declare subroutine Update_Index, Database_Services, Obj_WO_Mat_QA, Fmt, Yield, WinYield, Sleepery, Qa_Services, Reactor_Services
Declare subroutine Obj_Post_Log
Declare function Get_Property, Get_Status, Popup, Send_Message, Msg, Security_Check, Dialog_Box, RowExists, Utility
Declare function Dialog_Box, obj_WO_Log, obj_NCR, Check_Notes, obj_MUWafers, obj_WO_Mat, Error_Services, RDS_Services
Declare function MemberOf, obj_Tables, obj_RDS, Environment_Services, Logging_Services, Material_Services, ErrMsg
Declare function Work_Order_Services, RetStack, Min, Max, Obj_Prod_Spec, Insert, SRP_Trim, Xlate, Obj_Wo_Mat
Declare function Security_Services, QA_Services, Database_Services, RowExists, Rti_Lh_Info, UNICODE_ANSI, UNICODE_UTF8
Declare function index, Httpclient_Services, SRP_Encode, SRP_Decode, DirList, Obj_Rds_Test, Tool_Parms_Services
Declare function SQL_Services, RDS_Services, Obj_WM_out, Schedule_Services, Obj_Tool, SRP_Sort_Array, ICONV
Declare function Development_Services, Obj_WO_Mat_QA, SRP_Join_Arrays, NextKey, Obj_Prod_Spec, FTP_Services, SQL_Format


$INSERT POPUP_EQUATES
$INSERT MSG_EQUATES
$INSERT APPCOLORS
$INSERT WM_IN_EQUATES
$Insert WM_OUT_EQUATES
$INSERT WO_LOG_EQU
$INSERT WO_STEP_EQU
$INSERT WO_MAT_EQUATES
$INSERT ORDER_EQU
$INSERT RDS_EQUATES
$INSERT PROD_SPEC_EQU
$INSERT NOTIFICATION_EQU
$INSERT LSL_USERS_EQU
$INSERT SECURITY_RIGHTS_EQU
$INSERT LOGICAL
$INSERT RTI_LH_INFO_EQUATES
$INSERT WO_MAT_QA_EQUATES
$INSERT CUST_EPI_PART_EQUATES
$INSERT PRS_STAGE_EQUATES
$Insert RLIST_EQUATES
$Insert CLEAN_INSP_EQUATES
$Insert TOOL_PARMS_EQUATES
$Insert SCHEDULE_EQU
$Insert SCHED_DET_EQUATES
$Insert SCHEDULER_EQUATES
$Insert NCR_EQUATES

EQU COL$QA_MET_PHASE_MIN TO 17

Equ Tab$    to \09\
Equ CRLF$   to \0D0A\
Equ LF$     to \0A\
Equ Comma$  to ','


Main:
    Debug
    QuoteKeys = ''
    Flag = ''
    OPEN 'DICT.RETAINED_WAFERS' TO DictVar THEN
        SearchString = 'WAFER_SIZE' : @VM : '150 mm 6 in': @FM
        
        Btree.Extract(SearchString, 'RETAINED_WAFERS', DictVar, QuoteKeys, '', Flag)
        
        NumberWafers = DCount(QuoteKeys, @VM)
       
        IF Get_Status(errCode) THEN
            Msg(@window, MsgUp)
            ErrMsg(errCode)
            RETURN
        END
        
        IF QuoteKeys = '' THEN
            ErrMsg('No Quotes on file for customer ':CustNo)
            RETURN
        END
        
    END ELSE
        ErrMsg('Unable to open DICT.QUOTE in COMM_ANN_CONT.')
        RETURN
    END
    
return

Set_Property('SYSTEM', 'CURSOR', 'A')
*    debug

return

// ***************************************
// * Create Reactor Performances Reports *
// ***************************************

ScheduleDate = Iconv('04/25/2019', 'D')
Reactor_Services('ClearWafersExpected', ScheduleDate)
Reactor_Services('ClearWafersProcessed', ScheduleDate)
Reactor_Services('CreatePerformanceTrackers', ScheduleDate)
Reactor_Services('UpdatePerformanceTrackers', ScheduleDate)
Return

return Date()

GaNToolQuery = "LIST TOOL WITH TOOL_TYPE EQ 'G5' OR WITH TOOL_TYPE EQ 'G5+' OR WITH TOOL_TYPE EQ 'char' OR WITH TOOL_TYPE EQ 'GaN' OR WITH TOOL_TYPE EQ 'Transfer'"

WOMatKey = '167194*60'
CurrStatus = Xlate('WO_MAT', WOMatKey, 'CURR_STATUS', 'X')
return CurrStatus
* Database_Services('ActivateRecord', 'RDS', RDSKey)
* WOMatRepStatus = XLATE('WO_MAT',{WO_MAT_KEY},'REP_STATUS','X')
* RunStatus = XLATE('REACT_RUN',@ID,'RUN_STATUS','X')
* 
* RunStatus = OCONV(RunStatus,'[RUN_STATUS_CONV]')
* Ans = ''
* BEGIN CASE
*     CASE WOMatRepStatus NE '' AND RunStatus NE ''
*          Ans = WOMatRepStatus
*         
*      CASE WOMatRepStatus = '' AND RunStatus NE ''
*          Ans = RunStatus
*         
*      CASE WOMatRepStatus NE '' AND RunStatus = ''
*           Ans = WOMatRepStatus
*           
*       CASE 1
*            Ans = ''
*            
* END CASE





StartDTM  = IConv(OConv(Date(), 'D') : ' ' : OConv(Time(), 'MT'), 'DT') - '0.5'
StartDays = StartDTM[1, 'F.']
StartHours = '.' : StartDTM[-1, 'B.']
StartHours = StartHours * 86400
StartHours += StartDays * 24
EndDTM = IConv(OConv(Date(), 'D') : ' ' : OConv(Time(), 'MT'), 'DT')
EndDays = EndDTM[1, 'F.']
EndHours = '.' : EndDTM[-1, 'B.']
EndHours = EndHours * 86400
EndHours += EndDays * 24

ElapHours = ( (EndHours - StartHours) / 86400 ) * 24

return ElapHours


OverrideGroups = 'LEAD':@VM:'SUPERVISOR':@VM:'ENGINEER':@VM:'ENG_TECH'
Response = Dialog_Box('NDW_VERIFY_USER', @WINDOW, @USER4:@FM:OverrideGroups)
return


* 
* LWISig = Xlate('RDS', 229935, 'LWI_CI_SIG', 'X')
* return LWISig
* 
* NCRList = Database_Services('ReadDataRow', 'SYSLISTS', 'RESEND_NCR')
* NCRList = Delete(NCRList, 1, 0, 0)
* For each NCRKey in NCRList using @FM setting fPos
*    NCRRec = Database_Services('ReadDataRow', 'NCR', NCRKey)
*    If Error_Services('NoError') and NCRRec NE '' then
*        Database_Services('WriteDataRow', 'NCR', NCRKey, NCRRec, True$, False$, True$)
*        If Error_Services('HasError') then
*            ErrorMsg = Error_Services('GetMessage')
*            ErrMsg(ErrorMsg)
*        end
*    end else
*        ErrorMsg = Error_Services('GetMessage')
*        ErrMsg(ErrorMsg)
*    end
* Next NCRKey
* 
* return
* 
* 
* Stack = RetStack()
* return Stack
* RejQty = Obj_NCR('RejQty', 154238)
* return RejQty
* 
*    If @USER4 EQ 'FRANCOIS_R' then
*        // RDS_LAYER / TOOL_PARMS Project
*        PSN       = Record<RDS_PROD_SPEC_ID$>
*        ReactorNo = Record<RDS_REACTOR$>
*        // If reactor has not yet been assigned to RDS -> Fetch scheduled reactor
*        If ReactorNo EQ '' then ReactorNo = {SCHED_REACTOR}
*        WorkOrder = Record<RDS_WO$>         
*        If (PSN NE '') and (ReactorNo NE '') then            
*            OrigReactor = OrigRecord<RDS_REACTOR$>
*            NewReactor  = ReactorNo
*            If OrigReactor NE NewReactor then
*                // Update RDS_LAYER parameters to match new reactor
*                GoSub Update_RDS_LAYER_Parms
*            end            
*        end
*    end
* Update_RDS_LAYER_Parms:
*    
*    LogData      = ''
*    LogData<1>   = LoggingDTM
*    LogData<2> = 'Creating/Updating RDS_LAYER record(s) for RDS: ':@ID:' PSN: ':PSN:' Reactor: ':ReactorNo
*    Logging_Services('AppendLog', objLog2, LogData, @RM, @FM)
*    // Update/populate RDS_LAYER record(s) using Tool_Parms_Services       
*    ToolParmKey = Tool_Parms_Services('GetCurrentToolParmKey', PSN, ReactorNo)
*    If ToolParmKey NE '' then
*        ToolParmRec = Database_Services('ReadDataRow', 'TOOL_PARMS', ToolParmKey)
*        ToolParmLayers  = ToolParmRec<TOOL_PARMS.LS_ID$>
*        RDSLayerKeys    = Record<RDS_RDS_LAYER_KEYS$>
*        For each RDSLayerKey in RDSLayerKeys
*            RDSLayerID  = Field(RDSLayerKey, '*', 2)
*            RDSLayerRec = Database_Services('ReadDataRow', 'RDS_LAYER', RDSLayerKey)
*            Locate RDSLayerID in ToolParmLayers using @VM setting LayerPos then
*                RDSLayerRec<RDS_LAYER_DOPANT$>            = ToolParmRec<TOOL_PARMS.DOPANT$, LayerPos>
*                RDSLayerRec<RDS_LAYER_EPI_DILUENT$>       = ToolParmRec<TOOL_PARMS.EPI_DILUENT$, LayerPos>
*                RDSLayerRec<RDS_LAYER_DILUENT_ADJ_PARAM$> = ToolParmRec<TOOL_PARMS.DILUENT_ADJ_PARAM$, LayerPos>
*                RDSLayerRec<RDS_LAYER_DOPANT_FLOW$>       = ToolParmRec<TOOL_PARMS.DOPANT_FLOW$, LayerPos>
*                RDSLayerRec<RDS_LAYER_EPI_TIME$>          = ToolParmRec<TOOL_PARMS.EPI_TIME$, LayerPos>
*                RDSLayerRec<RDS_LAYER_HCL_FLOW$>          = ToolParmRec<TOOL_PARMS.HCL_FLOW$, LayerPos>
*                RDSLayerRec<RDS_LAYER_BAKE_TIME$>         = ToolParmRec<TOOL_PARMS.BAKE_TIME$, LayerPos>
*                RDSLayerRec<RDS_LAYER_EPI_H2_FLOW$>       = ToolParmRec<TOOL_PARMS.EPI_H2_FLOW$, LayerPos>
*                RDSLayerRec<RDS_LAYER_TCS_FLOW$>          = ToolParmRec<TOOL_PARMS.TCS_FLOW$, LayerPos>
*                RDSLayerRec<RDS_LAYER_DCS_FLOW$>          = ToolParmRec<TOOL_PARMS.DCS_FLOW$, LayerPos>
*                RDSLayerRec<RDS_LAYER_AUX1$>              = ToolParmRec<TOOL_PARMS.AUX1$, LayerPos>
*                RDSLayerRec<RDS_LAYER_AUX2$>              = ToolParmRec<TOOL_PARMS.AUX2$, LayerPos>
*                RDSLayerRec<RDS_LAYER_F_OFFSET$>          = ToolParmRec<TOOL_PARMS.F_OFFSET$, LayerPos>
*                RDSLayerRec<RDS_LAYER_S_OFFSET$>          = ToolParmRec<TOOL_PARMS.S_OFFSET$, LayerPos>
*                RDSLayerRec<RDS_LAYER_R_OFFSET$>          = ToolParmRec<TOOL_PARMS.R_OFFSET$, LayerPos>
*                RDSLayerRec<RDS_LAYER_ETCH1$>             = ToolParmRec<TOOL_PARMS.ETCH1$, LayerPos>
*                RDSLayerRec<RDS_LAYER_ETCH2$>             = ToolParmRec<TOOL_PARMS.ETCH2$, LayerPos>
*                RDSLayerRec<RDS_LAYER_OVERGROW_REQ$>      = ToolParmRec<TOOL_PARMS.OVERGROW_REQ$, LayerPos>
*                RDSLayerRec<RDS_LAYER_SUSC_ETCH$>         = ToolParmRec<TOOL_PARMS.SUSC_ETCH$, LayerPos>
*                RDSLayerRec<RDS_LAYER_UL_TEMP$>           = ToolParmRec<TOOL_PARMS.UNLOAD_TEMP$, LayerPos>
*                RDSLayerRec<RDS_LAYER_MODIFY_USER$, -1>   = ToolParmRec<TOOL_PARMS.ENTRY_USERNAME$>
*                RDSLayerRec<RDS_LAYER_MODIFY_DTM$, -1>    = Field(ToolParmKey, '*', 3)
*                RDSLayerRec<RDS_LAYER_TOOL_PARMS_KEY$>    = ToolParmKey
*            end
*            // Remove logging once successfully deployed to production.
*            Database_Services('WriteDataRow', 'RDS_LAYER', RDSLayerKey, RDSLayerRec, True$, False$, True$)
*            LogData<2>   = 'RDS_LAYER record for RDSNo: ':@ID:' Layer No: ':RDSLayerID:' successfully created/updated'
*            Logging_Services('AppendLog', objLog2, LogData, @RM, @FM)
*        Next RDSLayerID
*    end
*    
* return
* debug
* WOStep = 1
* WOMatRec = Xlate('WO_MAT', '166962*53', '', 'X')
* LOCATE WOStep:'UNLOAD' IN WOMatRec<WO_MAT_SIG_PROFILE$> USING @VM SETTING Pos THEN
* 	
*    CurrSig = WOMatRec<WO_MAT_SIGNATURE$,Pos>
*    
*    CurrSigDTM = OCONV(WOMatRec<WO_MAT_SIG_DTM$,Pos>,'DT4/^HS')
*    CurrSigDate = CurrSigDTM[1,' ']
*    CurrSigTime = CurrSigDTM[COL2()+1,' ']
* 
*    CurrDTM = OCONV(WOMatRec<WO_MAT_SIG_DTM$,Pos>,'DT/4^HS')
*    CurrDate = CurrDTM[1,' ']
*    CurrTime = CUrrDTM[COL2()+1,' ']
* end
* 
* return
* 
* 
* 
* CurrDTM = ICONV(OCONV(Date(), 'D4'):' ':OCONV('','MTS'),'DT')
* 
* return
* 
* Array = ''
* Array<1> = 4
* ArraySum = Sum(Array)
* return ArraySum
* 
* Set_Property('SYSTEM', 'CURSOR', 'A')
* return              
* 
* ROTRReason = '100% scan required due to ROTR maint.'
* ErrorMsg = ROTRReason:CRLF$:'A 100% scan must be run in order to accept ROTR'
* ErrMsg(ErrorMsg)
* return 
* Dialog_Box( 'NDW_MAKEUP_WAFER_NCR', @WINDOW, 4445)
* return
* 
* 
* Done = False$
* ROTRMaintReset = True$
* ThisRDSNo = 229935
* StopRDS = 229934
* If ROTRMaintReset EQ True$ then If ThisRDSNo EQ StopRDS then Done = True$
* 
* return Done
* Valid = False$
* If Not(Valid) then Valid = True$
* return Valid
* 
* PSN = Xlate('WO_LOG', 166000, 'PS_NO', 'X')
* 
* TestArray = '1,2,3'
* Convert ',' to @FM in TestArray
* TestArray = Insert(TestArray, 0, 0, 0, '0')
* 
* return TestArray
* RunCount = 8
* WafersProcessed = RunCount * 25
* NCRCount = 35
* ReactorYield = ((WafersProcessed - NCRCount) / WafersProcessed) * 100
* 
* return ReactorYield
* 
* Reactor = 20
* ROTREnabled          = Xlate('REACTOR', Reactor, 'ENABLE_ROTR', 'X')
* If ROTREnabled EQ True$ then ErrMsg('ROTR Enabled')
* return ROTREnabled
* 
* BadWOMatKeys = ''
* List = Xlate('SYSLISTS', 'WO_MAT_WITH_R', '', 'X')
* List = Delete(List, 1, 0, 0)
* BadKey = ''
* For each Key in List using @FM setting fPos
*    BadKey = Index(Key, '*', 1)
*    If BadKey EQ 0 then
*        BadWOMatKeys<-1> = Key
*    end
* Next Key
* 
* Database_Services('WriteDataRow', 'SYSLISTS', 'WO_MAT_WITHOUT_CASS', BadWOMatKeys)
* return 0 
* 
* 
* DOSFile = ''
* RejFound = ''
* RejKey = ''
* Done = False$
* For Key = 190001 to 210000
*    DOSFile = Xlate('SAP_COMM_LOG', Key, 'DOS_FILE', 'X')
*    RejFound = Index(DOSFile, 'R', 1)
*    If RejFound NE 0 then
*        Done = True$
*        RejKey = Key
*    end
* Until Done EQ True$
* Next Key
* 
* Return RejKey
* 
* WoMatKey = '166738*43'
* WOMatRepStatus = XLATE('WO_MAT',WoMatKey,'REP_STATUS','X')
* RunStatus = XLATE('REACT_RUN','282320','RUN_STATUS','X')
* 
* RunStatus = OCONV(RunStatus,'[RUN_STATUS_CONV]')
* 
* BEGIN CASE
*     CASE WOMatRepStatus NE '' AND RunStatus NE ''
*          Ans = WOMatRepStatus
*         
*      CASE WOMatRepStatus = '' AND RunStatus NE ''
*          Ans = RunStatus
*         
*      CASE WOMatRepStatus NE '' AND RunStatus = ''
*           Ans = WOMatRepStatus
*           
*       CASE 1
*            Ans = ''
* END CASE
* 
* 
* Return Ans
*    
* return
* 
* // Development code - UAT - 11/6/18
* // UAT paused - code needs to be vetted still
* 
* // Put command
* Host            = FTPServerIP
* LocalFile       = DosTable
* Username        = FTPUser
* Password        = FTPPassword
* LocalDirectory  = TransFilePathOut
* RemoteDirectory = 'ToSAP/':OutBoundDir
* RemoteFile      = ''
* ScriptPath      = ToSAPScriptName
* DeleteScript    = False$
* SSH             = False$
* FTP_Services('PostRequest', 'put', Host, 'MESSA005', LocalFile, '', Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, ScriptPath, DeleteScript, SSH, '', 3, False$)
* 
* // Get command
* Host            = FTPServerIP
* LocalFile       = ''
* Username        = FTPUser
* Password        = FTPPassword
* LocalDirectory  = TransFilePathOut
* RemoteDirectory = 'ToSAP/':OutBoundDir
* RemoteFile      = TransFileName:' verify.txt'
* ScriptPath      = ToSAPScriptName
* DeleteScript    = False$
* SSH             = False$
* FTP_Services('PostRequest', 'get', Host, 'MESSA005', LocalFile, '', Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, ScriptPath, DeleteScript, SSH, '', 3, False$)
* 
* RDSRec = Database_Services('ReadDataRow', 'RDS', 288020)
* return
* 
* WMOutKey = '166785*1*32'
* AllRDSNos = Xlate('WM_OUT', WMOutKey, 'RDS', 'X')
* MetNotCompList = ''
* 
* For each RDSNo in AllRDSNos using @VM
*    ThickAvgZ1 = Xlate('RDS', RDSNo, 'TTHICK_AVG_ALL_Z1', 'X')
*    ThickAvgZ2 = Xlate('RDS', RDSNo, 'TTHICK_AVG_ALL_Z2', 'X')  
*    If (ThickAvgZ1 EQ '') and (ThickAvgZ2 EQ '') then
*        Locate RDSNo in MetNotCompList using @FM setting fPos else
*            MetNotCompList<-1> = RDSNo
*        end   
*    end
* Next RDSNo
* 
* If MetNotCompList NE '' then
*    // One or more RDS metrology records are not complete
*    ErrorMessage = 'Process Error':@SVM:'RDS metrology data is not complete for RDS(s):':MetNotCompList
*    ErrMsg(ErrorMessage)
*    return 0
* end
* 
* return
* 
* 
* MaintScanReq = False$
* FailScanReq  = ''
* 
* ScanReq   = (MaintScanReq or FailScanReq)
* 
* return ScanReq
*    
* Username = @Username
* FullName = Xlate('LSL_USERS', Username, 'FIRST_LAST', 'X')
* 
* return FullName
* 
* QA_Services('ROTRImpactReport')
* 
* return 2
* 
* OIAdmins = Xlate('SEC_GROUPS', 'OI_ADMIN', 'USER', 'X')
* return OIAdmins
* 
* Database_Services('WriteDataRow', 'APP_INFO', 'ROTR_DATA_ENTRY_LOCK', True$)
* return
* 
* 
* SchedEvents = Schedule_Services('GetScheduleEvents', date(), date())
* WOList = ''
* For each Row in SchedEvents using @FM
*    ThisWO = Field(Row<1,2>, '*', 1)
*    Locate ThisWO in WOList using @VM setting vPos else
*        WOList<1,-1> = ThisWO
*    end
* Next Row
* 
* Table = 'WO_MAT_QA'
* Open 'DICT.':Table to @DICT then
*    Query = 'WO_NO':@VM:WOList:@FM
*    KeyList = ''
*    Option  = ''
*    Flag    = ''
*    Btree.Extract(Query, Table, @DICT, KeyList, Option, Flag) 
* end
* 
* Database_Services('WriteDataRow', 'SYSLISTS', 'HGCV_UAT', KeyList, True$, False$, True$)
* return KeyList
* RDSNo = 273752
* Database_Services('ActivateRecord', 'RDS', RDSNo)
* Parms  = {WO_MAT_KEY}:@RM
* Parms := '':@RM
* Parms :=  FIELD(@RECORD<256>,'*',2):@RM              ;* WOStep
* Parms := 'UNLOAD':@RM
* Parms := WO_MAT_QA_RECIPE$
* 
* QAMetData = obj_WO_Mat_QA( 'GetQAMet' , Parms )
* 
* return QAMetData
* 
* PSNo = 3524
* PSRec 		= XLATE('PROD_SPEC',PSNo,'','X')
* 
* QAMetData = obj_Prod_Spec('GetQAMet',PSNo:@RM:PSRec)
* QAMetData = Xlate('WO_MAT_QA', '166620*65', '', 'X')
* QAMetData = Insert(QAMetData, 5, 2, 0, '')
* QAMetData = Insert(QAMetData, 5, 2, 0, 0)
* QAMetData = Insert(QAMetData, 5, 2, 0, 'LR8IN.SET')
* QAMetData2 = obj_Prod_Spec('GetQAMet',PSNo:@RM:@RM:0)
* 
* return QAMetData
* 
* Debug
* 
! Update all WO_MAT_QA records currently in production.
* 
* HgCVList = Database_Services('ReadDataRow', 'SYSLISTS', 'HGCV_UAT')
* HgCVList = Delete(HgCVList, 1, 0, 0)
* 
* For each WoMatQAKey in HgCVList using @FM
*    Database_Services('ActivateRecord', 'WO_MAT_QA', WoMatQAKey)
*    Profiles = {PROFILE}
*    
*    Locate 'THICK_ONLY' in Profiles using @VM setting vPos then
*        MetRecipes      = {RECIPE}
*        ThickOnlyRecipe = MetRecipes<0, vPos>
*        ThickOnlyRecipe = Trim(ThickOnlyRecipe)
*        RecipeFound     = True$
*        NewProdRecipe   = ''
*        Begin Case
*            Case ThickOnlyRecipe EQ 'thin6inch'
*                NewProdRecipe = 'PROD_thin6'
*            Case ThickOnlyRecipe EQ '8inch'
*                NewProdRecipe = 'PROD_8inch'
*            Case ThickOnlyRecipe EQ 'thin8inch'
*                NewProdRecipe = 'PROD_thin8'
*            Case ThickOnlyRecipe EQ 'IRC6in_6mm'
*                NewProdRecipe = 'PROD_IRC6'
*            Case ThickOnlyRecipe EQ 'Wacker'
*                NewProdRecipe = 'PROD_Wack'
*            Case ThickOnlyRecipe EQ '8IN_INF'
*                NewProdRecipe = 'PROD_INF'
*            Case Otherwise$
*                 // Unexpected THICK_ONLY recipe name -> proceed to next PSN
*                 RecipeFound = False$
*        End Case
*    
*        If RecipeFound then
*            MetRecipes<0, vPos> = NewProdRecipe
*            {RECIPE} = MetRecipes
*            Database_Services('WriteDataRow', 'WO_MAT_QA', WoMatQAKey, @Record, True$, False$, True$)
*        end
*    end
*    
*    
* Next WoMatQAKey
* 
* return
* 
* 
* RDSKeyID = 266731
* ScanRecipe = 'EPISIL'
* SODWaferArray   = QA_Services('GetSODPerWafer', RDSKeyID, ScanRecipe)
* return SODWaferArray
* 
* 
* TableHandle = Database_Services('GetTableHandle', 'WO_MAT_QA')
* 
* return
* 
* ScanRecipe = '8IN_THIN ROTR'
* ExclList   = Database_Services('ReadDataRow', 'APP_INFO', 'SURFSCAN_EXCLUSION_LIST')
* Locate ScanRecipe in ExclList using @FM setting fPos else
*    ErrMsg('Recipe not found in SurfScan spec list')
* end
* Return
* 
* Leads = Xlate('SEC_GROUPS', 'LEAD', 'USER', 'X')
* Sups  = Xlate('SEC_GROUPS', 'SUPERVISOR', 'USER', 'X')
* Recipients = SRP_Join_Arrays(Leads, Sups, @VM, 'OR')
* Recipients		= XLATE('NOTIFICATION','WO_ENTRY',2,'X')
* return Recipients
* 
* 
* 
* ROTRFailLimit   = 2
* CleanReq        = False$
* PSNo            = 4617
* PRSStages = Xlate('PROD_SPEC', PSNo, 'PRS_STAGE_KEY', 'X')
* If Index(PRSStages, 'POST', 1) then
*    CleanReq = Xlate('PRS_STAGE', PSNo:'*POST', 'CLEAN_SIG_REQ', 'X') 
* end
* 
* return CleanReq
* 
* ROTRStatus = Xlate('DEVELOPMENT', 'ROTR', 'STATUS', 'X')
* TestReact = False$
* If Not(ROTRStatus) then
*    TestReactList = Xlate('DEVELOPMENT', 'ROTR', 'F4', 'X')
*    Reactor       = 22
*    TestReact = Index(TestReactList, Reactor, 1)
* end
* 
* return TestReact
* 
* ReactorList = Database_Services('ReadDataRow', 'SYSLISTS', 'REACTOR_LIST')
* ReactorList = Delete(ReactorList, 1, 0, 0)
* 
* For each ReactorID in ReactorList using @FM setting fPos
*    Database_Services('ActivateRecord', 'REACTOR', ReactorID)
*    {ROTR_STATUS} = 'P'
*    {ROTR_STATUS_REASON} = ''
*    Database_Services('WriteDataRow', 'REACTOR', ReactorID, @Record, True$, False$, True$)
* Next ReactorID
* return
* 
* 
* SchedKey = '20*17904*163386'
* Sched = Database_Services('ReadDataRow', 'SCHEDULER', SchedKey)
* Key1 = Field(SchedKey, '*', 1)
* Key2 = Field(SchedKey, '*', 2)
* Key3 = Field(SchedKey, '*', 3)
* MaintStatus = Qa_Services('GetMaintenanceScanStatus', 270181)
* FailScanStatus = Qa_Services('GetFailureScanStatus', 270181)
* SODPerWafer = Qa_Services('GetSODPerWafer2.0', 270245, 'EPISIL')
* 
* Return 1
* 
* 
* MarksList = Database_Services('ReadDataRow', 'SYSLISTS', 'MARK_REPORT')
* 
* GoodRecipe = '8IN_THIN ROTR'
* CleanedList = Database_Services('ReadDataRow', 'SYSLISTS', 'CLEAN_INSP_WITH_OLD_RECIPE')
* CleanedList = Delete(CleanedList, 1, 0, 0)
* RDSNotCleaned = ''
* 
* For each RDS in MarksList using @FM setting fPos
*    CIKey = Xlate('RDS', RDS, 'LWI_CI_NO', 'X')
*    Locate CIKey in CleanedList using @FM setting cPos else
*        RDSNotCleaned<-1> = RDS
*    end
* Next RDS
* 
* Database_Services('WriteDataRow', 'SYSLISTS', 'RDS_NOT_CLEANED', RDSNotCleaned)
* 
* return 1
* 
* 
* GoodRecipe = '8IN_THIN ROTR'
* DirtyList = Database_Services('ReadDataRow', 'SYSLISTS', 'CLEAN_INSP_WITH_OLD_RECIPE')
* DirtyList = Delete(DirtyList, 1, 0, 0)
* 
* For each CIKey in DirtyList using @FM
*    NeedToWrite = False$
*    Database_Services('ActivateRecord', 'CLEAN_INSP', CIKey)
*    SpecRecipes = {SPEC_SURFSCAN_RECIPE}
*    For each SpecRecipe in SpecRecipes using @VM setting SpecRecipeIndex
*        If SpecRecipe NE GoodRecipe then
*            SpecRecipes<1, SpecRecipeIndex> = GoodRecipe
*            {SPEC_SURFSCAN_RECIPE} = SpecRecipes
*            NeedToWrite = True$
*        end
*    Next SpecRecipe
*    ScanRecipes = {SCAN_RECIPE}
*    For each ScanRecipe in ScanRecipes using @VM setting ScanRecipeIndex
*        If ScanRecipe NE GoodRecipe then
*            ScanRecipes<1, ScanRecipeIndex> = GoodRecipe
*            {SCAN_RECIPE} = ScanRecipes
*            NeedToWrite = True$
*        end
*    Next ScanRecipe
*    If NeedToWrite EQ True$ then
*        Database_Services('WriteDataRow', 'CLEAN_INSP', CIKey, @Record, True$, False$, True$)
*        If Error_Services('HasError') then
*            ErrMsg('Error updating CLEAN_INSP record: ':CIKey)
*        end
*    end
* Next CIKey
* 
* 
* return 1
* 
* TencorRecipe = 'EPISIL'
* RDSKey       = 266731
* SODPerWafer = QA_Services('GetSODPerWafer2.0', RDSKey, TencorRecipe)
* return SODPerWafer
* debug
* NumUSLFail = QA_Services('GetNumUSLFails2.0', 266723)
* return NumUSLFail
* 
* NumRecipes = 0
* CIRecord = ''
* SODWaferArray = QA_Services('GetSODPerWafer', 267058)
* return SODWaferArray
* WaferNos = SODWaferArray<1>
* SODVals  = SODWaferArray<2>
* For each Wafer in WaferNos using @VM
*    If Wafer NE '' then CIRecord<1, NumRecipes, Wafer> = SODVals<1, Wafer>
* Next Wafer
* return CIRecord
* 
* NCRStatus = QA_Services('GetNCRStatus', 267058)
* return NCRStatus
* 
* NCRFails = ''
* RDSKeys = Xlate('WO_LOG', 166523, 'RDS_KEYS', 'X')
* For each RDS in RDSKeys using @VM
*    NCRStatus = QA_Services('GetNCRStatus', RDS)
*    If NCRStatus EQ False$ then
*        NCRFails<-1> = RDS
*    end
* Next RDS
* 
* return NCRFails 
! Implement this into GetROTRStatus2.0
* SelReactor    = 27
* StartDate     = Date() - 30
* WorkOrderList = ''
* PSNList       = ''
* SchedDetKeys = Schedule_Services('GetScheduleDetailKeys', StartDate, '', SelReactor, '', '')
* For each SchedDetKey in SchedDetKeys
*    SchedDet = Schedule_Services('GetScheduleDetail', SchedDetKey)
*    ThisWorkOrder = SchedDet<SCHED_DET_WO_NO$>
*    Locate ThisWorkOrder in WorkOrderList using @FM setting fPos else
*        WorkOrderList = Insert(WorkOrderList, 0, 0, 0, ThisWorkOrder)
*    end
* Next SchedDetKey
* 
* return SchedDetKeys
* UCL = Qa_Services('PostUCLRequest', 269112)
* 
* UCL = Qa_Services('GetUCL', 269012)
* UCL = Qa_Services('GetUCL', 269112)
* 
* ROTRResult = QA_Services('GetROTRStatus2.0', 269112)
* 
* NumFail = QA_Services('GetNumROTRFailures', 269112)
* TestReactList = 21:@FM:27
* Reactor = 22
* TestReact = Index(TestReactList, Reactor, 1)
* 
* return NumFail
* 
* Response = 'P'
* Stat     = Response<1>
* Mesg     = Response<2>
* USLFail  = Stat EQ 'P' | 
*           or Stat EQ 'C'
* return
* 
* LogPath     = 'C:\Users\StieberD\Desktop'
* LogDate     = Oconv(Date(), 'D4/')
* LogTime     = Oconv(Time(), 'MTS')
* LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' Testing.csv'
* Headers     = 'Logging DTM' : @FM : 'Notes'
* objLog      = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, Comma$, Headers, '', False$, False$)
* LoggingDTM  = LogDate : ' ' : LogTime   ; // Logging DTM
* LogData     = 'Testing'
* EmailAddr   = 'dstieber@srpcs.com'
* Logging_Services('AppendLog', objLog, LogData, @RM, @FM, False$, EmailAddr, LogData)
* 
* return 
* 
* MsgTxt = 'An error occured due to multiple users attempting to create an RDS simultaneously. ' |
*       : @SVM : 'Would you like to retry?'
* Response  = Msg(@Window, '', 'RETRY', '', MsgTxt)
* return Response
*                        
* NextWO = NextKey("DUMMY")
* return
* 
* ReactorNo = Xlate('RDS', 268554, 'SCHED_REACTOR', 'X')
* RDSKeys   = Xlate('WO_STEP', '166522*1', 'RDS_KEY', 'X')
* ROTRResult = QA_Services('GetNumROTRFailures', 269112)
* 
* return ROTRResult
* 
* CIReactor = Xlate('CLEAN_INSP', 2208606, 'REACT_NO', 'X')
* return 
* Leads = Xlate('SEC_GROUPS', 'LEAD', 'USER', 'X')
* Sups  = Xlate('SEC_GROUPS', 'SUPERVISOR', 'USER', 'X')
* Recipients = SRP_Join_Arrays(Leads, Sups, @VM, 'OR')
* return 
* Sleepery(10000)
* Errmsg('Sleepery returned.')
* WinYield()
* Errmsg('WinYield returned.')
* Yield();Yield();Yield();Yield();Yield();Yield();Yield();Yield()
* Errmsg('Yields returned.')
* return
* 
* 
* MsgTxt    = 'An error occured while creating an RDS. Would you like to retry?'
* Response  = Msg(@Window, '', 'RETRY', '', MsgTxt)
* return Response
* 
* Proc = 'TEST_DANIEL2'
* hSysProcs = Database_Services('GetTableHandle', 'SYSPROCS')
* Locked = 0
* Tries = 0
* LOOP
* 	Lock hSysProcs, Proc then
*		Locked = 1
*		Errmsg('Got the lock!')
* 	END ELSE
*		Yield()
*		Tries += 1
* 	END
* UNTIL Locked OR Tries = 10 REPEAT
* IF Tries = 10 and Locked EQ False$ THEN
* 	Mesg = 'Unable to lock procedure ':Proc
* 	Errmsg(Mesg)
* 	RETURN 0
* END else
*    Unlock hSysProcs, Proc else NULL
* end
* 
* return
* 
* WOMatKey = '166534*8'
* CassetteQty      = XLATE('WO_MAT', WOMatKey, 'WAFER_QTY', 'X')
* CurrWfrCnt = XLATE('WO_MAT',WOMatKey,'CURR_WFR_CNT','X')
* return 
* EpiDiluent     = '3.00'
* EpiDiluent     = IConv(EpiDiluent, 'MD2')
* CurrentTime    = OConv(Time(), 'MT')
* CurrentDate    = OConv(Date(), 'D')
* CurrentDTM     = CurrentDate:' ':CurrentTime
* InternalTime   = IConv(CurrentTime, 'MT')
* InternalDate   = IConv(CurrentDate, 'D')
* CurrentDTM     = IConv(CurrentDTM, 'DT')
* CurrentDTM     = OConv(CurrentDTM, 'DT/^3HS')
* 
* return
* 
* NonEPPWO = '165874*1'
* TotRej = Xlate('WO_STEP', NonEPPWO, 'TOT_REJ_TOTAL', 'X')
* 
* return
* 
* ScrapQty = 0
* TWQty = 0
* WOLog = '166389'
* WoMatKeys = Xlate('WO_LOG', WOLog, 'WO_MAT_KEY', 'X')
* For each WoMatKey in WoMatKeys using @VM
*    Database_Services('ActivateRecord', 'WO_MAT', WoMatKey)
*    SAPData = obj_WO_Mat('GetGRProps',@ID:@RM:@RECORD)
*    ScrapQty += SAPData<2>
*    TWQty += SAPData<3>
* Next WoMatKey
* 
* debug
* 
* return
* 
* CurrentTime    = OConv(Time(), 'MT')
* CurrentDate    = OConv(Date(), 'D')
* CurrentTime    = Fmt(CurrentTime, "R(0)#5")
* CurrentDTM     = CurrentDate:' ':CurrentTime
* CurrentDTM     = IConv(CurrentDTM, 'DT')
* 
* return
* 
* SchedReactor = Xlate('RDS', 267465, 'SCHED_REACTOR', 'X')
* IsNumeric = Num(SchedReactor)
* return 
* ROTRStatus = Qa_Services('GetROTRStatus', 258958)
* PRSStages = Xlate('PROD_SPEC', 4059, 'PRS_STAGE_KEY', 'X')
* CleanReq  = Index(PRSStages, 'POST', 1)
* Wafer1SOD = Xlate('CLEAN_INSP', 2199645, 'SOD_WAFER_1', 'X')
* 
* Return
* 
* RDSNo = 261161
* TencorRecipe = '8IN_IFX_ROTR'
* If RDSNo NE '' |
*    and TencorRecipe EQ '' then
*        Cool = True$
* end else
*        Cool = False$
* end
* SpecUCL = Qa_Services('PostUCLRequest', RDSNo, TencorRecipe)
* return 
* 
* Database_Services('ActivateRecord', 'RDS', RDSNo)
* ProdSpecID = {PROD_SPEC_NO}
* Exists = RowExists('RDS', 1111111)
* return
* WriteRights = Security_Check( 'Spec', WRITE$ )
* 
* return
* 
* StartDate = Date()
* SchedDetails = Schedule_Services('GetScheduleEventSummary',48, 166443, StartDate, '', True$)
* SchedStartDt = SchedDetails<SCHEDULE_ENTRY_DATE$>
* List = ''
* For i = 1 to 10
*    List<i> = i
* Next i
* NumItems = Dcount(List, @FM)
* SecToLastItem = List<NumItems - 1>
* List = Insert(List, NumItems, 0, 0, 11)
* // Note to self: GetTableHandle is returning an "expired" copy of the table handle, which does not include
* //               the MFS, which was recently attached to the table. Need to fix.
* MFSList = Database_Services('GetTableHandle', 'WO_MAT_QA')
* 
* Return 
* 
* SAPHoldRow = ''
* SAPHoldRow<1> = 'WO_MAT_HOLD'
* SAPHoldRow<2> = '164811*1'
* SAPHoldRow<3> = 1
* SAPHoldRow<4> = 1
* 
* Database_Services('WriteDataRow', 'SAP_HOLD', '', SAPHoldRow)
* If Not(Error_Services('NoError')) then
*    ErrorMsg = Error_Services('GetMessage')
* end
* 
* return 7
* 
* ROTRStatus = QA_Services('GetROTRStatus', 262546)
* return 6
* 
* 
* ProjectStatus = Development_Services('GetProjectStatus', 'HGCV')
* DevWorkOrder  = Xlate('DEVELOPMENT', 'HGCV', 'F4', 'X')
* 
* return 5
* 
* PSNo = 4282
* PSRec = Database_Services('ReadDataRow', 'PROD_SPEC', PSNo)
* QAMetData  = obj_Prod_Spec('GetQAMet',PSNo:@RM:@RM:1)
* QAMetData  = obj_Prod_Spec('GetQAMet',PSNo:@RM:PSRec)
* WOMatKey   = '166425*1'
* WOMatQARec = ''
* AllQAMetKeysStruct	= obj_WO_Mat_QA('GetQAMetKeys',WOMatKey:@RM:WOMatQARec)
* return 4
* 
* 
* Database_Services('ActivateRecord', 'RDS', 229935)
* RDSLayerKeys    = @Record<RDS_RDS_LAYER_KEYS$>
* For each RDSLayerKey in RDSLayerKeys
*    RDSLayerID  = Field(RDSLayerKey, '*', 2)
* Next RDSLayerKey
* 
* return 3
* 
* ScrapQty = 0
* TWQty = 0
* WOLog = 165910
* WoMatKeys = Xlate('wo_log', WOLog, 'WO_MAT_KEY', 'X')
* For each WoMatKey in WoMatKeys using @VM
*    Database_Services('ActivateRecord', 'WO_MAT', WoMatKey)
*    SAPData = obj_WO_Mat('GetGRProps',@ID:@RM:@RECORD)
*    ScrapQty += SAPData<2>
*    TWQty += SAPData<3>
* Next WoMatKey
* 
* debug
* Return 2
* 
* 
* 
* 
* RDSNo = 254008
* Database_Services('ActivateRecord', 'RDS', RDSNo)
* HgCVTest = {HGCV_TEST}
* 
* MetPropFlag = Obj_RDS('MetPropFlag', @ID:@RM:@RECORD:@RM:'CRES')
* 
* 
* 
* Return 1
* 
* 
* 
* 
* 
* ExternalDate = OConv(Date(), 'D')
* Swap ' ' with '_' in ExternalDate
* ExternalTime = OConv(Time(), 'MTHS')
* Swap ':' with '_' in ExternalTime
* 3839*41*18548.35457
* 18547.34848
* return 5
* ReactorNo = 28
* 
* CurrPSNList = Database_Services('ReadDataRow', 'SYSLISTS', 'CURRPRODSPECLIST')
* CurrPSNList = Delete(CurrPSNList, 1, 0, 0)
* For each PSN in CurrPSNList
*    Query  = 'SELECT RDS WITH PROD_SPEC_ID EQ ':PSN:' AND WITH REACTOR EQ ':ReactorNo:' BY-DSND DATE_IN'
*    GoSub ClearCursors
*    Set_Status(0)
*    RList(Query, TARGET_ACTIVELIST$, '', '', '')
*    If Get_Status(ErrorCode) then
*        ErrorMsg = 'Error calling RList(): error code ':ErrorCode
*        Error_Services('Add', ErrorMsg)
*        return
*    end
*    NumResultRows = @RecCount
*    If NumResultRows LT 1 then
*        // No RDS records found that match this criteria. Widen the query to search the most recent
*        // RDS that matches the Recipe ID and PSN, but to any reactor.
*        Query  = 'SELECT RDS WITH PROD_SPEC_ID EQ ':PSN:' BY-DSND DATE_IN'
*        GoSub ClearCursors
*        Set_Status(0)
*        RList(Query, TARGET_ACTIVELIST$, '', '', '')
*        If Get_Status(ErrorCode) then
*            ErrorMsg = 'Error calling RList(): error code ':ErrorCode
*            Error_Services('Add', ErrorMsg)
*            return
*        end
*    end            
*    Readnext RDSKey then
*        DateIn = Xlate('RDS', RDSKey, 'DATE_IN', 'X')
*        TPLogKey = PSN:'*':ReactorNo
*        TPLogRec = ''
*        TPLogRec<1> = RDSKey
*        TPLogRec<2> = DateIn
*        Database_Services('WriteDataRow', 'TOOL_PARMS_LOG', TPLogKey, TPLogRec)
*    end
*    GoSub ClearCursors
* Next PSN
* 
* return 3
* 
* Database_Services('ActivateRecord', 'RDS_LAYER', '261234*L1')
* RDSNo = Field(@ID, '*', 1)
* ReactorNo = Xlate('RDS', RDSNo, 'REACTOR', 'X')
* PSN       = Xlate('RDS', RDSNo, 'PROD_SPEC_ID', 'X')
*NewToolParmsKey = Tool_Parms_Services('CreateToolParmsRec', PSN, ReactorNo, RDSNo)
* 
* Return 2
* 
* Qa_Services('SignFQAStage', 229935, @USER4)
* If Error_Services('NoError') else
*    ErrMsg = Error_Services('GetMessage')
* end
* return 1
* ToolLogList = Database_Services('ReadDataRow', 'SYSLISTS', 'TOOL_LOG_DTM')
* // Chomp info line
* ToolLogList = Delete(ToolLogList, 1, 0, 0)
* 
* For each ToolLogID in ToolLogList using @FM
*    ToolLogRec = Database_Services('ReadDataRow', 'TOOL_LOG', ToolLogID)
*    NeedToWrite = False$
*    If ToolLogRec<4> EQ '' then
*        ToolLogRec<4> = '18540.55196'
*        NeedToWrite = True$
*    end
*    If ToolLogRec<5> EQ '' then
*        ToolLogRec<5> = 'FRANCOIS_R'
*        NeedToWrite = True$
*    end
*    If NeedToWrite then
*        Database_Services('WriteDataRow', 'TOOL_LOG', ToolLogID, ToolLogRec, True$, False$, True$)
*    end
*    
* Next ToolLogID
* 
* return 12
* @ID = 229935
* Open 'DICT.RDS' to @DICT then
* @DICT = Database_Services('GetTableHandle', 'DICT.RDS')
* @DICT = Database_Services('GetTableHandle', 'DICT.RDS')
* @RECORD = Database_Services('ReadDataRow', 'RDS', @ID)
* Database_Services('ActivateRecord', 'RDS', 229935)
* WorkOrder = {WO}
* end
* 
* return 11
* 
* 
* RDSList = Xlate('TOOL_PARMS', '2685*59*18541.55166', 'RDS_LIST', 'X')
* return 10
* 
* 
* 
* PSN = 4693
* ReactorNo = 31
* Query  = 'SELECT RDS WITH PROD_SPEC_ID EQ ':PSN:' AND WITH REACTOR EQ ':ReactorNo:' BY-DSND DATE_IN'
* GoSub ClearCursors
* Set_Status(0)
* RList(Query, TARGET_ACTIVELIST$, '', '', '')
* If Get_Status(ErrorCode) then
*    ErrorMsg = 'Error calling RList(): error code ':ErrorCode
*    Error_Services('Add', ErrorMsg)
*    return
* end
* Done = False$
* Readnext Row else Done = True$
* Return 9
* 
* 
* PSN = 4693
* ReactorNo = 31
* Query  = 'SELECT RDS WITH PROD_SPEC_ID EQ ':PSN:' AND WITH REACTOR EQ ':ReactorNo
* GoSub ClearCursors
* Set_Status(0)
* RList(Query, TARGET_ACTIVELIST$, '', '', '')
* If Get_Status(ErrorCode) then
*    ErrorMsg = 'Error calling RList(): error code ':ErrorCode
*    Error_Services('Add', ErrorMsg)
*    return
* end
* TempArray = ''
* Done = False$
* Loop
*    Readnext Row else Done = True$
* Until Done
*    DateIn = Xlate('RDS', Row, 'DATE_IN', 'X')
*    TempArray<-1> = Row:@VM:DateIn
* Repeat
* 
* SortedArray = SRP_Sort_Array(TempArray, 'DR2', 1)
* 
* Return 10
* 
* 
* 
* ScheduleDetKeys = Schedule_Services('GetScheduleDetailKeys', 18520, '', 41, '', '')
* For each SchedDetKey in ScheduleDetKeys
*    ScheduleDet = Schedule_Services('GetScheduleDetail', SchedDetKey)
* Next SchedDetKey
* NewTPKey = Tool_Parms_Services('CreateToolParmsRec', 4693, 31, 259013)
* 
* Return 7
* 
* 
* Done = False$
* Query  = 'SELECT TOOL_PARMS'
* GoSub ClearCursors
* Set_Status(0)
* RList(Query, TARGET_ACTIVELIST$, '', '', '')
* If Get_Status(ErrorCode) then
*    ErrorMsg = 'Error calling RList(): error code ':ErrorCode
*    Error_Services('Add', ErrorMsg)
*    return
* end else
*    Loop
*    Until Done EQ True$
*    
*        Readnext ToolParmID then
*            Database_Services('DeleteDataRow', 'TOOL_PARMS', ToolParmID)
*            
*        end else
*            Done = True$
*        end
*    Repeat
*    
* end
* 
* Return 6
* 
* ToolIDs = obj_Tool('KeysByType')
* 
* For Each ToolID in ToolIDs using @VM
*    
*    Query  = 'SELECT TOOL_LOG WITH TOOL_ID EQ "':ToolID:'" BY-DSND START_DTM'
*        GoSub ClearCursors
*        Set_Status(0)
*        RList(Query, TARGET_ACTIVELIST$, '', '', '')
*        If Get_Status(ErrorCode) then
*            ErrorMsg = 'Error calling RList(): error code ':ErrorCode
*            Error_Services('Add', ErrorMsg)
*            return
*        end else
*            // Query is good -> Continue
*            
*            CurrDTM = Date():'.':Time()
*            
*            ToolLogIndex = 1
*            Loop
*            Until ToolLogIndex GT 2
*                Readnext ToolLogID then
*                    // We want the second most recent tool log record.
*                    If ToolLogIndex EQ 2 then
*                        *Database_Services('DeleteDataRow', 'TOOL_LOG', ToolLogID)
*                        ToolLogRec = Database_Services('ReadDataRow', 'TOOL_LOG', ToolLogID)
*                        If ToolLogRec<4> EQ '' then
*                            ToolLogRec<4> = '18540.55196'
*                            ToolLogRec<5> = 'FRANCOIS_R'
*                            Database_Services('WriteDataRow', 'TOOL_LOG', ToolLogID, ToolLogRec)
*                        end
*                        *NewToolLogKey = ToolID:'*':CurrDTM
*                                                  
*                    end                    
*                    ToolLogIndex += 1
*                end
*            Repeat
*        end
*        GoSub ClearCursors
*        
* Next ToolID
* 
* Return 2
* 
* ClearCursors:
*    For counter = 0 to 8
*        ClearSelect counter
*    Next counter
* return
* 
* WOMatQAKey = '166351*27'
* Sequence = Xlate('PROD_SPEC', 4148, 'QA_MET_SEQUENCE', 'X')
* return 1
* 
* Query = 'SELECT TOOL_PARMS'
* RList(Query, TARGET_SAVELIST$, 'TOOL_PARMS_LIST', 'All TOOL_PARMS Records', False$)
* TPList = Database_Services('ReadDataRow', 'SYSLISTS', 'TOOL_PARMS_LIST')
* // Remove field containing list description
* TPList = Delete(TPList, 1, 0, 0)
* For each TPKey in TPList
*    Database_Services('DeleteDataRow', 'TOOL_PARMS', TPKey)
* Next TPKey
*    
* Return 0
* 
* 
* 
* AppointmentList     = Schedule_Services('GetScheduleEvents', 18520, 18537)
* ScheduleData = Schedule_Services('GetScheduleEventSummary', '', 166328, 18537, '', True$)
* Return 3
* 
* // Script to update UNLOAD PSNs with the new PROD naming convention introduced in the HgCV Project
* debug
* UnloadPSNList = Database_Services('ReadDataRow', 'SYSLISTS', 'PROD_PSNS_UNLOAD')
* // Chomp info line
* UnloadPSNList = Delete(UnloadPSNList, 1, 0, 0)
* 
* For each PSN in UnloadPSNlist using @FM
*    
*    PRSStageKey = PSN:'*UNLOAD'
*    PRSStageRec = Database_Services('ReadDataRow', 'PRS_STAGE', PRSStageKey)
*    MetTests    = PRSStageRec<PRS_STAGE_MET_TEST$>
*    Locate 'THICK_ONLY' in MetTests using @VM setting vPos then
*        MetRecipes      = PRSStageRec<PRS_STAGE_MET_RECIPE$>
*        ThickOnlyRecipe = MetRecipes<0, vPos>
*        ThickOnlyRecipe = Trim(ThickOnlyRecipe)
*        RecipeFound     = True$
*        NewProdRecipe   = ''
*        Begin Case
*            Case ThickOnlyRecipe EQ 'thin6inch'
*                NewProdRecipe = 'PROD_thin6'
*            Case ThickOnlyRecipe EQ '8inch'
*                NewProdRecipe = 'PROD_8inch'
*            Case ThickOnlyRecipe EQ 'thin8inch'
*                NewProdRecipe = 'PROD_thin8'
*            Case ThickOnlyRecipe EQ 'IRC6in_6mm'
*                NewProdRecipe = 'PROD_IRC6'
*            Case ThickOnlyRecipe EQ 'Wacker'
*                NewProdRecipe = 'PROD_Wack'
*            Case ThickOnlyRecipe EQ '8IN_INF'
*                NewProdRecipe = 'PROD_INF'
*            Case Otherwise$
*                 // Unexpected THICK_ONLY recipe name -> proceed to next PSN
*                 RecipeFound = False$
*        End Case
*        
*        If RecipeFound then
*            MetRecipes<0, vPos> = NewProdRecipe
*            PRSStageRec<PRS_STAGE_MET_RECIPE$> = MetRecipes
*            Database_Services('WriteDataRow', 'PRS_STAGE', PRSStageKey, PRSStageRec)
*        end
* 
*    end else
*        // No THICK_ONLY metrology test -> proceed to next PSN
*        NULL 
*    end
*    
*    
* Next PSN
* 
* Return 4
* ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
* 
* 
* // Script to rollback UNLOAD PSNs with the new PROD naming convention introduced in the HgCV Project
* 
* UnloadPSNList = Database_Services('ReadDataRow', 'SYSLISTS', 'PROD_PSNS_UNLOAD')
* // Chomp info line
* UnloadPSNList = Delete(UnloadPSNList, 1, 0, 0)
* 
* For each PSN in UnloadPSNlist using @FM
*    
*    PRSStageKey = PSN:'*UNLOAD'
*    PRSStageRec = Database_Services('ReadDataRow', 'PRS_STAGE', PRSStageKey)
*    MetTests    = PRSStageRec<PRS_STAGE_MET_TEST$>
*    Locate 'THICK_ONLY' in MetTests using @VM setting vPos then
*        MetRecipes      = PRSStageRec<PRS_STAGE_MET_RECIPE$>
*        ThickOnlyRecipe = MetRecipes<0, vPos>
*        ThickOnlyRecipe = Trim(ThickOnlyRecipe)
*        RecipeFound     = True$
*        NewProdRecipe   = ''
*        Begin Case
*            Case ThickOnlyRecipe EQ 'PROD_thin6'
*                NewProdRecipe = 'thin6inch'
*            Case ThickOnlyRecipe EQ 'PROD_8inch'
*                NewProdRecipe = '8inch'
*            Case ThickOnlyRecipe EQ 'PROD_thin8'
*                NewProdRecipe = 'thin8inch'
*            Case ThickOnlyRecipe EQ 'PROD_IRC6'
*                NewProdRecipe = 'IRC6in_6mm'
*            Case ThickOnlyRecipe EQ 'PROD_Wack'
*                NewProdRecipe = 'Wacker'
*            Case ThickOnlyRecipe EQ 'PROD_INF'
*                NewProdRecipe = '8IN_INF'
*            Case Otherwise$
*                 // Unexpected THICK_ONLY recipe name -> proceed to next PSN
*                 RecipeFound = False$
*        End Case
*        
*        If RecipeFound then
*            MetRecipes<0, vPos> = NewProdRecipe
*            PRSStageRec<PRS_STAGE_MET_RECIPE$> = MetRecipes
*            Database_Services('WriteDataRow', 'PRS_STAGE', PRSStageKey, PRSStageRec)
*        end
* 
*    end else
*        // No THICK_ONLY metrology test -> proceed to next PSN
*        NULL 
*    end
*    
*    
* Next PSN
* 
* Return 3
* ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
* 
* 
* RDSNo           = '239935'
* EpiPartNo       = Xlate('RDS', RDSNo, 'EPI_PART_NO', 'X')
* WaferSize       = Xlate('EPI_PART', EpiPartNo, 'SUB_WAFER_SIZE', 'X')
* WaferSizeInch   = Field(WaferSize, ' ', 3, 1)
* 
* Return 1
* 
* 
* // Script to search for out of spec RDS' that slipped through the cracks.
* 
* RDSList = Database_Services('ReadDataRow', 'SYSLISTS', 'RDS_SINCE_061418')
* // Chomp the info line
* RDSList = Delete(RDSList, 1, 0, 0)
* DirtyRDSList = ''
* 
* For each RDSNo in RDSList using @FM
*    
*    UnloadCIKey    = Xlate('RDS', RDSNo, 'LWI_CI_NO', 'X')
*    CleanInspRec   = Database_Services('ReadDataRow', 'CLEAN_INSP', UnloadCIKey)
*    CleanSigs      = CleanInspRec<CLEAN_INSP_CLEAN_SIG$>
*    ScanRecipes    = CleanInspRec<CLEAN_INSP_SCAN_RECIPE$>
*    ScanSODMaxVals = CleanInspRec<CLEAN_INSP_SCAN_SUM_OF_DEF_MAX$>
*    SpecRecipes    = CleanInspRec<CLEAN_INSP_SPEC_SURFSCAN_RECIPE$>
*    SpecSODMaxVals = CleanInspRec<CLEAN_INSP_SPEC_SURF_DEFECTS$>
*    OverrideSig    = CleanInspRec<CLEAN_INSP_SIGN_ROTR_SIGNATURE$>
*    ScanSigs       = CleanInspRec<CLEAN_INSP_SCAN_SIG$>
*    ROTRAction     = CleanInspRec<CLEAN_INSP_ROTR_ACTION$>
*    // We need to check the most recent scan data associated with each specification recipe.
*    NumScanRecipes = DCount(ScanRecipes, @VM)
*    For Each SpecRecipeName in SpecRecipes using @VM setting SpecRecipeIndex
*            // Look for the last scan entry related to the current spec recipe.
*            RecipeFound = False$
*            For ScanRecipeIndex = NumScanRecipes To 1 Step -1
*                ScanRecipeName  = ScanRecipes<0, ScanRecipeIndex>
*                RecipeFound     = (ScanRecipeName EQ SpecRecipeName)
*            Until RecipeFound
*            Next ScanRecipeIndex
*            // If a scan was found, then analyze the scan data for spec requirements. If not found, this
*            // automatically fails.
*            If RecipeFound EQ True$ then
*                ThisSpecSODMax = SpecSODMaxVals<0, SpecRecipeIndex>
*                ThisScanSODMax = ScanSODMaxVals<0, ScanRecipeIndex>
*                ThisScanSig    = ScanSigs<0, ScanRecipeIndex>
*                HasMUWfrs = False$
*                NumMUWfrs = 0
*                IsEPP = Rds_Services('IsEpiPro', RDSNo)
*                If IsEPP then
*                    WMOutKey = Xlate('RDS', RDSNo, 'WM_OUT_KEY', 'X')
*                    MUWfrIDs = Xlate('WM_OUT', WMOutKey, 'UMW_CASS_ID', 'X')
*                end else
*                    WOMatKey = Xlate('RDS', RDSNo, 'WO_MAT_KEY', 'X')
*                    MUWfrIDs = Xlate('WO_MAT', WOMatKey, 'SLOT_REP_WAFER_ID', 'X')
*                end
*                NumMUWfrs = DCount(MUWfrIDs, @VM)
*                If NumMUWfrs GT 0 then HasMUWfrs = True$
*                // Todo: Add check to see if cleaning was done. If so, exclude from the dirty list.
*                If (ThisScanSODMax GT ThisSpecSODMax) and (OverrideSig EQ '') and (ThisScanSig NE '') and (ROTRAction EQ 'P') and Not(HasMUWfrs) and (CleanSigs EQ '') then
*                    // Dirty RDS -> Add to DirtyList
*                    DirtyRDSList<-1> = RDSNo
*                end
*            end
*    Next SpecRecipeName
*    
* Next RDSNo
* 
* Database_Services('WriteDataRow', 'SYSLISTS', 'DIRTY_RDS_SINCE_061418', DirtyRDSList)
* 
* Return 1
* 
* ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
* 
* WOMatKey = '166129*71'
* WMOKey ='166129*1*71'
* WOMatRec = Database_Services('ReadDataRow', 'WO_MAT', WOMatKey)
* WMORec = Database_Services('ReadDataRow', 'WM_OUT', WMOKey)
* 
* CurrStatus = Obj_Wm_Out('CurrStatus', WMOKey:@RM:WMORec:@RM:WOMatRec)
* 
* Return 0
* 
* ShipNo = Xlate('WO_LOG', '166270', 'SHIP_NO', 'X')
* 
* WMOKey = '166129*1*2'
* WMOKeys = '166129*1*2':@VM:'166129*1*3'
* ShipNo = Xlate('WM_OUT', WMOKey, '', 'X')
* Return 1
* 
* RDSKey = 255871
* SODWaferArray = ''
* SODWaferArray = Qa_Services('GetSODPerWafer', RDSKey)
*    
* WaferNos = SODWaferArray<1>
* For each WaferNo in WaferNos using @VM
*    If WaferNo NE '' then
*        WaferPDF = ''
*        WaferPDF = Qa_Services('PostWaferImageRequest', @USER4, RDSKey, WaferNo)
*    end
* Next WaferNo
* 
* Return 1
* 
* CIKey = Xlate('RDS', 229935, 'LWI_CI_NO', 'X')
* Set_Status(0)
* Validate('*09', 'MD0')
* error = Status()
* return 0
* RDSNo = 252889
* UCL = QA_Services('PostUCLRequest', RDSNo)
* RDSNo = 251701
* UCL = QA_Services('PostUCLRequest', RDSNo)
* 
* RDSNo = 251545
* RDSNo = 252889
* RDSRec            = Database_Services('ReadDataRow', 'RDS', RDSNo)
* ReactorKey        = RDSRec<RDS_REACTOR$>
* LWICIKey          = Xlate('RDS', RDSNo, 'LWI_CI_NO', 'X')
* TencorRecipe      = Xlate('CLEAN_INSP', LWICIKey, CLEAN_INSP_SCAN_RECIPE$, 'X')
* UCL = QA_Services('PostUCLRequest', RDSNo)
* RDSNo = 254171
* RDSNo = 251701
* RDSRec            = Database_Services('ReadDataRow', 'RDS', RDSNo)
* ReactorKey        = RDSRec<RDS_REACTOR$>
* LWICIKey          = Xlate('RDS', RDSNo, 'LWI_CI_NO', 'X')
* TencorRecipe      = Xlate('CLEAN_INSP', LWICIKey, CLEAN_INSP_SCAN_RECIPE$, 'X')
* UCL = QA_Services('PostUCLRequest', RDSNo)
* CINo = Xlate('RDS', RDSNo, 'LWI_CI_NO', 'X')
* WaferSODArray = ''
* For Wafer = 1 to 25
*    Field = 'SOD_WAFER_':Wafer
*    WaferSODArray<-1> = Xlate('CLEAN_INSP', CINo, Field, 'X')
* Next Wafer
* Return 1
* RDSNo = 255389
* WaferNo = 25
* PDFData = QA_Services('PostWaferImageRequest', @USER4, RDSNo, WaferNo)
* QA_Services('PostToWaferImageQueue', RDSNo, WaferNo, PDFData)
* 
* RDSKey = '254013'
* WMOutKeys = Xlate('RDS', RDSKey, 'WM_OUT_KEY', 'X')
* NCRStatus = QA_Services('GetNCRStatus', RDSKey)
* IsEpiPro = RDS_Services('IsEpiPro', RDSKey)
* WaferNo = '9'
* WaferPDF = QA_Services('PostWaferImageRequest', @USER4, RDSKey, WaferNo)
* QA_Services('PostToWaferImageQueue', RDSKey, WaferNo, WaferPDF)
* 
* ReturnVal = Utility('RUNWIN', 'C:\Users\ecStieberD\Desktop\WaferTest6.pdf')
* 
* ReportsPath = 'D:\OIReports\'
* Filename = 'WaferMap_RDSNo_251550_WaferNo_25.pdf'
* oleObj = OleCreateInstance('VSPDF.VSPDF.1')
* Status = OleStatus()
* If OleStatus() then
*    Errmsg('OLE Error code: ' : Status)
*    return 1
* end
* PDF = OleCallMethod(oleObj,"Open",ReportsPath:Filename)
* Return 0
* 
* RDSNo = 254317
*RDSNo = 251550
* WaferNo  = 1
* Response = QA_Services('PostWaferImageRequest', @USER4, RDSNo, WaferNo)
* 
* If Response NE '' then
*    OSWrite Response to 'C:\Users\ecStieberD\Desktop\WaferTest6.pdf'
*    Return 0
* end else
*    Return 1
* end
* 
* 
* CIList = Database_Services('ReadDataRow', 'SYSLISTS', 'CLEAN_INSP_ROTR')
* CIList = Delete(CIList, 1, 0, 0)
* SODValue = ''
* Open 'CLEAN_INSP' to CIHandle then
*    For each CIKey in CIList using @FM
*        ReadV SODValue from CIHandle, CIKey, 86 then
*            If SODValue NE '' then
*                Convert @VM to @SVM in SODValue
*                WriteV SODValue on CIHandle, CIKey, 86 else
*                    ErrMsg('Failed to write record: ' CIKey)
*                    Return 0
*                end
*            end
*        end
*    Next CIKey
* end
* Return 1
* Response = Xlate('WO_LOG', 166093, 'SHIP_NO', 'X')
* CIRecord = Database_Services('ReadDataRow', 'CLEAN_INSP', 2189236)
* SODWaferArray = QA_Services('GetSODPerWafer', '251550')
* WaferNos = SODWaferArray<1>
* SODVals  = SODWaferArray<2>
* NumRecipes = 2
* For each WaferNo in WaferNos using @VM
*    CIRecord<CLEAN_INSP_SCAN_SOD_PER_WAFER$, NumRecipes, WaferNo> = SODVals<1,WaferNo>
* Next Wafer
* Database_Services('WriteDataRow', 'CLEAN_INSP', 2189236, CIRecord, True$, '', '')
* Return 1
*RDSNo    = 246860
* RDSNo    = 252239
* WaferNo  = 9
* Response = QA_Services('PostWaferImageRequest', @USER4, RDSNo, WaferNo)
* 
* If Response NE '' then
*    OSWrite Response to 'C:\Users\ecStieberD\Desktop\WaferTest4.pdf'
*    Return 0
* end else
*    Return 1
* end
* 
* ConnectionObj = SQL_Services('GetConnectionObject', 'messa03ec.ec.local', 2)
* 
* MRUDTM    = '18517.37957'
* PSN       = 4821
* PSN       = 4610
* PSN       = 2816
* ReactorNo = 41
* RecipeID  = 668
* LayerIDs  = ''
* 
* LayerIDs = Xlate('RECIPE', RecipeID, 'LS_ID', 'X')
* PRSLayerNos = Xlate('PROD_SPEC', PSN, 'LAYER_NO', 'X')
* For each LayerNo in PRSLayerNos using @VM setting vPos
*    PRSLayerKey = PSN:'*':LayerNo
*    LSID = Xlate('PRS_LAYER', PRSLayerKey, 'LS_ID', 'X')
*    LayerIDs<1,-1> = LSID
* Next LayerNo
* ToolParmKey = Tool_Parms_Services('GetCurrentToolParmKey', RecipeID, PSN, ReactorNo)
* 
* Date = Date() - 1
* 
* EQU TOOL_CLASS_DEST_TEST$ TO 13
* EQU RUN_STAGE_WFR_SPEC_TOOL_CLASS$ TO 1
* 
* WfrStageKey = '247307*XRD*166181.1.17'
* StageDestTests	= XLATE('RUN_STAGE_WFR',WfrStageKey,'DEST_TEST','X')
* 
* @RECORD = Xlate('RUN_STAGE_WFR', WfrStageKey, '', 'X')
* SpecToolClass = @RECORD< RUN_STAGE_WFR_SPEC_TOOL_CLASS$>
* 
* @ANS = XLATE('TOOL_CLASS',SpecToolClass,TOOL_CLASS_DEST_TEST$,'X')
* 
* 
* Query = 'SELECT REACTOR WITH REACT_NO GT 0 AND WITH REACT_NO LT 100 BY REACT_NO'
* RList(Query, TARGET_SAVELIST$, 'REACTOR_LIST', 'Current List of Reactors', False$)
* ReactorList = Database_Services('ReadDataRow', 'SYSLISTS', 'REACTOR_LIST')
* ReactorList = Delete(ReactorList, 1, 0, 0)
* FileName    = 'ReactorList.txt'
* 
* RepoPath = Environment_Services('GetApplicationRootPath') : '\Metrology\Run Data Repository\'
* InitDir RepoPath:'*.txt'
* FileList = DirList()
* For each Filename in FileList
*    FileInfo = Dir(RepoPath:Filename)
*    LastWriteDate = FileInfo<2>
* Next Filename
* 
* Recipe  = 952
* PSN     = 3223
* Reactor = 34
* DTM     = Date() :'.': Time()
* TPID    = Recipe:'*':PSN:'*':Reactor:'*':DTM
* 
* Database_Services('WriteDataRow', 'TOOL_PARMS', TPID, '')
* 
* DTM = '18511.48284'
* ExternalDTM = OConv(DTM, 'DT/^3H')
* InternalDTM = IConv(ExternalDTM, 'DT/^3H')
* 
* Response = ''
* RDSNo    = 246860
* WaferNo  = 9
* Response = Qa_Services('PostWaferImageRequest', @USER4, RDSNo, WaferNo)
* 
* If Response NE '' then
*    OSWrite Response to 'C:\Users\StieberD\Desktop\WaferTest3.pdf'
* end
* 
* 
* PSN = '4059'
* SpecType = Xlate('PROD_SPEC', PSN, 'SPEC_TYPE', 'X')
* 
* ReactorNo = '32'
* LastRDSNo = Xlate('REACT_STATE', ReactorNo, 'LAST_RDS_NO', 'X')
* PDFFile = 'C:\Users\ecStieberD\Desktop\Wafer.pdf'
* rv = Utility("RUNWIN", PDFFile, 1)
* 
* ActivePSNKeys = ''
* ActiveUnloadPSNKeys = ''
* RecipePSNKeys = ''
* Open 'DICT.PROD_SPEC' to @DICT then
*    SearchString = 'STATUS':@VM:'A':@FM   
*    FailFlase = ''
*    Btree.Extract(SearchString, 'PROD_SPEC', @DICT, ActivePSNKeys, '', FailFlag)
*    NumActivePSNs = DCount(ActivePSNKeys, @VM)    
*    For each PSNKey in ActivePSNKeys using @VM setting vPos
*        PRSStages = Xlate('PROD_SPEC', PSNKey, 'PRS_STAGE_KEY', 'X')
*        If ( Index(PRSStages, 'UNLOAD', 1) ) then
*            ActiveUnloadPSNKeys<-1> = PSNKey
*        end
*    Next PSNKey
* 
*    For each PSNKey in ActiveUnloadPSNKeys using @FM setting fPos
*        UnloadPRSKey = PSNKey : '*UNLOAD'
*        MetPatterns = Xlate('PRS_STAGE', UnloadPRSKey, 'MET_RECIPE_PATTERN', 'X')
*        Locate '8IN_INF' in MetPatterns using @VM setting vPos then
*            RecipePSNKeys<-1> = PSNKey
*        end
*    Next PSNKey
*    
* end
* 
* Return RecipePSNKeys
* 
* USL = Qa_Services('GetUSLData', 246027)
* 
* Today = Date()
* CurrMode = Xlate('REACTOR', 31, 'CURR_MODE', 'X')
* ProdStartDTM  = Xlate('REACTOR', 31, 'CURR_MODE_DTM', 'X')
* 
* WOStepKey = '164811*1'
* Reactor = 64
* ReactorMode = Xlate('REACTOR', Reactor, 'CURR_MODE', 'X')
* ROTRStatus  = QA_Services('GetROTRStatus', WOStepKey)
* Recipe = '6IN100_ROTR'
* Found = Index(Recipe, '100', 1)
* NCRKey = 144773
* RejWaferIDs = Xlate('NCR', NCRKey, 'REJ_CNT', 'X')
* RDSKey = 243933
* FailScanStatus = QA_Services('GetFailureScanStatus', RDSKey)
* 
* WOStepKey = '166102*1'
* TotRejWafers = Xlate('WO_STEP', WOStepKey, 'TOT_REJ_TOTAL', 'X')
* WOLogKey = '166102'
* SAPRejWafers = Xlate('WO_LOG', WOLogKey, 'SAP_CONFIRM_SCRAP_QTY', 'X')
* WOStepKey = '166089*1'
* TotRejWafers = Xlate('WO_STEP', WOStepKey, 'TOT_REJ_TOTAL', 'X')
* WOLogKey = '166089'
* SAPRejWafers = Xlate('WO_LOG', WOLogKey, 'SAP_CONFIRM_SCRAP_QTY', 'X')
* WOStepKey = '165910*1'
* TotRejWafers = Xlate('WO_STEP', WOStepKey, 'TOT_REJ_TOTAL', 'X')
* WOLogKey = '165910'
* SAPRejWafers = Xlate('WO_LOG', WOLogKey, 'SAP_CONFIRM_SCRAP_QTY', 'X')
* 
* ReactRunKey = '243168'
* ReactRunRec = Database_Services('ReadDataRow', 'REACT_RUN', ReactRunKey)
* ReactorStatus = Xlate('REACT_RUN', ReactRunKey, 'RUN_STATUS', 'X')
*SODAvg = QA_Services('CalculateSODAvg', '240390')
* 
* WOMatQAList = Database_Services('ReadDataRow', 'SYSLISTS', 'WO_MAT_QA_PHASE')
* NumRec  = DCount(WOMatQAList, @FM)
* PhaseMin = '88.5'
* Open 'WO_MAT_QA' to TableHandle then
*    For Row = 2 to NumRec
*        @ID = WOMatQAList<Row>
*        WOMatQARow = Database_Services('ReadDataRow', 'WO_MAT_QA', @ID)
*        If Error_Services('NoError') then
*            Profiles = WOMatQARow<WO_MAT_QA_PROFILE$>
*            Locate '1CRES' in Profiles setting vPos then
*                WOMatQARow<WO_MAT_QA_PHASE_MIN$,vPos> = PhaseMin
*                Database_Services('WriteDataRow', 'WO_MAT_QA', @ID, WOMatQARow, True$)
*                If Error_Services('NoError') else
*                    Errmsg('Error writing WO_MAT_QA record ' : @ID)
*                end
*            end
*        end else
*            Errmsg('Error reading WO_MAT_QA record ' : @ID)
*        end
*    Next Row
* end
* Return 1
* vPos = 2
* RDSRec = Database_Services('ReadDataRow', 'RDS', '240390')
* SpecPhaseMin = @VM
* If SpecPhaseMin EQ '' then
*    PSNo = RDSRec<RDS_PROD_SPEC_ID$>
*    PRSKey = PSNo : '*UNLOAD'
*    PRSPhaseMin = Xlate('PRS_STAGE', PRSKey, PRS_STAGE_MET_PHASE_MIN$, 'X')
*    SpecPhaseMin = PRSPhaseMin<1,vPos>
* end
* WOMatQARec = Database_Services('ReadDataRow', 'WO_MAT_QA', '165991*17')
* Result = WOMatQARec<11>
* HgCVRes = '1.511'
* Result<1,2,1> = HgCVRes
* ThickRes = '8.411'
* Result<1,1,1> = ThickRes
* NumRows = Dcount(Result,@VM)
* Ans = ''
* PhaseVals = ''
* For Row = 1 to NumRows
*    Ans = Result<1,Row>
*    If Index(Ans, @SVM, 1) then
*        PhaseVals := Result<1,Row,2>[-1, 'B':@SVM]
*    end else
*        PhaseVals := @VM
*    end
* Next Row
* 
* ans = XLate('RDS', '240390', 'MET_PHASE_RESULT_UL', 'X')
* return 1
* PRSList = Database_Services('ReadDataRow', 'SYSLISTS', 'PRS_STAGE_LIST')
* NumRec  = DCount(PRSList, @FM)
* PhaseMIn = '88.5'
* Open 'PRS_STAGE' to TableHandle then
*    For Row = 2 to NumRec
*        @ID = PRSList<Row>
*        PRSRow = Database_Services('ReadDataRow', 'PRS_STAGE', @ID)
*        If Error_Services('NoError') then
*            MetTests = PRSRow<PRS_STAGE_MET_TEST$>
*            Locate 'CRES' in MetTests setting vPos then
*                PRSRow<PRS_STAGE_MET_PHASE_MIN$,vPos> = PhaseMin
*                Database_Services('WriteDataRow', 'PRS_STAGE', @ID, PRSRow, True$)
*                If Error_Services('NoError') else
*                    Errmsg('Error writing PRS_STAGE record ' : @ID)
*                end
*            end
*        end else
*            Errmsg('Error reading PRS_STAGE record ' : @ID)
*        end
*    Next Row
* end
* Return 1
* RDSKey = '172287'
* For Point = 1 to 14
*    Ans = Xlate('RDS', RDSKey, 'PROD_THICKNESS_POINT_' : Point, 'X')
* Next Point
* HgCVResAvg = Xlate('RDS', RDSKey, 'HGCV_RES_AVERAGE', 'X')
* HgCVStdDev = Xlate('RDS', RDSKey, 'HGCV_RES_STD_DEV', 'X')
* HgCV4mmEdgeMean = Xlate('RDS', RDSKey, 'HGCV_4MM_EDGE_MEAN' , 'X')
* HgCV10mmEdgeMean = Xlate('RDS', RDSKey, 'HGCV_10MM_EDGE_MEAN' , 'X')
* ProdThickOnly = Xlate('RDS', RDSKey, 'PROD_THICKNESS_ONLY', 'X')
* ProdThickStdDevOnly = Xlate('RDS', RDSKey, 'PROD_THICKNESS_STD_DEV_ONLY', 'X')
* ThickOnlyCenter = Xlate('RDS', RDSKey, 'THICK_ONLY_CENTER', 'X')
* ThickOnlyR2Mean = Xlate('RDS', RDSKey, 'THICK_ONLY_R2_MEAN', 'X')
* FiveMMEdgeMean = Xlate('RDS', RDSKey, 'PROD_THICKNESS_ONLY_5MM_EDGE_MEAN', 'X')
* ThreeMMEdgeMean = Xlate('RDS', RDSKey, 'PROD_THICKNESS_ONLY_3MM_EDGE_MEAN', 'X')
* ProdThick5mmEdgeFromR2 = Xlate('RDS', RDSKey, 'PROD_THICKNESS_5MM_EDGE_PCT_FROM_R2', 'X')
* ProdThick3mmEdgeFromR2 = Xlate('RDS', RDSKey, 'PROD_THICKNESS_3MM_EDGE_PCT_FROM_R2', 'X')
* HgCVEdgeMean = Xlate('RDS', RDSKey, 'HGCV_EDGE_MEAN_DELTA_PCT', 'X')
* 
* 
* StdDev = ''
* Sum = 0
* Devs = ''
* ThickOnlyAvg = Xlate('RDS', '229935', 'PROD_THICKNESS_ONLY', 'X')
* ThickOnlyAvg = '3.909'
* RDSRec = Database_Services('ReadDataRow', 'RDS', '229935')
* WONo = RDSRec<RDS_WO$>
* CassNo = RDSRec<RDS_CASS_NO$>
* WOMatQAKey = WONo : '*' : CassNo
* WOMatQARec = Database_Services('ReadDataRow', 'WO_MAT_QA', WOMatQAKey)
* QAData = WOMatQARec<WO_MAT_QA_DATA_POINTS$>
* Profiles   = WOMatQARec<WO_MAT_QA_PROFILE$>
* Locate '1THICK_ONLY' in Profiles setting vPos then
*    For SvPos = 1 to 10 
*         DataPoint = QAData<1,vPos,SvPos>
*         Deviation = DataPoint - ThickOnlyAvg
*         Devs<-1> =  Deviation ** 2
*    Next SvPos
*    DevsSum = Sum(Devs)
*    Variance = DevsSum/10
*    StdDev = Variance ** 0.5
* end
* 
* Ans = ''
* Sum = 0
* Points = '1,2,5,6,9'
* Devs = ''
* ResAvg = Xlate('RDS', '172287', 'HGCV_RES_AVERAGE', 'X')
* RDSRec = Database_Services('ReadDataRow', 'RDS', 172287)
* WONo = RDSRec<RDS_WO$>
* CassNo = RDSRec<RDS_CASS_NO$>
* WOMatQAKey = WONo : '*' : CassNo
* WOMatQARec = Database_Services('ReadDataRow', 'WO_MAT_QA', WOMatQAKey)
* QAData = WOMatQARec<WO_MAT_QA_DATA_POINTS$>
* Profiles   = WOMatQARec<WO_MAT_QA_PROFILE$>
* Locate '1CRES' in Profiles setting vPos then
*    For SvPos = 1 to 9
*         Locate SvPos in Points using ',' setting dummy then
*              DataPoint = QAData<1,vPos,SvPos>[1,@TM]
*              Deviation = DataPoint - ResAvg
*              Devs<-1> =  Deviation ** 2
*         end
*    Next SvPos
*    DevsSum = Sum(Devs)
*    Variance = DevsSum/5
*    StdDev = Variance**0.5
* end
* @ANS = StdDev
* 
* 
* 
* PSNo = '4922'
* If RowExists('PROD_SPEC_REV_HIST', PSNo) then
*    PSRevHistRec = Database_Services('ReadDataRow', 'PROD_SPEC_REV_HIST', PSNo)
* end else
*    PSRevHistRec = ''
*    Database_Services('WriteDataRow', 'PROD_SPEC_REV_HIST', PSNo, PSRevHistRec, True$)
*    If Error_Services('NoError') then
*        // Rev Hist record created successfully
*    end else
*        Errmsg('Error creating PROD_SPEC_REV_HIST record: ' : PSNo : @SVM : 'Please notify OpenInsight administrator')
*    end
* end
* 
* AddedDTMS = Date() : '.' : Time() : @SVM : Date() : '.' : Time()
* AddedDTMS<1, 1, 1> = ''
* AddedDTMS[1, 1] = ''
* AddedDTMS := @SVM : Date() : '.' : Time()
* AddedDTMS = Delete(AddedDTMS, 1, 1, 1)
* 
* currentUTF8 = Get_Property('SYSTEM', 'UTF8')
* Result = \C5\
* Result = \BE\
* Result = \00C5\
* Result = \E284A6\
*Result = Dialog_Box('NDW_VERIFY_USER', @WINDOW)
* RDSNo = '229935'
* Ans = Xlate('RDS', RDSNo, 'PROD_THICKNESS_POINT_1', 'X')
* RDSNo = '172287'
* Ans = Xlate('RDS', RDSNo, 'HGCV_SITE_1_RHOAVG', 'X')
* Ans = Xlate('RDS', RDSNo, 'PHASE_ANGLE', 'X')
* Ans = Xlate('RDS', RDSNo, 'HGCV_EDGE_MEAN_DELTA_PCT', 'X')
* Ans = Xlate('PROD_SPEC', '4059', 'LS_CRES_PHASE_MIN', 'X')
* RDSRec = Database_Services('ReadDataRow', 'RDS', RDSNo)
* 
* WONo = RDSRec<RDS_WO$>
* CassNo = RDSRec<RDS_CASS_NO$>
* WOMatQAKey = WONo : '*' : CassNo
* WOMatQARec = Database_Services('ReadDataRow', 'WO_MAT_QA', WOMatQAKey)
* Profiles   = WOMatQARec<WO_MAT_QA_PROFILE$>
* ThickData = WOMatQARec<WO_MAT_QA_DATA_POINTS$>
* Locate '1THICK_ONLY' in Profiles setting vPos then  
*    Ans = ThickData<1,vPos,1>
* end
* 
* Result = Xlate('RDS', RDSNo, 'MU_WAFERS_ADDED_DTMS', 'X')
* Result = Xlate('RDS', RDSNo, 'MU_WAFERS_REMOVED_DTMS', 'X')
* WONo = '164811'
* CassNo = '1'
* Result = obj_WO_Mat('GetMURemovedDTMS',WONo:'*':CassNo)
* LastRemDTM = Xlate('WO_MAT', '164811*1', 'MU_WAFER_LAST_ADD_DTM', 'X')      ; //Need to edit calculated columns in WO_MAT table 
* LastAddDTM = Xlate('WO_MAT', '164811*1', 'MU_WAFER_LAST_REMOVE_DTM', 'X')
* 
* 
* @RECORD = Database_Services('ReadDataRow', 'WO_MAT', '164811*1')
* AddDTMS = @RECORD<WO_MAT_MU_WAFER_ADDED_DTM$>
* LastAddDTMS = ''
* NumDTMS = DCount(AddDTMS, @VM)
* For vPos = 1 to NumDTMS
*     ThisDTM = AddDTMS<1, vPos>
*     LastAddDTMS := ThisDTM[1, @SVM] : @VM ; // This line *
* next vPos
* LastAddDTMS[-1, 1] = ''
* @ANS = LastAddDTMS
* 
* 
* TrimChars       = '. 1 2 3 4 5 6 7 8 9 0'
* NextPSNo        = Database_Services('ReadDataRow', 'DICT.PROD_SPEC', '%SK%')
* LastPSNo        = NextPSNo - 1
* For PSNo = 1 to LastPSNo
*    If RowExists('PROD_SPEC', PSNo, 0) then 
*        PSRec           = Database_Services('ReadDataRow', 'PROD_SPEC', PSNo)
*        If Error_Services("NoError") then
*            PSRevHistRec    = ''
*            Descriptions    = PSRec<PROD_SPEC_DESCRIPTION$>
*            Usernames       = PSRec<PROD_SPEC_MOD_ID$>
*            Dates           = PSRec<PROD_SPEC_MOD_DATE$>
*            If ( Descriptions NE '' ) And ( Usernames NE '' ) And ( Dates NE '' ) then
*                For each Line in Descriptions using @TM setting tPos
*                    MatchFound  = ''
*                    LineLength  = Len(Line)
*                    Date        = Line[1, 'F ']
*                    DescStart   = Col2() + 1
*                    DescEnd     = LineLength - Col2()
*                    Initials    = Line[-1, 'B ']
*                    InitialsLen = Len(Initials)
*                    DescEnd     = DescEnd - InitialsLen
*                    Desc        = Line[DescStart, DescEnd]
*                    InternalDate = IConv(Date, 'DH')
*                    For each Character in TrimChars using ' '
*                        Swap Character with '' in Initials
*                    Next Character
*                    Swap ' ' with '' in Initials
*                    MatchFound = False$
*                    Locate InternalDate in Dates using @VM setting vPos then                   
*                        Loop
*                            ModDate         = Dates<1, vPos>
*                            If ModDate NE InternalDate then
*                                // No username match found. Manually search for username.
*                                Username = ''
*                                For each Username in Usernames using @VM setting uPos
*                                    UserInitials = Username[1,1]
*                                    UserLastInitialPos = Index(Username, ' ', 1) + 1
*                                    UserInitials := Username[UserLastInitialPos, 1]
*                                    If Initials EQ UserInitials then
*                                        MatchFound   = True$
*                                        PSRevHistRec = Insert(PSRevHistRec, 1, -1, 0, Username)
*                                        PSRevHistRec = Insert(PSRevHistRec, 2, -1, 0, InternalDate)
*                                        PSRevHistRec = Insert(PSRevHistRec, 3, -1, 0, '')
*                                        PSRevHistRec = Insert(PSRevHistRec, 4, -1, 0, Desc)
*                                    end
*                                Until MatchFound EQ True$
*                                Next Username
*                            end
*                        While ModDate EQ InternalDate
*                            ModName         = Usernames<1, vPos>
*                            ModInitials     = ModName[1, 1]
*                            LastInitialPos  = Index(ModName, ' ', 1) + 1
*                            ModInitials     := ModName[LastInitialPos, 1]                            
*                            If ( ModInitials EQ Initials ) then
*                                MatchFound   = True$
*                                PSRevHistRec = Insert(PSRevHistRec, 1, -1, 0, ModName)
*                                PSRevHistRec = Insert(PSRevHistRec, 2, -1, 0, ModDate)
*                                PSRevHistRec = Insert(PSRevHistRec, 3, -1, 0, '')
*                                PSRevHistRec = Insert(PSRevHistRec, 4, -1, 0, Desc)        
*                            end
*                        Until MatchFound EQ True$
*                            vPos = vPos + 1
*                        Repeat
*                    end else
*                        // Date match not found. Use date supplied by user in description.
*                        If InternalDate NE '' then
*                            Username = ''
*                            For each Username in Usernames using @VM setting uPos
*                                UserInitials = Username[1,1]
*                                UserLastInitialPos = Index(Username, ' ', 1) + 1
*                                UserInitials := Username[UserLastInitialPos, 1]
*                                If Initials EQ UserInitials then
*                                    MatchFound   = True$
*                                    PSRevHistRec = Insert(PSRevHistRec, 1, -1, 0, Username)
*                                    PSRevHistRec = Insert(PSRevHistRec, 2, -1, 0, InternalDate)
*                                    PSRevHistRec = Insert(PSRevHistRec, 3, -1, 0, '')
*                                    PSRevHistRec = Insert(PSRevHistRec, 4, -1, 0, Desc)
*                                end
*                            Until MatchFound EQ True$
*                            Next Username
*                        end
*                    end
*                Next Line        
*            end
*            Database_Services('WriteDataRow', 'PROD_SPEC_REV_HIST', PSNo, PSRevHistRec)
*            If Error_Services('NoError') then
*                Null
*            end else
*                ErrMsg('Failed to write PROD_SPEC_REV_HIST record: ' : PSNo)
*            end
*        end else
*            ErrMsg('Failed to read PROD_SPEC record: ' : PSNo)
*        end
*    end
* Next PSNo
* 
* Return 1
* 
*Initials     = SRP_Trim(Initials, 'FMBA', '.1234567890')
* String   = '12/13/14 Test DS'
* Date     = String[1, 'F ']
* Desc     = String[Col2() + 1, ' ']
* Initials = String[Col2() + 1 , 2]
* 
* PSStageKey = '4059*UNLOAD'
* PSStageRec = XLATE('PRS_STAGE',PSStageKey,'','X')
* PhaseMin = PSStageRec<PRS_STAGE_MET_PHASE_MIN$>
* PSStageKey = '4059*QA'
* PSStageRec = XLATE('PRS_STAGE',PSStageKey,'','X')
* PhaseMin = PSStageRec<PRS_STAGE_MET_PHASE_MIN$>
* 
* PRSLayerKey = '4059*1'
* PhaseVals   = XLATE('PRS_LAYER', PRSLayerKey, 'PROP_PHASE_MIN', 'X')
* PRSPropKeys = '4059*1*CRES' : @VM : '4059*1*RES' : @VM : '4059*1*THICK'
* PhaseVal    = XLATE('PRS_PROP', PRSPropKeys, '19', 'X')
* 
*PhaseMin = obj_Prod_Spec('GetQAMet',@ID:@RM:@RECORD)<COL$QA_MET_PHASE_MIN>
* 
* 
* MetrologyLog    = Database_Services('ReadDataRow', 'SYSLISTS', 'METROLOGY_LOG')
* swap @fm with CRLF$ in MetrologyLog
* swap @vm with Tab$ in MetrologyLog
* Path = 'C:\Users\StieberD\Desktop\Notes\MetrologyLog.txt'
* OSWrite MetrologyLog to Path
* HgCVPct        = 12.81142804732642
* HgCVEdgeMean        = 64
* HgCVEdgeMean        = OConv(HgCVEdgeMean, 'MD3L')
*HgCVEdgeMean        = HgCVEdgeMean[1,4]
* HgCVPct        = Oconv(Iconv(HgCVPct, 'MD2L'), 'MD2L')
* RangePoints = '1,2,5,6,9'
* NumRangePoints = DCount(RangePoints, ',')
* Return HgCVEdgeMean
* CustNo = '6593'
* EpiPartNo = '529792'
* 
* CustNo = '6874'
* EpiPartNo = 'WEP911359IRE'
* CustEpiPartRec	= XLATE('CUST_EPI_PART',CustNo:'*':EpiPartNo,'','X')
* 
* CustEpiPartRec = Database_Services('ReadDataRow', 'CUST_EPI_PART', CustNo:'*':EpiPartNo, True$, 600, False$)
* CustEpiPartRec<CUST_EPI_PART_CASS_SHIP_QTY$> = '25'
* Database_Services('WriteDataRow', 'CUST_EPI_PART', CustNo:'*':EpiPartNo, CustEpiPartRec, False$, False$, False$)
* CassShipQty = CustEpiPartRec<CUST_EPI_PART_CASS_SHIP_QTY$>
* 
* Message     = 'Unable to sign FQA because the Scheduled Wafers' : CRLF$ : 'Quantity does not equal the '
* Message     := 'Wafers Out Quantity.' : CRLF$ : 'Lead must override.'
* LeadMessage = 'Scheduled Wafers Quantity does not equal the Wafers Out Quantity.'
* If NOT( MemberOf(@USER4, 'LEAD') OR MemberOf(@USER4, 'SUPERVISOR') ) then
*    Response = Msg(@Window, '', 'POST_EPI_WAFER_OUT', '', Message)
* end else
*    Response = Msg(@Window, '', 'POST_EPI_WAFER_OUT', '', LeadMessage)
* end
* 
* @RECORD = Database_Services('ReadDataRow', 'RDS', '229935')
* @ans = xlate( 'LSL_USERS', @record<RDS_WAFER_OUT_SIG$>, 'FIRST_LAST', 'X' )
* 
*Response    = Dialog_Box('NDW_VERIFY_USER', @WINDOW, @USER4 : @FM : 'LEAD' : @VM : 'SUPERVISOR')
* 
* WOMatQARec = Database_Services('ReadDataRow', 'WO_MAT_QA', '165874*1')
* DataPoints = WOMatQARec<WO_MAT_QA_DATA_POINTS$>
* Convert @SVM to @FM in DataPoints
* Min        = DataPoints<1>
* Max        = DataPoints<1>
* For each DataPoint in DataPoints using @FM
*    Min = Min(Min, DataPoint)
*    Max = Max(Max, DataPoint)
* Next DataPoint
* 
* Result = Min :@VM : Max
* Return Result
* 
* CurrStatus = Xlate('RDS', '2297498', 'CURR_STATUS','X')
* 
* String = '1,2,3'
* Count  = DCount(String, ',')
* Stack  = RetStack()
* Convert @FM to ',' in Stack
* SystemWindow = Get_Property('SYSTEM', 'SIZE')
* MaxHeight = SystemWindow<4> * '0.8'
* MaxHeight = Oconv(MaxHeight, 'MD0')
* 
* List = 3.929 : @TM : 90 : @SVM : 3.872 : @TM : 90 : @SVM
* For each DataPoint in List using @SVM setting SVPos
*    HgCVData = DataPoint[1, 'F' : @TM]
*    PhaseData = DataPoint[-1, 'B' : @TM]
* Next DataPoint
* 
*Work_Order = Work_Order_Services('GetWorkOrder', '165794')
* 
* Status = 0
* WaferData  = ''
* Filename   = 'E:\apps\ThruPut\LogFiles\Log.csv'
* Set_Status(0)
* WaferCount = 0
* OSRead WaferData from Filename then
*    SWAP CRLF$ WITH @FM IN WaferData
*    SWAP ',' WITH @VM IN WaferData
*    LOOP
*        LastChar = WaferData[-1,1]
*    UNTIL LastChar NE @FM
*        WaferData[-1,1] = ''
*    REPEAT
*    For each row in WaferData using @FM setting Index
*            if index > 1 then
*                WaferCount += row<1,5>
*            end
*    Next row
* end else
*    Status = Status()
* end
* 
* 
* 
* Tablename = 'PROD_SPEC'
* Dict  = 'DICT.':Tablename
* 
* OPEN Dict TO DictVar THEN
*    SearchString  = 'ENTRY_DATE':@VM:'18414~18429':@FM                
*    Btree.Extract(SearchString, Tablename, DictVar, Keys, '', Flag)
* end
* 
* OPEN TableName to Table then
*    For each Key in Keys using @VM
*        READ Rec from Table, Key else
*            ErrMsg('Reading ' : TableName : ' Record ' : Key : 'failed!')
*            Return 0
*        end
*        WRITE Rec on Table, Key else
*            ErrMsg('Writing ' : TableName : ' Record ' : Key : 'failed!')
*            Return 0
*        end 
*    Next Key
* end
* 
* 
* Status  = ''
* 
* OPEN 'DICT.WO_MAT' TO DictVar THEN
*    SearchString  = 'REL_DTM':@VM:'18414~18429':@FM                
*    Btree.Extract(SearchString, 'WO_MAT', DictVar, WOMatKeys, '', Flag)
* end
* 
* OPEN 'WO_MAT' to WOMatTable then
*    For each Key in WOMatKeys using @VM
*        READ WOMatRec from WOMatTable, Key else
*            ErrMsg('Reading WO_Mat Record ' : Key : 'failed!')
*            Return 0
*        end
*        WRITE WOMatRec on WOMatTable, Key else
*            ErrMsg('Writing WO_Mat Record ' : Key : 'failed!')
*            Return 0
*        end 
*    Next Key
* end
* 
* 
* // Notes: Rewrote RDS Date_Out>18353
* 
* RDSKeys = ''
* Status  = ''
* 
* OPEN 'DICT.RDS' TO DictVar THEN
*    SearchString  = 'DATE_OUT':@VM:'18353~18385':@FM                ; // (Mar 31, 2018 - May 02, 2018)
*    Btree.Extract(SearchString, 'RDS', DictVar, RDSKeys, '', Flag)
* end
* 
* OPEN 'RDS' to RDSTable then
*    For each Key in RDSKeys using @VM
*        READ RDSRec from RDSTable, Key else
*            ErrMsg('Reading RDS Record ' : Key : 'failed!')
*            Return 0
*        end
*        WRITE RDSRec on RDSTable, Key else
*            ErrMsg('Writing RDS Record ' : Key : 'failed!')
*            Return 0
*        end 
*    Next Key
* end
* 
* 
* ReactRunKeys = ''
* Status  = ''
* Flag    = ''
* Key     = ''
* // (May 31, 2018 - June 08, 2018) June
* // (April 30, 2018 - June 01, 2018) May
* // (March 31, 2018 - May 01, 2018) April
* // (Feb 28, 2018 - Apr 01, 2018) March
* // (Jan 31, 2018 - Mar 01, 2018) Feb
* // (Dec 31, 2017 - Feb 01, 2018) Jan
* // 
* OPEN 'DICT.REACT_RUN' TO DictVar THEN
*    SearchString  = 'UNLOAD_DT':@VM:'18408~18415':@FM
*    Btree.Extract(SearchString, 'REACT_RUN', DictVar, ReactRunKeys, '', Flag)
* end
* 
* OPEN 'REACT_RUN' to ReactRunTable then
*    For each Key in ReactRunKeys using @VM
*        READ ReactRunRec from ReactRunTable, Key else
*            ErrMsg('Reading ReactRun Record ' : Key : 'failed!')
*            Return 0
*        end
*        WRITE ReactRunRec on ReactRunTable, Key else
*            ErrMsg('Writing ReactRun Record ' : Key : 'failed!')
*            Return 0
*        end 
*    Next Key
* end
* 
* 
* 
*Result                  = ''
*Result = Rds_Services('GetRDSList', '165731', False$) 
* 
* Response     = Dialog_Box('NDW_RDS_SUPPLEMENT', @WINDOW, '165731')
* 
* /*
* Response     = Dialog_Box('NDW_ADD_SUPPLEMENT', @WINDOW)
* Save         = Response<1>
* Instructions = Response<2>
* 
* 
* If Save EQ True$ then
*    
*    NumRows = DCount(Result, @FM)
*    For Index = 1 to NumRows
*        Result<Index,13> = Instructions
*    Next Index
*    
*    // Insert Instructions into selected rows' Supplement cell
*    
*    For each Field in Result Using @FM Setting Index
*        Result<Index,13> = Instructions
*    Next Field
*    
* end
* 
*/
*Ans     = RTI_LH_Info(CMD_SESSION_INFO$)
*Ans     = RTI_LH_Info(CMD_LOCKS_INFO$, '')
*Ans     = RTI_LH_Info(CMD_TABLE_INFO$, 'APP_INFO')
*Ans     = RTI_LH_Info(CMD_UNLOCK$, 'E:\APPS\OICURRENT\LSL\', 'REV29304', '165745', 'REV29304')
* 
* /*
* 
* If MemberOf(@USER4, 'BYPASS') then
*    Response = Msg(@Window, '', 'POST_EPI_WAFER_OUT_LEAD')
* end else
*    Response = Msg(@Window, '', 'POST_EPI_WAFER_OUT')
* end
* 
* Begin Case
*    Case Response EQ 1
*        Response = True$
*    Case Response EQ 2
*        Response = False$
*    Case Response EQ char(27)
*        Response = False$
* End Case
* 
* If Response EQ True$ then
*    Result = Dialog_Box('NDW_VERIFY_USER', @Window, '' : @FM : 'BYPASS')
* end else
*    Result = 0
* end
* 
* Return 1
*/

