× Home About AS400 Files on AS400 Bit Operations Compile Commands EBCDIC Table Edit Codes Message Subfile Reg. Expressions Sort Contact us


RPG - LANGUAGE

Files on AS400


The following file types are available on the AS400:
  • Flat File
  • Physical File
  • Logical File
  • Display File
  • Print File
  • Source File

Any file which stores data can be termed a physical file on the AS400.
A flat or text file is created by the command CRTPF and specifying a record length. This contains freeformat text and every record can have a different layout or format.
All other files are created with a pre-determined layout, as with a SQL table. This layout is known as the format. The definition language for all file layouts is DDS, or Data Definition Statements. The CRT* file commands use the DDS to create a formatted file. While the file name is referenced at the start of the program, all input and output is performed through the format.
A Physical File has the records grouped into members, for example a marketing file can have members for each region or a payroll file can have employee records grouped by department. The default is for all the reords to be in one member. When you create a physical file, you specify whether it has an index or not. If it has an index, it is described as having keyed or indexed sequence, whereas if it does not have an index, it is described as having arrival sequence. A physical file can have onmly one layout or format.

A Logical File is an index created over one or more physical files. It is comparable to a view in SQL. With a logical file you can also determine the records and fields to include. The default is to include all records and all fields.

A Display File is the screen interface for programs. Headers and footers can have separate formats as can the body of the display file. In a display file, a subfile is used to manage a list of records which is too long to fit on the screen with a scroll function.

A Print File is the printer interface for programs. Printed output can also be coded inn the program itself. Headers and footers can have separate formats as can the body of the print file.

A Source File has a predefined layout or format to contain program and file sources. A source file is created with the CRTSRCPF command.

You can email us here or use the Contact Us menu tab.