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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AS400 Sequential File Reading

Status
Not open for further replies.

razlandwife

Programmer
Aug 21, 2006
4
0
0
US
I have a file defined as this:

FAPY120WK IF F 365 DISK

And I have the definition coded like this:

D/COPY QRPGLESRC,APY120WCB
*
IAPY120WK AA

What is the statement I need to use to get the data into the APY120WCB copybook after the read statement?

Thanks!
 
razlandwife,

First let me say, "WOW!" I haven't seen an interally declared file in a long time. The last I knew, you had to move the fields individually. Unless you use a data structure on the F spec and I'm not sure you can do that with an interally discribed file. Why are you doing this? Are you maybe in S/36 mode? More info might be helpful...

HTH,
MdnghtPgmr
 
We have an old Cobol program that we are rewriting in RPG because the user gets stuck quite often and we have to "kill" her session. This causes us to have to use strdfu and go in to delete the records written to one of our physical files. This file is a work file that is just used to hold data until the end of job. I am writing a recover program to read this file and delete the records from the physical file to prevent programmer intervention every time user gets stuck. Thanks for you prompt response!

This is what I ended up doing and it works.

FAPY120WK IF F 365 DISK
*
D/COPY QRPGLESRC,APY120WCB
*
IAPY120WK AA
I A 1 365 APY120REC
 
That's all fine & good, but I guess the question is why isn't the file defined externally?
 
razladwife said:
What is the statement I need to use to get the data into the APY120WCB copybook after the read statement?
The Read opcode.

Feles mala! Cur cista non uteris? Stramentum novum in ea posui!

 
What I meant is, you can specify the data structure name in the Read opcode.

Feles mala! Cur cista non uteris? Stramentum novum in ea posui!

 
If you want to read all the records in the file, simply define it as IPE instead of IF, and the cycle will populate the fields automatically.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top