This course describes how to create an interactive application, in which an RPG program gets data from, and displays results to, a user at a traditional green-screen workstation. While such programs are rarely written from scratch any more, programmers need to understand the logic of such programs in order to maintain them or to covert them to web-based applications.
The course begins by describing the role a display file plays in an interactive application and how a display file is created. You will see the data description specifications (DDS) source statements most commonly used for a display file. The course then considers the requirements for an interactive RPG program. You will see how to code the file specification for a display file and how to display data at, and receive data from, a workstation.
The remainder of the course is devoted to the topic of subfiles. After being introduced to the concepts related to subfiles, you will see the DDS statements used to define a load-all subfile. You will then see how to code an RPG program to load and display a subfile. The course next uses DDS and RPG program examples to illustrate the differences between load-all, expanding, and single-page subfiles. You will also see how to code an RPG program that reads and updates the records in a subfile.
Approximate Study Time: 3 hours
After completing this course, you should be able to:
- Interpret the DDS statements used to define a display file
- Use the CRTDSPF command to create a display file from DDS source
- Code the file specification for a display file
- Use the EXFMT, READ, and WRITE op codes to send data to and receive data from a workstation user
- Use indicators to determine if a special-purpose key, such as a function key, was pressed
- Interpret the DDS statements used to define a subfile
- Code the RPG statements to define, load, and display a subfile
- Describe how a load-all subfile, an expanding subfile, and a single-page subfile differ
- Describe how the DDS for a load-all subfile, an expanding subfile, and a single-page subfile differs
- Code the RPG statements to read subfile records
- Code the RPG statement to update a subfile record
Creating a Display File
Coding an Interactive Program
Introduction to Subfiles
Using Expanding and Single-Page Subfiles
Reading and Updating Subfile Records
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 RPG programming concepts. You can satisfy this prerequisite by successfully completing the previous courses in this series: