WORKSTATION DEVICE FILE PROCESSING


Workstations are display terminals, CRTs, video display stations, or personal computers. The keyboard is the means through which we typically interact with a computer. Workstations come in two varieties: intelligent and dumb. Dumb workstations are the original workstations for RPG programs.

The IBM 5250 family of workstations is considered to have dumb terminals. The contemporary name is nonprogrammable terminals or NPT. Intelligent workstations are personal computers or PCs. When RPG programs are run from intelligent workstations, those workstations are normally PCs emulating a dumb terminal. Hence, the intelligence isn't being utilized.

RPG supports workstation display devices through the WORKSTN device file. Workstation device files can be defined to the RPG program as an input, output, or combined file on the file specification. Table 11.28 lists the RPG operation codes that can be used with workstation files.

Table 11.28: Workstation Device File Operations

Op Code

Description

ACQ

Acquire a device.

CHAIN

Random access of subfile records.

CLOSE

Close file.

EXFMT

Write and then read a workstation device.

OPEN

Open file.

POST

Retrieve workstation device information into a data structure.

READC

Read next changed subfile record.

REL

Release an acquired device.

UPDATE

Update subfile record.

WRITE

Write workstation file format (including a subfile record format).

In Examples 11.1 through 11.8, each workstation operation code is shown as it relates to workstation device files. The RPG source code listed in the figures contains only that which is necessary to illustrate the operation code. Complete and fully functional programs are not featured.

Example 11.1: Random access of a subfile record.

start example
 .....FFileName++IFEASFRlen+LKeylnKFDevice+.Functions++++++++++++++++++++++++++++ 0001 FCUSTINQ   CF   E             WORKSTN SFILE(DISPLIST : RRN)      C*                    .      C*                    .      C*                    . .....CSRn01Factor1+++++++OpCode(ex)Factor2+++++++Result++++++++Len++DcHiLoEq.... 0002 C                   READ      CUSTMAST                               58 0003 C                   EVAL      EoFile = *IN58 0004 C                   DOW       EoFile = *OFF and Count < 6 0005 C                   ADD       1             RRN               3 0 0006 C                   WRITE     DISPLIST 0007 C                   READ      CUSTMAST                               58 0008 C                   EVAL      EoFile = *IN58 0009 C                   ENDDO      C*                    .      C*                    .      C*                    . 0010 C     5             CHAIN     DISPLIST                           71 
end example

Note

ACQ and REL operations seldom are used in modern RPG programs and aren't covered in this section.




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