FULL-PROCEDURAL FILE PROCESSING


Full-procedural files are defined by placing the letter F into column 16 of the file specification. A typical declaration for a full procedural file is shown in Figure 11.1.

click to expand
Figure 11.1: File description for a full-procedural DISK file.

Both program-described and externally described database files can be declared as full procedural. Full-procedural file processing is performed by several RPG op codes. For example, to read a record from a file, the READ operation is used. To write a new record to a file, the WRITE operation is used. Table 11.1 lists RPG op codes that can be used with full-procedural files.

Table 11.1: File-Based Op Codes

Op Code

Description

ACQ

Acquire program device.

CHAIN

Random file access by index.

COMMIT

Commitment control, commit group.

DELETE

Delete database file record.

EXCEPT

Write program-defined or externally described record format.

EXFMT

Write, then read, a workstation device-file record format.

FEOD

Reset the file "cursor." Unlock any locked records.

KFLD

Define a key field of a key list.

KLIST

Define key list.

OPEN

Open file.

POST

Retrieve and post device-specific information to a data structure.

READ

Read record.

READC

Read next changed subfile record.

READE

Read next database file record with matching index.

READP

Read previous database file record.

READPE

Read previous database file record with matching index.

REL

Release acquired program device.

ROLBK

Commitment control, roll back group.

SETGT

Set file cursor greater than the specified index.

SETLL

Set file cursor less than the specified index.

UNLOCK

Release record lock.

UPDATE

Update record.

WRITE

Write record.

In discussing file processing, several database terms are used. These terms are general to the topic of databases and specific to the AS/400 system. Here's a look at a brief glossary of file terminology:

access path: An object used to access data in a file in a specific sequence.

cross reference: A set of files containing fields for where and how information is used.

library: A directory of a group of related and unrelated objects that have been placed into a specific context.

field: In a record, one or more bytes of information that make up a single fact.

File: A directory of members and formats. Typically referred to as physical files, logical files, or join logical files, file is a generic term for database file.

member: The entity within a database file that contains the actual data. A set of fields and records.

index: See access path.

join logical file: A subset of fields and records from two or more files.

Key: See access path.

key field: A field in a physical or logical file used to determine the order of entries in an access path.

logical file: A subset of fields and records from a file.

physical file: A database file containing records of real data.

record: A horizontal line of data in a physical or logical file.

random access: A method of processing a file randomly by its access path through its key fields.

view: A subset of fields and records from a file.




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