DATABASE FILE MODELS


The IBM System/34 and System/36 use a flat file system. All files are linear, or nonrelational. This is in sharp contrast to the System/38 and AS/400 relational database management system, where fields are used to define the representation of the file.

When a file is created with the flat file model, its records are created as one large "field." There are no database field definitions. This is similar to the default method RPG uses to initialize data structures.

When a file is created with the relational model, its records are created as a collection of columns. These columns are known as fields to RPG programmers. The file's record length is calculated by the sum of the lengths of the fields. In essence, the record length becomes unimportant to the application developer.

When moving from a flat file system, such as the System/36, to a relational database system, such as the AS/400, several data integrity problems can arise.

  • When an RPG program writes a record using the System/36 flat file model, only the fields specified in RPG output specifications are written to the file. The remainder of the record is padded with blanks.

  • When a file from the System/36 flat file model is moved to the AS/400, the file is generally created with one large field. The length of this field equals that of the file's record length.

Decimal data errors can occur when a record is read from a file (i.e., during a CHAIN, READ, or RPG cycle input operation). When an error occurs and FIXNBR(*ZONED) is specified, the record is returned and any zoned decimal fields are fixed as previously described. Packed decimal fields are not fixed, however. Hence, decimal data errors can still occur in a program that has been created with the FIXNBR(*ZONED) option.




The Modern RPG IV Language
The Modern RPG IV Language
ISBN: 1583470646
EAN: 2147483647
Year: 2003
Pages: 156
Authors: Robert Cozzi

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net