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

write a record to text file

Status
Not open for further replies.

thelearner

Programmer
Jan 10, 2004
153
US
Hi,

I have a file with 5 fields.
fielda, fieldb, fieldc,fieldd, and fielde. fielda and fieldc are my keys.
I use keys to read this file and write out to another text file. How can I write out the whole record without definding each field in DS or without moving each field at a time.

Thanks
 
Hi Rapeek,
Here is one possibility.

Define the output file as sharing the format of the input file.
If INFILE is my input file name and MYFMT the format name, create the following DDS for the output file (just one line except if you add keyfields).

R MYFMT FORMAT(INFILE) <-- Share just the FORMAT of INFILE and NOT the data

On the F spec rename the output file format.
When you write the renamed output format, RPG will implicitly move the input record fields to the output record fields since they have the same names.

HTH -- Philippe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top