Hey everyone,
Wonder if you could lend some assistance here. I have a program which I want to receive records and loop round until EOF, once it has processed all the records in the file I want it to delay for a set period of time and then start again from the first record.
I though that closing and re-opening the file would work (as it does in RPG), but this doesn't seem to work..
Whats the best way to start again from the first record in my file?
Wonder if you could lend some assistance here. I have a program which I want to receive records and loop round until EOF, once it has processed all the records in the file I want it to delay for a set period of time and then start again from the first record.
I though that closing and re-opening the file would work (as it does in RPG), but this doesn't seem to work..
Code:
PGM
DCL VAR(&WAIT) TYPE(*CHAR) LEN(5)
DCLF FILE(OMS400/MRMMSTP)
/* CHECK TO SEE IF THE OMS400 LIBRARY EXISTS, IF NOT THEN END PROGRAM */
CHKOBJ OBJ(OMS400) OBJTYPE(*LIB)
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ENDPGM))
RMVLIBLE LIB(OMS400)
MONMSG MSGID(CPF0000)
ADDLIBLE LIB(OMS400) POSITION(*FIRST)
/* IF WE GET TO HERE THEN WE CAN CONTINUE PROCESSING */
LOOP:
RCVF
MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(EOF)) /* If +
end of file */
RTVLNKSTS LINK(&MMNAME) OUTFIL(*ADD)
GOTO CMDLBL(LOOP) /* Read next record */
/* END OF FILE PROCESSING - DELAY JOB AND START AGAIN */
EOF:
CLOF OPNID(MRMMSTP)
RTVDTAARA DTAARA(OMCNTF (8 5)) RTNVAR(&WAIT)
DLYJOB DLY(&WAIT)
OPNDBF FILE(MRMMSTP) OPTION(*INP)
GOTO CMDLBL(LOOP)
/* END PROGRAM */
ENDPGM: ENDPGM







Comment