This course describes how to process database and printer files in an 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. Next, you will see how to code an RPG program that uses commitment control. The course ends by covering the coding requirements of a program that produces printed output.
Approximate Study Time: 3 hours
After completing this course, you should be able to:
- Code the file specification for both a database and printer file
- Identify the F-spec keyword used to specify a given database or printer file attribute
- Detect an error condition in an RPG program
- Obtain information pertaining to a file error
- Code RPG programs that perform the following file processing:
- Read records (either sequentially or randomly) from a file
- Update records in a file
- Delete records from a file
- Add record to a file
- Set the file position without reading a record
- Process the group of records with the same key value
- Use a composite key to access records
- Release a record previously locked for update
- Open and close a file
- Force file changes to auxiliary storage
- Write records to a program-described printer file
- Code an RPG program that uses commitment control
- Code the output specifications for a program-described printer file
Coding File Specifications
Basic Database File Processing
Advanced Database File Processing
Using Commitment Control
Producing Printed Output
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.
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 RPG programming concepts. You can satisfy this prerequisite by successfully completing the first course in this series: