SUBROUTINE TEST2(Arg1, Arg2)
* LIST RDS WAFERS_IN WAFERS_OUT
*
$INSERT WO_STEP_EQU
Debug
Open 'WO_MAT_LOG' to hHandle then
	For Counter = 1 to 1000
		Write 'Hello World!' to hHandle, Counter else
			Debug
		end
	Next Counter
end


Debug
WoNo = '168279'
PsNo=''
    
    WORec	= XLATE('WO_LOG',WONo,'','X')
    PSNo		= XLATE('WO_STEP',WONo:'*':'1',WO_STEP_PROD_SPEC_ID$,'X')
    //PSNo = Xlate('RDS', RDSNo, 'PROD_SPEC_ID', 'X')
Return



DECLARE FUNCTION SET_STATUS, SET_FSERROR, SEND_DYN, SEND_INFO, SET_ROWDEF
EQU TAB$ TO \09\
STATX = SET_ROWDEF( \01\ )
* HEADING/FOOTING
HEADING "  "
FOOTING ""
* 
@RECCOUNT=0
FIRST.PASS=1
LAST.RECORD=0
READERR=0
* 
* OPEN DICT AND DATA FILES
* 
OPEN "DICT","RDS" TO @DICT ELSE RETURN
OPEN "","RDS" TO FILE.IN ELSE RETURN
* 
* MAKE COLUMN HEADING
* 
COLHEADING "Key" : @FM : "Wafers In" : @FM : "Wafers Out"
COLLENGTH 15 : @FM : 14 : @FM : 14
* 
READRECORD:
* 
* 
READNEXT @ID, WHICH.VALUE ELSE
 IF STATUS() GT 0 THEN
 STATX = SET_FSERROR() 
 RETURN
 END
 IF @FILE.ERROR<1> EQ 421 THEN
 STATX = SET_FSERROR()
 GOTO READRECORD
 END
 IF @FILE.ERROR<1> NE 111 THEN
 @ANS = @FILE.ERROR<1>
 STATX = SEND_DYN( {RLIST_TEXT_4} ) 
 READERR += 1
 GOTO READRECORD
 END
 LAST.RECORD=1
END
@FILE.ERROR.MODE=0
* 
S.ATID = @ID
* 
IF FIRST.PASS AND LAST.RECORD THEN
 STATX = SEND_DYN( {RLIST_TEXT_2} )
 RETURN
END
* 
IF LAST.RECORD THEN GOTO BREAKS
* 
IF @REDUCTION.DONE THEN
 READO @RECORD FROM FILE.IN, @ID ELSE
 @FILE.ERROR.MODE = 0
 IF STATUS() GT 0 THEN
 STATX = SET_FSERROR()
 RETURN
 END
 IF @FILE.ERROR<1> NE 100 THEN
 READERR += 1
 END
 GOTO READRECORD
 END
END
* 
@RECCOUNT += 1
* 
* 
* CALCULATE VALUE(S) FOR COLUMN(S)
* 
S.ATID={@ID}
I.ATID=S.ATID
S.WAFERSULIN={WAFERS_IN}
I.WAFERSULIN=S.WAFERSULIN
S.WAFERSULOUT={WAFERS_OUT}
I.WAFERSULOUT=S.WAFERSULOUT
* 
* 
IF FIRST.PASS THEN
FIRST.PASS=0
GOTO DETAIL
END
* 
* 
BREAKS:
* 
* 
* PERFORM LAST RECORD OUTPUT IF DONE
* 
IF LAST.RECORD THEN
STATX = SEND_DYN("")
@ANS=@RECCOUNT
STATX = SEND_DYN( {RLIST_TEXT_1} )
IF READERR THEN
@ANS=READERR
STATX = SEND_DYN( {RLIST_TEXT_3} )
END
RETURN
END
* 
DETAIL:
* 
* DO CONVERSIONS IF ANY
* 
IF S.WAFERSULIN NE "" THEN S.WAFERSULIN=OCONV(S.WAFERSULIN,"MD0")
IF S.WAFERSULOUT NE "" THEN S.WAFERSULOUT=OCONV(S.WAFERSULOUT,"MD0")
* 
* PRINT DETAIL LINE
* 
PRINTLINE = ""
PRINTLINE := FMT( S.ATID, "L#15") : TAB$
PRINTLINE := FMT( S.WAFERSULIN, "R#14") : TAB$
PRINTLINE := FMT( S.WAFERSULOUT, "R#14")
STATX = SEND_DYN( PRINTLINE )
* 
* 
GOTO READRECORD
* 
END

