How to read a text file to use for variables in CL
5 pts.
0
Q:
How to read a text file to use for variables in CL
I have a CL that saves libraries as savf files to later FTP to a storage device. For each library I have a set of commands that specifiy the specific library and the specific savf file for that library. The commands are repeated three times, once for each library/savf file. I would like to have the CL read from a text file containing the list of save libraries, perhaps with the associated savf file for each library. This would then loop through the library list in the text file, bringing back the library and file names to be used in a variable.

Can someone help me with the call to the external library and the loop configuration? I've done this in other batch languages but am reall new to the IBM CLP (It took me 8 hours to do my basic CL and FTP.

Thanks in advance for any help available.

Patrick Frank
ASKED: May 1 2009  3:22 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
24510 pts.
0
A:
 RATE THIS ANSWER
+1
Click to Vote:
  •   1
  •  0
  • AddThis Social Bookmark Button
-- 1. create a db2 file for your data

-- 2. cl

PGM
DCLF yourFile

LOOP: RCVF /* reads next record from yourFile */
MONMSG CPF0864 EXEC(GOTO EOF)

/* here you can use the fields from the file, the field names are the db2 field name preceeded with & */
/* so a field named savflib would be used here as &savflib */


GOTO LOOP

eof: endpgm

//////////////////////////////////////////////////////

I'm not sure if this will help but you can use a file on the 400 that has all the files listed with properties. Just copy out what you need. It has the libraries,files,type..etc..
QSYS/QADBXREF



Thanks
Ron
Last Answered: May 1 2009  8:56 PM GMT by Philpl1jb   24510 pts.
Latest Contributors: RonKoontz   1345 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

TomLiotta   7295 pts.  |   Oct 22 2009  2:41AM GMT

Please supply OS version/release.

Prior to V5R4, CL had almost no chance of reading a “text file” without some help. A text file in the /QDLS file system could be read with the HFS APIs, and a user space could contain a copy of a text file and be read with the user space APIs. (Copying between the /root file system and a user space can require *AUDIT special authority.)

I think V5R4 CL can read text files, but I’m not sure why anyone would do it unless no other compiler was available.

Also, Qshell scripts can process text files easily. A CL program can invoke Qshell with the STRQSH command.

Tom

 
0