20 pts.
 write in a PF file
Hi everyone! I have an RPGLE program that creates four physical files (using the QCMDEXC program). These physical files have no DDS. In the same program, I read another physical file (that's a copy of a spool file). If the line (s) read met some specified criteria, it needs to be written to one of the four PF I've already created. The question is: how can I write this line(s) to those PF, without using SQL? Thanx in advance, Meli

Software/Hardware used:
ASKED: November 25, 2005  10:03 AM
UPDATED: November 28, 2005  10:44 AM

Answer Wiki:
Hi In your RPGLE program you need to specify the file as program described and include the keyword USROPN on the File spec. After you have created the file you can then open it using the OPEN operation and write to it as normal. All the best Jonathan
Last Wiki Answer Submitted:  November 25, 2005  12:02 pm  by  astradyne   370 pts.
All Answer Wiki Contributors:  astradyne   370 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

can’t you use output (O) specications of RPG?

 115 pts.

 

Yes, the F spec for the output files should look like:
Ffilename o f 132 disk usropn
You’ll also need to create the 4 files temporary so you can compile the program. Then your program logic should roughly look like this:
call qcmdexc to create file 1
call qcmdexc to create file 2
call qcmdexc to create file 3
call qcmdexc to create file 4
open file1
open file2
open file3
open file4
read inputfile
write file1 or file2 or file3 or file4
close file1
close file2
close file3
close file4
set on *inlr

 110 pts.

 

I believe in order to use WRITE opcode with a pgm-described file, you must specify a data structure as the result field. Or if using free-format, its:
/free
write file1 dsfile1;
/end-free

 0 pts.