This course describes how to process database files in a free-form RPG program.
The course first shows how to code the file specification for a database file. The course then covers the various RPG op codes that are used to process a database file. You will see how to perform basic file operations, such as how to read records (both sequentially and randomly), update a record, delete a record, and add a record to a file. You will also see how to perform more advanced file operations, such as how to set the file position without reading a record, how to use a composite key, and how to release a locked record.
The course then describes the various ways for an RPG program to detect an error condition and the ways to obtain information as to the cause of the error. The course ends by showing you how to code an RPG program that uses commitment control.
Approximate Study Time: 2.5 hours
After completing this course, you should be able to:
- Code the file specification for a database file
- Identify the F-spec keyword used to specify a given file attribute
- Detect an error condition in an RPG program
- Obtain information pertaining to a file error
- Code an RPG program that perform the following file processing:
- Reads records (either sequentially or randomly) from a file
- Updates records in a file
- Deletes records from a file
- Adds records to a file
- Sets these file position without reading a record
- Process the group of records with the same key value
- Uses a composite key to access records
- Releases a record previously locked for update
- Opens and closes a file
- Forces file changes to auxiliary storage
- Code an RPG program that uses commitment control
Coding File Specifications
Basic Database File Processing
Advanced Database File Processing
Using Commitment Control
This course is intended for programmers new to the RPG programming language. It can also be taken by RPG III programmers who want to learn RPG IV and by RPG IV programmers who want to learn the free-form syntax.
This course assumes that you are familiar with computer programming concepts. In order to satisfy this prerequisite, you should have some programming experience with another programming language.
This course also assumes that you have a working knowledge of basic IBM i concepts and facilities. You can satisfy this prerequisite by successfully completing the courses in the following series:
In addition, the course also assumes you familiar with IBM i programming concepts and facilities. You can satisfy this prerequisite by successfully completing the courses in the following series:
Finally, the course assumes that you have a basic understanding of free-form RPG programming concepts. You can satisfy this prerequisite by successfully completing the first course in this series: