SCAN / Find Position in file
Posted: Wed Oct 03, 2012 8:35 pm
I am using the SCAN statement to find a value within a 1000 Byte record. For example:
(#INPUT-FILE is 1000 byte record)
IF #INPUT-FILE = SCAN '12LTU3'
ADD +1 TO #COUNTER
WRITE(1) #TR-DATE ' ' #TR-ACCTNO ' ' #TR-ACCTNAME
END-IF
WRITE(1) 'TOTAL RECORDS FOUND' #COUNTER
My question is... is there a way to write out the position spot where the record was found? Say it found '12LTU3' in position 152 of 1000. The program would write out 152.
Thank you in advance.
(#INPUT-FILE is 1000 byte record)
IF #INPUT-FILE = SCAN '12LTU3'
ADD +1 TO #COUNTER
WRITE(1) #TR-DATE ' ' #TR-ACCTNO ' ' #TR-ACCTNAME
END-IF
WRITE(1) 'TOTAL RECORDS FOUND' #COUNTER
My question is... is there a way to write out the position spot where the record was found? Say it found '12LTU3' in position 152 of 1000. The program would write out 152.
Thank you in advance.