Problem solve Get help with specific problems with your technologies, process and projects.

Creating files within an RPG source code

How can I create a Physical File and Logical File within an RPG source code (via SEU) is it possible?
Do you mean you want to create the source code 'on-the-fly' using your RPG program? You would do that if the fields or keys were not known in advance of running the program. That would be very unusual, but can be done easily enough. Just use QCMDEXC to create the source member (you could create the source file in QTEMP or use one that already exists), then again to override to the output file in your program. This file would be program-described with a record length of 92 bytes, unkeyed. The record structure is:

6,2S SRCSEQ        Source sequence number 
6,0S SRCDAT        Source change date 
 80A SRCDTA        Source data  

Write your source lines, making sure to increment the sequence number. Close the file, delete the override and execute CRTPF or CRTLF using QCMDEXC.


The Best Web Links: tips, tutorials and more.

Visit the ITKnowledge Exchange and get answers to your developing questions fast.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

Dig Deeper on RPG iSeries programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.