I need an advice. Maybe someone can give a hint.
I coded a z/OS Batchprogramm using some files.
The coding pattern was "nested procedures", like this
PGM: PROCEDURE OPTIONS (MAIN)
ONE ENDFILE EOF = '1'B;
OK. I studied the "Programming Guide" where I found the Topic "nested procedures vs. package"
I switched to the package style.
PKG: PACKAGE EXPORTS( PGM )
ON ENDFILE EOF = '1'B;
PGM: PROCEDURE OPTIONS( MAIN)
OK. The compiler was not happy. The "ON ENDFILE EOF = '1'B;" was flagged. => No executable statments outside a procedure.
I tried different alternative. The only working one was to place the ON ENDFILE as the first statement in the PROCEDURE PGM.
As I have total 4 files, each has ON UNDEFIED and ON ENDFILE, the placement of these ON-Blocks in the Code of my main procedure PGM
hurts my aesthetic feeling of code.
Can anyone give a hint where to plac file related ON Blocks when using PACKAGE()?
Thx for any feedback.