To use a subfile for a display file in an ILE COBOL program, you must specify the SUBFILE phrase with the input/output operation. Valid subfile operations are:
Subfiles can be processed sequentially with the READ SUBFILE NEXT MODIFIED statement, or processed randomly by specifying a relative key value. A relative key is an unsigned number that can be used directly by the system to locate a record in a file.
The TRANSACTION file must be an externally described file. In ILE COBOL, access to the subfile is done with a relative record number, except when READ SUBFILE NEXT MODIFIED is used. If the SUBFILE phrases are used with a TRANSACTION file, the SELECT statement in the Environment Division must state that ACCESS MODE IS DYNAMIC and must specify a RELATIVE KEY.
If more than one display device is acquired by a display file, there is a separate subfile for each individual display device. If a subfile has been created for a particular display device acquired by a TRANSACTION file, all input operations that refer to a record format for the subfile are performed against the subfile belonging to that device. Any operations that reference a record format name that is not designated as a subfile are processed as an input/output operation directly to the display device.
Some typical uses of subfiles are summarized in Table 27.
Use | Meaning |
---|---|
Display Only | The workstation user reviews the display. |
Display With Selection | The user requests more information about one of the items on display. |
Modification | The user modifies one or more of the records. |
Input Only (with no validity checking) | A subfile is used for a data-entry function. |
Input Only (with validity checking) | A subfile is used for a data-entry function, and the records are checked as well. |
Combination of Tasks | A subfile can be used as a display with modification. |
Figure 141. Data Description Specifications for a Subfile Record Format
....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+.... A* THIS IS THE DISPLAY DEVICE FILE FOR PAYUPDT ** PAYUPDTD A* ACCOUNTS RECEIVABLE INTERACTIVE PAYMENT UPDATE A* A A R SUBFILE1 SFL (1) A TEXT('SUBFILE FOR CUSTOMER PAYMENT' A* A ACPPMT 4A I 5 4TEXT('ACCEPT PAYMENT') A (2) VALUES('*YES' '*NO') (3) A 51 DSPATR(RI MDT) A N51 DSPATR(ND PR) A* A CUST 5 B 5 15TEXT('CUSTOMER NUMBER') A 52 (4) DSPATR(RI) A 53 DSPATR(ND) A 54 DSPATR(PR) A* A AMPAID 8 02B 5 24TEXT('AMOUNT PAID') A CHECK(FE) (5) A AUTO(RAB) (6) A CMP(GT 0) (7) A 52 DSPATR(RI) A 53 DSPATR(ND) A 54 DSPATR(PR) A* A ECPMSG 31A O 5 37TEXT('EXCEPTION MESSAGE') A 52 DSPATR(RI) A 53 DSPATR(ND) A 54 DSPATR(BL) A* A OVRPMT 8Y 2O 5 70TEXT('OVERPAYMENT') A EDTCDE(1) (8) A 55 DSPATR(BL) (9) A N56 DSPATR(ND) A* A STSCDE 1A H TEXT('STATUS CODE') A R CONTROL1 TEXT('SUBFILE CONTROL') A SFLCTL(SUBFILE1) (10) A SFLSIZ(17) (11) A SFLPAG(17) (12) A 61 SFLCLR (13) A 62 SFLDSP (14) A 62 SFLDSPCTL (15) A OVERLAY A LOCK (16) A* A HELP(99 'HELP KEY') (17) A CA12(98 'END PAYMENT UPDATE') A CA11(97 'IGNORE INPUT') A* (18) A 99 SFLMSG(' F11 - IGNORE INVALID INPUT+ A F12 - END PAYMENT + A UPDATE') A* A 1 2'CUSTOMER PAYMENT UPDATE PROMPT' A 1 65'DATE' A 1 71DATE EDTCDE(Y) A 63 3 2'ACCEPT' A 63 4 2'PAYMENT' A 3 14'CUSTOMER' A 3 26'PAYMENT' A 64 3 37'EXCEPTION MESSAGE' A* A R MESSAGE1 TEXT('MESSAGE RECORD') A OVERLAY A LOCK A* A 71 24 2' ACCEPT PAYMENT VALUES: (*NO *YES) DSPATR(RI) |
The data description specifications (DDS) for a subfile record format describe the records in the subfile:
The subfile control record format defines the attributes of the subfile, the search input field, constants, and command keys. The keywords used indicate the following:
In addition to the control information, the subfile control record format defines the constants to be used as column headings for the subfile record format. Refer to Figure 141 for an example of the subfile control record format.
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.