HP RPG/XL Programmer's Guide (30318-90001)

4-: 1
Chapter 4 Using a Terminal in an RPG Program
This chapter discusses the two ways that you can use a terminal in an RPG
program. The first method, line mode, lets you read and display terminal
data field by field. It is useful when you are reading or displaying
small amounts of data. The second method, full screen mode, is useful
when you have several data fields to process, or when you want the screen
to resemble a paper form of some kind.
This figure compares line mode and full screen mode from a user's point
of view.
Figure 4-1. A Comparison of Line (Character) and Full Screen Modes
Using a Terminal in Line Mode
Line mode is the easiest way to read or display a small number of fields.
For example, line mode can be the simplest way to read a date from the
terminal. The "line mode" sections which follow in this chapter explain
how to read and display data and how to use function keys and message
files in line mode.
When using line mode, you normally use the system-defined files $STDIN
for terminal input and $STDLST for terminal output. $STDIN and $STDLST
are assigned to the devices shown below:
When running in this mode: $STDIN, $STDLST have these device assignments:
Session User terminal
Job Job stream file, job stream list file
When necessary, you can redirect $STDIN and $STDLST to other devices by
using the operating system FILE command.
Reading and Displaying Data
There are two ways to read and display data on a terminal. You can use
the Calculation Specification operations READ and EXCPT or you can use