anyone know COBOL?

MartyMcFly3

Lifer
Jan 18, 2003
11,436
29
91
www.youtube.com
Alright for class we were given this problem to code... My program compiles correctly, the JCL is ok and everything in my mind should work. However i know I am knew to COBOL so i knew that it wouldn't and low and behold i was right. Any help is greatly appreciated.
 

Noid

Platinum Member
Sep 20, 2000
2,390
193
106
Structured coding.

This is a proper switch

01 DATA-SWITCH PIC X VALUE 'T'.
88 DATA-EXISTS VALUE 'T'.
88 END-OF-DATA VALUE 'F'.

Boolean values are even better ... but, I'm guessing you will learn them later.


PERFORM WRITE-HEADING-LINE.
PERFORM XXXX-READ-ROUTINE.
IF END-OF-DATA
PERFORM WRITE-NO-DATA-LINE
ELSE
PERFORM PROCESS-RECORDS
UNTIL END-OF-DATA.

Then your READ-ROUTINE can set the switch by
AT END
SET END-OF-DATA TO TRUE.

I guess maybe your instructor will teach you about COPYBOOKS later.
They can contain pre-defined FILE STATUS codes and are referenced within FILE-CONTROL.

(sorry, my spacing is removed)