I have a scenario where I need to read from a File F1 based on Product name only
(F1 Key is Product name+ XXX+YYY+ZZZZ) write to file F2. Both F1 and
F2 having same fields except F1 have 1 Additional field(ZZZZ) which we are not
populating to F2(F2 Key is Product name+ XXX+YYY). So for each Product
name I need to compare with all the records in file F1. If same Product name
is found, then I need to do calculations for the other fields like Balance,
No.of accounts, ....etc. Then I need to write a single entry for that Product name
in the File F2. For this I did written some code, but it is populating data for
only first product, even if I used a loop. I want to know how to change it so that it fetch all the data.
PNAME SETLL RECFMTF1
READ RECFMTF1 90 /* Reads First record, PNAME-roductname
*IN90 DOWEQ *OFF
EXSR S1 /* to move all fields to temp fields*/
READ RECFMTF1 90 /* Reads Second record Product name*/
*IN90 IFEQ *OFF
TPNAME IFEQ PNAME /*TPNAME is containg value of initial PNAME,
/* Compares with other records on Sequencial-read
EXSR S2 /* Add the values for other fields on PNAME match
EXSR S3 /* to write to the file F2*/
As of now it is reading first record at the first READ operation, and comparing with other records (from second to till end of file) on second READ operation. But it is not reading second record again at the First READ operation.
Please help me find the way. Thanks a lot.