I need some clarification in reporting mode. I have written a program like below.
READ EMPLOYEE-FILE BY EMP-ID EQ '12345' IF EMP-ID GT '50000' ESCAPE PERFORM S001-WRITE-REPORT ... ... LOOP ... ... DEFINE SUBROUTINE S001-WRITE-REPORT WRITE WORK FILE 01 EMP-ID EMP-NAME EMP-DESIGNATION EMP-EXPERIENCE EMP-DOJ RETURN
I have expected this program to write the details of the records read by READ statement. But, natural editor had not allowed me to stow this program and it shows error in the EMP-ID field in WRITE statement of subroutine (something like FIELD has to be defined). Someone please clarify, whether in reporting mode, we cannot use the database fields in subroutines as I have used above?
I have corrected the above program by removing the subroutine and keeping the write statement inside READ statement. Then, it had worked as expected.
P.S: I don’t have mainframe connection to post the exact code and error message.