Creating a Data File in AS400
To create a file named FTPOUT that is 100 characters in length:
CRTPF FILE(MYLIB/FTPOUT) RCDLEN(100)
The AS/400 actually creates a file named FTPOUT, a member named FTPOUT and a field of length 100 that is named FTPOUT.
To make a database file, you use the DDS specifications. You must start the Programming Development Manager and create a member with TYPE of PF (for physical file). Usually, this goes in the object QDDSSRC.
The first line defines the record name. For a simple 3 field file:
A R CUSREC
A NAME 20A
A PHONE 10S 0
A STATUS 1A
Name the member in QDDSSRC the same as the desired file. In this case, I named it CUS.
Then, you must compile or create the file. In PDM you can do this with the option 14. When you use option 14, you actually execute the command:
CRTPF FILE(MYLIB/CUS) SRCFILE(MYLIB/QDDSSRC) SRCMBR(CUS)
The AS/400 knows to use this command because you specified that this member is describing a PF.
If you have wanted a key built on the PHONE field, the DDS would have been:
A R CUSREC
A NAME 20A
A PHONE 10S 0
A STATUS 1A
A K PHONE
Discover more from CODE t!ps
Subscribe to get the latest posts sent to your email.