Compile subroutine Jonathan_Test(VOID)

#pragma precomp SRP_PreCompiler

Declare Function Database_Services, Location_Services, Nextkey, Obj_Rds	,obj_WO_Mat
Declare subroutine Copy_Record_To_SQL, Delete_Record_From_SQL, Msg, Btree.Extract, POPUP, Database_Services, SRP_Run_Command, Msg, Psn_Services, Errmsg, Scrape_Services
Declare function GetTickCount, Dialog_Box, Obj_Override_Log, Btree.Extract, POPUP, GetCommandLine, Error_Services, Database_Services, Get_Repos_Entities, SRP_DATETIME, DateTime

$Insert OVERRIDE_LOG_EQUATES
$Insert POPUP_EQUATES
$INSERT LOGICAL
$Insert MSG_EQUATES
$Insert REACT_STATUS_EQUATES
$insert APP_INSERTS
$Insert REACTOR_EQUATES
Debug

KeyList = Xlate('SYSLISTS', 'TEST_JONATHAN_REACT_EVENT', '', 'X')
    Counter          = 0
    Def              = ""
    Def<MCAPTION$>   = "Pushing REACT_EVENT data..."
    Def<MTYPE$   >   = "GC"
    Def<MEXTENT$ >   = DCount(KeyList, @FM)
    Def<MTEXTWIDTH$> = 800
    MsgUp            = Msg(@window, Def)
    
    For each Key in KeyList using @FM
    	Counter      += 1
        Msg(@window, MsgUp, Counter, MSGINSTUPDATE$)
        Copy_Record_To_Sql('REACT_EVENT', Key, 1)
    Next Key
Msg(@window, MsgUp) 

Debug
Scrape_Services('CopyRecordsToScrapeDB')


Debug

Copy_Record_To_SQL('REACT_MODE_NG', '32*20123.2284722222', 1)
Debug
RDSNo = 571843
RDSRec      = Database_Services('ReadDataRow', 'RDS', RDSNo)
PSNo = RDSRec<114>
SpecialInst = XLATE('PROD_SPEC', PSNo, 10, 'X')

RDSRec<31>  = SpecialInst
Database_Services('WriteDataRow', 'RDS', RDSNo, RDSRec)




Debug
sqlErrorLog = Database_Services('ReadDataRow', 'SQL_ERROR', '2023-01-26')
Def = ""
Def<MCAPTION$> = "Exporting Records..."
Def<MTYPE$ > = "GC"
Def<MEXTENT$> = DCount(sqlErrorLog, @FM)
Def<MTEXTWIDTH$> = 400

MsgUp = Msg(@WINDOW, Def)					;* Put up the gas gauge
for each error in sqlErrorLog using @FM setting ePos
	table = error<1,1>
	recordID = error<1,2>
	Copy_Record_To_SQL(table, recordID, 1)
	Void = Msg(@WINDOW, MsgUp, ePos, MSGINSTUPDATE$)
	
Next error
Msg(@WINDOW, MsgUp) 		;* take down the gauge
Debug
Copy_Record_To_SQL('RDS', 501323, 1)
Debug
test = Nextkey('REACTOR_LOG')
debug
currKey = Nextkey('REACTOR_LOG')
for i = currKey to 100000
	Database_Services('DeleteDataRow', 'REACTOR_LOG', i)
Next i

* for i = 41436 to 60000
* 	Database_Services('DeleteDataRow', 'REACTOR_LOG', i)
* Next i

Debug
misLoadedReacts = ''
for i = 0 to 99
	loadedReactCass = Xlate('REACT_STATUS', i, 6, 'X')
	locate '1' in loadedReactCass using @VM setting iPos then
		misLoadedReacts<-1> = i
	end
Next i


Debug
WOMatRecord = XLATE('WO_MAT', '171663*72', '', 'X')
curWfrCt = obj_WO_Mat('CurrWaferCnt','171663*72':@RM:WOMatRecord)


Debug
RDSRecord = XLATE('RDS', 563192, '', 'X')
curWfrCt = obj_rds('WafersOut',563192:@RM:RDSRecord)

debug
reactorRec = Database_Services('ReadDataRow', 'REACTOR', 28)
reactLLDis = reactorRec<REACTOR_ACTIVE_LL_DISABLED$>


Debug
woNo = 171524
for i = 9 to 39
	woMatKey = woNo : '*' : i
	WoMatRec = Database_Services('ReadDataRow', 'WO_MAT', woMatKey)
	WoMatRec<47> = 1
	Database_Services('WriteDataRow', 'WO_MAT', woMatKey, WoMatRec)
Next i

Debug

Date = SRP_DateTime("Date", DateTime())
Time = SRP_DateTime("Time", Datetime())
19721

iDate = OConv(Date, 'D4/H')
iTime = OConv(Time, 'MTS')

Debug

for i = 41436 to 60000
	Database_Services('DeleteDataRow', 'REACTOR_LOG', i)
Next i


Debug
RDSNo = '544261'
WOMatKey = '171461*4'

PSN_Services('UpdateRDSMetrologyLimits', RDSNo)
PSN_Services('UpdateAllQAMetrologyLimits', WOMatKey)


    debug
    RDSNo = NextKey('RDS')
    
    // Delete old instance of this RDS if it exists ------------------------------------------------------------------------
    If RowExists('RDS', RDSNo) then
        Database_Services('DeleteDataRow', 'RDS', RDSNo, True$, False$)
        If Error_Services('NoError') then
            Results = 'RDS ' : RDSNo : ' deleted'
        end else
            Results = 'RDS ' : RDSNo : ' not deleted. Error : ' : Error_Services('GetMessage')
        end
    end
    // ---------------------------------------------------------------------------------------------------------------------


    // Delete related RDS_LAYER records ------------------------------------------------------------------------------------
    Layers = 'L1,L2,2'
    For each Layer in Layers using ','
        RDSLayerKey = RDSNo:'*':Layer
        If RowExists('RDS_LAYER', RDSLayerKey) then
            // Look for related RDS_TEST records and delete them first
            RDSTestKeys = Xlate('RDS_LAYER', RDSLayerKey, 'RDS_TEST_KEYS', 'X')
            If RDSTestKeys NE '' then
                For each RDSTestKey in RDSTestKeys using @VM setting vPos
                    // Look for related TW_USE records and delete them first
                    TWKeys = Xlate('RDS_TEST', RDSTestKey, 'TW_USE_ID', 'X')
                    If TWKeys NE '' then
                        For each TWKey in TWKeys using @VM setting vPos
                            Database_Services('DeleteDataRow', 'TW_USE', TWKey, True$, True$)
                        Next TWKey
                    end
                    Database_Services('DeleteDataRow', 'RDS_TEST', RDSTestKey, True$, True$)
                Next RDSTestKey
            end
            Database_Services('DeleteDataRow', 'RDS_LAYER', RDSLayerKey, True$, False$)
            If Error_Services('NoError') then
                Results = 'RDS_LAYER ' : RDSLayerKey : ' deleted'
            end else
                Results = 'RDS_LAYER ' : RDSLayerKey : ' not deleted. Error : ' : Error_Services('GetMessage')
            end
        end
    Next Layer
    // ---------------------------------------------------------------------------------------------------------------------


    // Delete old REACT_RUN record if it exists ----------------------------------------------------------------------------
    If RowExists('REACT_RUN', RDSNo) then
        // Delete old CLEAN_INSP record(s) if they exist
        CIKeys = Xlate('REACT_RUN', RDSNo, 'CI_NO', 'X')
        For each CIKey in CIKeys using @VM setting vPos
            If RowExists('CLEAN_INSP', CIKey) then
                Database_Services('DeleteDataRow', 'CLEAN_INSP', CIKey, True$, False$)
                If Error_Services('NoError') then
                    Results = 'CLEAN_INSP ' : CIKey : ' deleted'
                end else
                    Results = 'CLEAN_INSP ' : CIKey : ' not deleted. Error : ' : Error_Services('GetMessage')
                end          
            end
        Next CIKey
        Database_Services('DeleteDataRow', 'REACT_RUN', RDSNo, True$, False$)
        If Error_Services('NoError') then
            Results = 'REACT_RUN ' : RDSNo : ' deleted'
        end else
            Results = 'REACT_RUN ' : RDSNo : ' not deleted. Error : ' : Error_Services('GetMessage')
        end
    end
    // ---------------------------------------------------------------------------------------------------------------------

    
    
return


debug
    
    WONo = 171295
    
    For CassNo = 8 to 38
       WOMatQAKey = WONo:'*':CassNo
        //PSN_Services('UpdateQAMetrologyLimits', WOMatQAKey, 'QA', '1ADE', 'L')
        PSN_Services('UpdateAllQAMetrologyLimits', WOMatQAKey)
        If Error_Services('HasError') then ErrMsg(Error_Services('GetMessage'))
    Next CassNo

 return

    
*    ReportList = ''
*    List       = Get_Repos_Entities('LSL2', 'OIWIN', '', False$)
*    For each Row in List using @FM setting fPos
*        ReportList<fPos> = Field(Row, '*', 4)
*    Next Row
*    
*    LastLaunch = 0
*    FormCounts = ''
*    EOF        = False$
*    Open 'FORM_METRICS' to hTable then
*        Select hTable
*        Loop
*            Readnext Key else EOF = True$
*        Until EOF
*            FormName = Field(Key, '*', 1)
*            Locate FormName in ReportList using @FM setting fPos then
*                FormCounts<fPos>    = FormCounts<fPos> + 1
*            end
*        Repeat
*    end
* 
*    NumForms   = DCount(ReportList, @FM)
*    For FormIndex = 1 to NumForms
*        FormCount                = FormCounts<FormIndex>
*        If FormCount EQ '' then FormCount = 0
*        ReportList<FormIndex, 2> = FormCount
*    Next FormIndex
*    
*    ReportList = Insert(ReportList, 1, 0, 0, 'Form Name':@VM:'Launch Count')
*    Swap @VM with ',' in ReportList
*    Swap @FM with CRLF$ in ReportList
*    OSWrite ReportList on 'D:\FITemp\FormCounts.csv'
*    
* 
* 
* 
* Debug
* 	WONo = '171151'
* 	
* 	CRLocs        = ''
* 	CRLocs<0, -1> = 'CR*PLACE'
*    CRLocs<0, -1> = 'CR*BE'
*    CRLocs<0, -1> = 'CR*BO'
*    CRLocs<0, -1> = 'CR*TUN'
*    CRLocs<0, -1> = 'CR*EPR'
*    CRLocs<0, -1> = 'CR*FE'
*    CRLocs<0, -1> = 'CR*FEH'
*    CRLocs<0, -1> = 'CR*FO'
*    CRLocs<0, -1> = 'CR*FOH'
* LoadedData     = Location_Services('GetLocationCassInfoRlist', WONo, CRLocs)
* 
* 
* Debug
* problemreactors = ''
* for i = 1 to 80
* 	childkeys = XLATE('REACTOR_CHILD_KEY_IDS_NG', i, 1,'X')
* 	if DCOUNT(childkeys, @VM) GT 1 then
*		problemreactors<i, 1> = i
*		problemreactors<i, 2> = DCOUNT(childkeys, @VM)
* 	end
* Next i
* debug
* 
* maintenanceMembers = XLATE('SEC_GROUPS', 'MAINTENANCE', 4, 'X')
* memberList = ''
* for each member in maintenanceMembers using @VM
*    lslUserRecord = XLATE('LSL_USERS', member, '','X')
*    memberName = lslUserRecord<1> : ' ' : lslUserRecord<2>
*    memberActive = lslUserRecord<10>
*    memberList<-1> = member : @VM : memberName : @VM : memberActive : @VM
* Next member
* 
* Database_Services('WriteDataRow', 'SYSLISTS', 'JONATHAN_MEMBER_LIST', memberList)
* 
* activeUsers = ''
* 
* for each user in memberList using @FM
*    if user<1,3> EQ 1 then
*        activeUsers<-1> = user
*    end
*    
* Next user
* //EQU CRLF$ TO \0D0A\
* 
* swap @FM with CRLF$ in activeUsers
* swap @VM with ',' in activeUsers
* 
* filename = 'C:\users\ecouellette\activeusers.csv'
* OSWrite activeUsers To filename
* 
* 
* debug
* Debug
* TEST = @USER4
* 
* Debug
* OutOfProdDTM     = Xlate('REACT_STATUS','57',REACT_STATUS_OUT_OF_PROD_DTM$,'X')
* 	CurrModeKey      = XLATE('REACTOR','57','CURR_MODE_KEY','X')<1,1>					;* This should never be an MV but during implementation it is having some issues
* 	CurrModeStartDTM = FIELD(CurrModeKey,'*',2)
* 
* debug
* test = Xlate('RDS', '402211', 'PARAM_OUT_OF_SPEC', 'X')
* Locate True$ in test using @VM setting kpos then
* 	null
* end
* Debug
* SchedTool = Xlate('RDS', '463935', 'SCHED_REACTOR', 'X')
* 
* debug
* Table = 'WO_MAT'
* ID = '169858*87'
* Copy_Record_To_SQL(Table, ID, 1)   
*    debug
*    WOMatKeyList = Database_Services('ReadDataRow', 'SYSLISTS', 'JONATHAN_FT_PUSH')
*    NumWOMatKeys = DCount(WOMatKeyList, @FM)
*    
*    Def               = ""
*    Def<MCAPTION$>    = "Updating WO_MAT..."
*    Def<MTYPE$>       = "GC"
*    Def<MEXTENT$>     = NumWOMatKeys
*    Def<MTEXTWIDTH$>  = 600
*    MsgUp             = Msg(@WINDOW, Def) ;* Start gas guage message
*    Table             = 'WO_MAT'
*    WOMatKeyListIndex = 1
*    NewWOMatKeyList   = WOMatKeyList
*    Loop
*        ID                 = WOMatKeyList<WOMatKeyListIndex>
*        Copy_Record_To_SQL(Table, ID, 1)
*        NewWOMatKeyList    = Delete(NewWOMatKeyList, 1, 0, 0)
*        WOMatKeyListIndex += 1
*        Database_Services('WriteDataRow', 'SYSLISTS', 'JONATHAN_FT_PUSH', NewWOMatKeyList)
*        Running            = Msg(@WINDOW, MsgUp, WOMatKeyListIndex, MSGINSTUPDATE$) ;* Update message
*    Until WOMatKeyListIndex GE NumWOMatKeys
*    Repeat
*    debug
*    Msg(@WINDOW,MsgUp)      ;* Take message down
*        
* 
* 
* Debug
* Table = 'WO_MAT'
* ID = '169277*4'
* Copy_Record_To_SQL(Table, ID, 1)
* Debug
* 
* RecordList = Xlate('SYSLISTS', 'JONATHAN_HOLDS', '', 'X')
* Table = 'WO_MAT'
* for i = 13300 to DCount(RecordList, @FM)
* 	ID = RecordList<i>
* 	HoldDTM = Xlate('WO_MAT', ID, 35, 'X')
* 
* 	IF HoldDTM GE 19302 then
* 		Copy_Record_To_SQL(Table, ID, 1)
* 	end
* NEXT i
* 
* Debug
*		Table = 'WO_MAT'
*        ID = '167691*32'
* 
*    	Copy_Record_To_SQL(Table, ID, 1)
* 
* 		
* 	end
*		
*		Table = 'WO_MAT'
*        ID = RecordList<i>
*		CountToCopy += 1
*    	
* 	end
* 
* 
*        
* Next i
* debug
* 
* 
* //Command = ('explorer "https://google.com"')
* 
* //SRP_Run_Command(Command)
* 
* midnight = 00000;//
* one = 03600;//1am
* two = 07200;//2am
* three = 10800;//3am
* four = 14400;//4am
* five = 18000;//5am
* six = 21600;//6am
* seven = 25200;//7am
* eight = 28800;//8am
* nine = 32400;//9am
* ten = 36000;//10am
* eleven = 39600;//11am
* twelve = 43200;//12pm
* thirteen = 46800;//1pm
* fourteen = 50400;//2pm
* fifteen = 54000;//3pm
* sixteen = 57600;//4pm
* seventeen = 61200;//5pm
* eightteen = 64800;//6pm
* nineteen = 68400;//7pm
* twenty = 72000;//8pm
* twentyOne = 75600;//9pm
* twentyTwo = 79200;//10pm
* twentyThree = 82800;//11pm
* twentyFour = 86399;//11:59PM
* debug
* hourlyOuts = ''
* hourlyOuts<1> = 0
* hourlyOuts<2> = 0
* hourlyOuts<3> = 0
* hourlyOuts<4> = 0
* hourlyOuts<5> = 0
* hourlyOuts<6> = 0
* hourlyOuts<7> = 0
* hourlyOuts<8> = 0
* hourlyOuts<9> = 0
* hourlyOuts<10> = 0
* hourlyOuts<11> = 0
* hourlyOuts<12> = 0
* hourlyOuts<13> = 0
* hourlyOuts<14> = 0
* hourlyOuts<15> = 0
* hourlyOuts<16> = 0
* hourlyOuts<17> = 0
* hourlyOuts<18> = 0
* hourlyOuts<19> = 0
* hourlyOuts<20> = 0
* hourlyOuts<21> = 0
* hourlyOuts<22> = 0
* hourlyOuts<23> = 0
* hourlyOuts<24> = 0
* 
* RDSOuts = ''
* 
* 
* oneOuts = 0
* twoOuts = 0
* threeOuts = 0
* fourOuts = 0
* fiveOuts = 0
* sixOuts = 0
* sevenOuts = 0
* eightOuts = 0
* nineOuts = 0
* tenOuts = 0
* elevenOuts = 0
* twelveOuts = 0
* thirteenOuts = 0
* fourteenOuts = 0
* fifteenOuts = 0
* sixteenOuts = 0
* seventeenOuts = 0
* eightteenOuts = 0
* nineteenOuts = 0
* twentyOuts = 0
* twentyOneOuts = 0
* twentyTwoOuts = 0
* twentyThreeOuts = 0
* 
* Outs = 0
* OutsList = XLATE('SYSLISTS', 'TEST_JONATHAN', '', 'X')
* TotalOuts = 0
* for i = 2 to DCOUNT(OutsList, @FM)
* 	RDSRec = OutsList<i,1>
* 	WafersOut = XLATE('RDS',RDSRec, 'WAFERS_IN', 'X')
* 	TimeOut = XLATE('RDS',RDSRec,38,'X')
* 	
* 	if TimeOut GE midnight AND TimeOut LT one then
*		hourlyOuts<1,1> = hourlyOuts<1> + WafersOut
*		RDSOuts<1,-1> = RDSRec
* 	end
* 	if TimeOut GE one AND TimeOut LT two then
*		hourlyOuts<2> = hourlyOuts<2> + WafersOut
*		RDSOuts<2,-1> = RDSRec
* 	end
* 	if TimeOut GE two AND TimeOut LT three then
*		hourlyOuts<3> = hourlyOuts<3> + WafersOut
*		RDSOuts<3,-1> = RDSRec
* 	end
* 	if TimeOut GE three AND TimeOut LT four then
*		hourlyOuts<4> = hourlyOuts<4> + WafersOut
*		RDSOuts<4,-1> = RDSRec
* 	end
* 	if TimeOut GE four AND TimeOut LT five then
*		hourlyOuts<5> = hourlyOuts<5> + WafersOut
*		RDSOuts<5,-1> = RDSRec
* 	end
* 	if TimeOut GE five AND TimeOut LT six then
*		hourlyOuts<6> = hourlyOuts<6> + WafersOut
*		RDSOuts<6,-1> = RDSRec
* 	end
* 	if TimeOut GE six AND TimeOut LT seven then
*		hourlyOuts<7> = hourlyOuts<7> + WafersOut
*		RDSOuts<7,-1> = RDSRec
* 	end
* 	if TimeOut GE seven AND TimeOut LT eight then
*		hourlyOuts<8> = hourlyOuts<8> + WafersOut
*		RDSOuts<8,-1> = RDSRec
* 	end
* 	if TimeOut GE eight AND TimeOut LT nine then
*		hourlyOuts<9> = hourlyOuts<9> + WafersOut
*		RDSOuts<9,-1> = RDSRec
* 	end
* 	if TimeOut GE nine AND TimeOut LT ten then
*		hourlyOuts<10> = hourlyOuts<10> + WafersOut
*		RDSOuts<10,-1> = RDSRec
* 	end
* 	if TimeOut GE ten AND TimeOut LT eleven then
*		hourlyOuts<11> = hourlyOuts<11> + WafersOut
*		RDSOuts<11,-1> = RDSRec
* 	end
* 	if TimeOut GE eleven AND TimeOut LT twelve then
*		hourlyOuts<12> = hourlyOuts<12> + WafersOut
*		RDSOuts<12,-1> = RDSRec
* 	end
* 	if TimeOut GE twelve AND TimeOut LT thirteen then
*		hourlyOuts<13> = hourlyOuts<13> + WafersOut
*		RDSOuts<13,-1> = RDSRec
* 	end
* 	if TimeOut GE thirteen AND TimeOut LT fourteen then
*		hourlyOuts<14> = hourlyOuts<14> + WafersOut
*		RDSOuts<14,-1> = RDSRec
* 	end
* 	if TimeOut GE fourteen AND TimeOut LT fifteen then
*		hourlyOuts<15> = hourlyOuts<15> + WafersOut
*		RDSOuts<15,-1> = RDSRec
* 	end
* 	if TimeOut GE fifteen AND TimeOut LT sixteen then
*		hourlyOuts<16> = hourlyOuts<16> + WafersOut
*		RDSOuts<16,-1> = RDSRec
* 	end
* 	if TimeOut GE sixteen AND TimeOut LT seventeen then
*		hourlyOuts<17> = hourlyOuts<17> + WafersOut
*		RDSOuts<17,-1> = RDSRec
* 	end
* 	if TimeOut GE seventeen AND TimeOut LT eightteen then
*		hourlyOuts<18> = hourlyOuts<18> + WafersOut
*		RDSOuts<18,-1> = RDSRec
* 	end
* 	if TimeOut GE eightteen AND TimeOut LT nineteen then
*		hourlyOuts<19> = hourlyOuts<19> + WafersOut
*		RDSOuts<19,-1> = RDSRec
* 	end
* 	if TimeOut GE nineteen AND TimeOut LT twenty then
*		hourlyOuts<20> = hourlyOuts<20> + WafersOut
*		RDSOuts<20,-1> = RDSRec
* 	end
* 	if TimeOut GE twenty AND TimeOut LT twentyOne then
*		hourlyOuts<21> = hourlyOuts<21> + WafersOut
*		RDSOuts<21,-1> = RDSRec
* 	end
* 	if TimeOut GE twentyOne AND TimeOut LT twentyTwo then
*		hourlyOuts<22> = hourlyOuts<22> + WafersOut
*		RDSOuts<22,-1> = RDSRec
* 	end
* 	if TimeOut GE twentyTwo AND TimeOut LT twentyThree then
*		hourlyOuts<23> = hourlyOuts<23> + WafersOut
*		RDSOuts<23,-1> = RDSRec
* 	end
* 	if TimeOut GE twentyThree AND TimeOut LE twentyFour then
*		hourlyOuts<24> = hourlyOuts<24> + WafersOut
*		RDSOuts<24,-1> = RDSRec
* 	end
* 	
* 	
* 	TotalOuts = TotalOuts + WafersOut
* 	
* Next i
* 
* 
* 
* equ crlf$ to \0D0A\
* equ tab$ to char(09)
* equ comma$ to char(44)
* equ space$ to char(32)
* equ record$ to char(00)
* equ scolon$ to char(59)
*		
*		
*		hourlyOutsFile = 'C:\Users\ECOUELLETTE\DESKTOP\HourlyOuts.csv'
*		
*		OSOpen hourlyOutsFile To hOutsFile then   
*			
*			lastByte = 0
* 
*						hourLine = hourlyOuts
*						//swap @FM with ',' in hourLine
*						lineToWrite = hourLine: CRLF$
*						OSBWrite lineToWrite On hOutsFile At lastByte
*						lastByte = lastByte + Len(lineToWrite)
*			osclose hOutsFile
*		end	
*		
*		
*		RDShourlyOutsFile = 'C:\Users\ECOUELLETTE\DESKTOP\RDSHourlyOuts.csv'
*		lastByte = 0
*		OSOpen RDShourlyOutsFile To hRDSOutsFile then
*			for i = 1 to 24
*				RDSLine = RDSOuts<i>
*				swap @VM with ',' in RDSLine
*				RDSLine = RDSLine : CRLF$
*				OSBWrite RDSLine On hRDSOutsFile At lastByte
*				lastByte = lastByte + Len(RDSLine)
*			Next i
*			osclose hRDSOutsFile
*		end
*		
*		
* Debug
* 
* SearchString = 'GROUPS' : @VM: 'LEAD':@VM:'SUPERVISOR':@VM:'ENGINEER':@VM:'ENG_TECH' : @FM
* Table        = 'LSL_USERS'
* DictVar      = Database_Services('GetTableHandle', 'DICT.LSL_USERS')
* Btree.Extract(SearchString, Table, DictVar, Keys, '', Flag)
* 
* Debug
* 
* TempList = Database_Services('ReadDataRow', 'SYSLISTS', 'TEST_DANIEL')
*    // Chomp info line
*    TempList = Delete(TempList, 1, 0, 0)
*    For each KeyID in TempList using @FM
*         Record = Database_Services('ReadDataRow', 'RUN_STAGE_WFR', KeyID)
*         Database_Services('WriteDataRow', 'RUN_STAGE_WFR', KeyID, Record, True$, False$, True$)
*    Next KeyID
* 
* 
* debug
* search_criteria = 'KEY':@VM:'60'@FM
* table = 'OVERRIDE_LOG'
* 
* Open "DICT ":table To @DICT Else
* RetVal = Set_FSError()
*       Return
* End
* keylist = ''
* option = ''
* flag = ''
* Btree.Extract(search_criteria, table, @DICT, keylist, option, flag)
* 
* 
* RowCnt = COUNT(keylist,@VM)
*        
*        FOR I = 1 TO RowCnt
*            Display<1,I,1> = SigData<1,I>
*            Display<1,I,2> = SigData<2,I>
*            Display<1,I,3> = SigData<3,I>
*            Display<1,I,4> = SigData<4,I>
*        NEXT I
*        
*        TypeOver = ''
*        TypeOver<PDISPLAY$> = Display
* 
* RDSOverrides = ''
* display = ''
* debug
* RDSTestRec = '8':@VM:'5'
* Display = ''
* overriderec = ''
*i = 1
* For Each orKey in RDSTestRec using @VM
* 	overriderec = Xlate('OVERRIDE_LOG', orKey, '', 'X')
* 	Display<1,I,1> = overriderec<3>
*    Display<1,I,2> = overriderec<4>
*    Display<1,I,3> = overriderec<5>
*    Display<1,I,4> = overriderec<6>
*    i = i + 1
* Next OverRideRec
* 
*        TypeOver = ''
*        TypeOver<PDISPLAY$> = Display
* void = Popup(@WINDOW,TypeOver,'OVERRIDES') 
* 
* Debug
* 
* 
* for i = 1 to Count(keylist, @VM)
* 	overriderec = Xlate('OVERRIDE_LOG', keylist<1,i>, '', 'X')
* 	RDSOverrides := overriderec
* 
*    Display<1,I,1> = overriderec<3>
*    Display<1,I,2> = overriderec<4>
*    Display<1,I,3> = overriderec<5>
*    Display<1,I,4> = overriderec<6>
* Next i
* debug
* 
* 
*        TypeOver = ''
*        TypeOver<PDISPLAY$> = Display
* void = Popup(@WINDOW,TypeOver,'OVERRIDES')  
* Debug
*							orParms = ''
*							orParms<OVERRIDE_LOG_TABLE$> = 'RDS':@VM:'REACTOR'
*							orParms<OVERRIDE_LOG_KEY$> = '385600':@VM:'59'
*							orParms<OVERRIDE_LOG_USER$> = 'JONATHAN_O'
*							orParms<OVERRIDE_LOG_COMMENT$> = 'This is a test'
*							orParms<OVERRIDE_LOG_CATEGORY$> = 'ROTR_BLOCK'
*							orKey = obj_override_log('Create', orParms)
* ResponseComment            = Dialog_Box('NDW_ADD_COMMENT', @WINDOW)
*                    	
*                    	IF ResponseComment<2> NE '' THEN
*							// Clear ROTR reactor load block.
*							orParms = ''
*							orParms<OVERRIDE_LOG_TABLE$> = 'RDS':@VM:'REACTOR'
*							orParms<OVERRIDE_LOG_KEY$> = '385600':@VM:'59'
*							orParms<OVERRIDE_LOG_USER$> = 'JONATHAN_O'
*							orParms<OVERRIDE_LOG_COMMENT$> = 'This is a test'
*							orParms<OVERRIDE_LOG_CATEGORY$> = 'ROTR_BLOCK'
*							orKey = obj_override_log('Create', orParms)
*							
*                    	end else
*                    		Msg(@Window, 'A comment is required to perform an ROTR Block Override', '', '', '')
*                    		return
*                    	end
*                    	
* 
* 
* Debug
* ResponseComment            = Dialog_Box('NDW_ADD_COMMENT', @WINDOW)
* IF ResponseComment<2> NE '' then
* 	null
* end else
* 	Message    = 'NO Comment has been entered.'
*                Message    :='A comment is required to perform an ROTR Block Override'
*                Msg(@Window, 'A comment is required to perform an ROTR Block Override', '', '', '')
* end
* 
* 
* 
* debug
* StartTime = GetTickCount()
* Open "SQL_BACKLOG" to hTable then
*    ClearSelect
*    Select hTable
*    Done = 0
*    Loop
*        ReadNext Key else Done = 1
*        
*    Until Done OR (GetTickCount() - StartTime) >= 60000
*        Table = Key[1, "*"]
*        ID = Key[Col2() + 1, Len(Key)]
*        if Key EQ 'REACT_MODE*60*19275.5840277778' THEN
*        	DEBUG
* 
*        If ID[-7, 7] EQ "*DELETE" then
*            ID[-7, 7] = ""
*            Delete_Record_From_SQL(Table, ID, 1)
*            Delete hTable, Key
*        end else
*            Copy_Record_To_SQL(Table, ID, 1)
*            Delete hTable, Key
*        end
*        END
*    Repeat
* end
* 
* Return
Return



