30 pts.
AS/400 Subfiles
I am working on V4R4M0 . I would like to know clearly about a Flat File , its uses, and how can we enter data into it ? how to fetch data from it ? Thanks in advance

Answer Wiki

Thanks. We'll let you know when a new response is added.

Using a flat file on the IBM i is just a file with one big field defined in a physical file that contains all of the data. You define the fields in a high level language program like COBOL or RPG. Then the file is read sequentlially record by record to retrieve the information you want.

It usually was seen when you converted to a System 38 from a System 3, system 34 or System 36 which did not have an integrated database like the System 38, AS/400, iSeries, System i or IBM i today.

If you can find the starting and ending point of key fields you can create keys that can be used to read the file in key order or go to a set of records in a much shorted method than just reading the file sequentially.


Discuss This Question: 3  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • philpl1jb
    This could be a text file in the IFS or a single field file in the DB2 These files can be created using various copy commnds, queries, Sql or programs. These are often used to import/export data. Phil
    54,090 pointsBadges:
  • DanTheDane
    You may also CHAIN by rrn (relative record number) if file is a DB2-file. If f.x. you have some data with numbers as id's (ex employe numbers 105->125), it is possible to place these data in 20 records which you access via CHAIN - just subtract 104 from the emp.no. first. The solution requires all 20 records to exist in the file. This kind of solution is possible, but NOT recommented. DanF
    2,555 pointsBadges:
  • ToddN2000
    If you know where the fields begin/end you can define them in a data structure or define the programmatically. Sometimes flat files come from an external source or are created for external sources with a predefined record length. Things that come to mind that we use them for here are some EDI formats and bank transfer files that have multiple record formats in the same file defined by a code. ex. A code 1 record has 5 fields, the code 2 record has 3 fields, the code 7 has 8 fields all with a record length of 80 chars.
    131,440 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: