READ (READ A RECORD FROM A FILE)


In Example 11.5, the workstation file format or panel, PANEL1, is written to the workstation file (line 2). The READ operation on line 3 reads the format PANEL1. The READ operation waits for the user to respond to the panel by pressing the Enter key or a function key.

Example 11.5: READ a workstation device file.

start example
 .....FFileName++IFEASFRlen+LKeylnKFDevice+.Functions++++++++++++++++++++++++++++ 0001 FCUSTINQ   CF   E             WORKSTN MAXDEV(*ONLY) .....CSRn01Factor1+++++++OpCode(ex)Factor2+++++++Result++++++++Len++DcHiLoEq.... 0002 C                   WRITE     PANEL1 0003 C                   READ      PANEL1                                 75       *   This routine writes, then reads three       *   workstation file formats. 0004 C                   WRITE     PANEL1 0005 C                   WRITE     PANEL2 0006 C                   EXFMT     PANEL3 0007 C                   READ      PANEL1                                 75 0008 C                   READ      PANEL2                                 75       *   This routine writes the PANEL3 format,       *   then reads the workstation file. If the       *   workstation time-out threshold is reached,       *   resulting indicator 2 is set on. 0009 C                   WRITE     PANEL3 0010 C                   READ      CUSTINQ                              7375 
end example

Two workstation file formats are written to the workstation file on lines 4 and 5. Line 6 uses the EXFMT operation to write and then read a third panel, PANEL3. These read operations wait for a user response (pressing of the Enter key or a function key). In other words, the EXFMT operation waits for the user to respond. When a response is detected, the PANLE3 input is returned to the program. Subsequent READ operations, however, are required to return the input data from the other panels.

After the user responds, other panels currently active in the workstation file are read (lines 7 and 8). These READ operations don't wait for a user response because the READ operation (the EXFMT operation on line 6) releases all workstation formats.

Line 9 writes the format PANEL3. The CUSTINQ file itself is read by the READ operation on line 10. This technique causes the workstation file to timeout after an inactivity threshold has been reached. The MAXDEV keyword (line 1) indicates that the device can be "invited," thus allowing this timeout technique to be used.




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