Tue, 07/03/2012 – 14:11
#1
Reading file sequentially in CLIST
Here is the code for reading a file sequentially using CLIST. See below how the EOF (End of file) is handled in CLIST.
Also you can see how error trace is handled in CLIST.
“; ; ; ;
/* DISPLAYING ERROR TRACE
/*CONTROL MSG CONLIST SYMLIST NOFLUSH
/* BLOCKING ALL ERROR TRACE
CONTROL NOMSG
ERROR +
IF &LASTCC=400 THEN +
DO
 WRITE REACHED EOF HENCE CLOSING THE FILE
 CLOSFILE FIL1
 FREE FILE(FIL1)
 GOTO ENDCLIST
END
ALLOC F(FIL1) DA(‘USERID.INPUT.FILE’) SHR REU
OPENFILE FIL1
SET EOF=0
DO UNTIL &EOF NE 0
 GETFILE FIL1
 WRITE READING RECORD &FIL1
END DO
CLOSFILE FIL1
FREE FILE(FIL1)
ENDCLIST: +
WRITE ENDING CLIST
END
Click the +1 button  below to share it with your friends and colleagues
Share this if you liked it!
Disclaimer