Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EOF handling in CLIST

Status
Not open for further replies.

SowKan

Technical User
Mar 18, 2004
24
IN
I am trying to write a CLIST which involves reading a file and manipulating the file contents. When end of file is reached, execution stops with RC=E400. How can I handle this?
Thanks in advance,
Sowmya.
 
Try using REXX?

Seriously though, there's nothing you can do in CList you can't do in REXX (though there is the odd thing CList does better). Try this;

Code:
/* Rexx */
"Alloc Fi(INPUT) Da('[COLOR=blue]MY.DATA.SET(MEMBER)[/color]') Shr Reu"
"Execio * DiskR INPUT (Stem INP. Finis)"
"Free Fi(INPUT)"
do i = 1 to INP.0
  Line = INP.i
  say 'Line 'i' = 'Line
end
 
You should have a generic ERROR block early in your code. It has been so long since I actually wrote CLIST I no longer recall exactly the syntax, but I -think- it went something like this:
Code:
ON ERROR
   SET &SAVERC = &COND
   RETURN
END
and handle ALL retrun codes in-line, so you would
Code:
GETFILE STUFF
IF &SAVERC = 400 THEN GOTO ENDSTUFF /* EOF
If you're currently writing CLIST, you should be able to correct my syntactical errors, but I have to second KRD's tongue-in-cheek remark: give it up; switch to REXX.


Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
Thanks KiwiREXXDude!
I got it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top