Data transfer
Format 1 transfers data from an input source into the data item referenced by identifier-1 (the receiving area). When the FROM phrase is omitted, the system input device is assumed.
Format 1 is useful for exceptional situations in a program when operator intervention (to supply a given message, code, or exception indicator) is required. The operator must of course be supplied with the appropriate messages with which to reply.
- identifier-1
- The
receiving area. Can be:
- An alphanumeric group item
- A national group item
- An elementary data item of usage DISPLAY, DISPLAY-1, or NATIONAL
A national group item is processed as an elementary data item of category national.
- mnemonic-name-1
- Specifies
the input device. mnemonic-name-1 must be associated
in the SPECIAL-NAMES paragraph with an environment-name. See SPECIAL-NAMES paragraph.
- System input device
The length of a data transfer is the same as the length of the record on the input device, with a maximum of 32,760 bytes.
The system input device is read until the receiving area is filled or EOF is encountered. If the length of the receiving area is not an even multiple of the system input device record length, the final record will be truncated as required. If EOF is encountered after data has been moved and before the receiving area has been filled, the receiving area is padded with spaces of the appropriate representation for the receiving area. If EOF is encountered before any data has been moved to the receiving area, padding will not take place and the contents of the receiving area are unchanged. Each input record is concatenated with the previous input record.
If the input record is of a fixed-length format, the entire input record is used. No editing is performed to remove trailing or leading blanks.
If the input record is of the variable-length format, the actual record length is used to determine the amount of data received. With variable-format records, the Record Definition Word (RDW) is removed from the beginning of the input record. Only the actual input data is transferred to identifier-1.
If the data item referenced by identifier-1 is of usage national, data is transferred without conversion and without checking for validity. The input data is assumed to be in UTF-16 format.
- Console
- A system-generated message code
is automatically displayed, followed
by the literal AWAITING REPLY.
The maximum length of an input message is 114 characters.
- Execution is suspended.
- After
the message code (the same code as in item 1) is entered
from the console and recognized by the system, ACCEPT statement execution
is resumed. The message is moved to the receiving area and left-justified
regardless of its PICTURE clause.
If identifier-1 references a data item of usage NATIONAL, the message is converted from the native code page representation to national character representation. The native code page is the one that was specified by the CODEPAGE compiler option when the source code was compiled.
The ACCEPT statement is terminated if any of the following conditions occurs:
- No data is received from the console; for example, if the operator hits the Enter key.
- The receiving data item is filled with data.
- Fewer than 114 characters of data are entered.
If 114 bytes of data are entered and the receiving area is still not filled with data, more requests for data are issued to the console.
If more than 114 characters of data are entered, only the first 114 characters will be recognized by the system.
If the receiving area is longer than the incoming message, the rightmost characters are padded with spaces of the appropriate representation for the receiving area.
If the incoming message is longer than the receiving area, the character positions beyond the length of the receiving area are truncated.
For information about obtaining ACCEPT input from a z/OS® UNIX file or stdin, see Assigning input from a screen or file (ACCEPT) in the Enterprise COBOL Programming Guide.
- A system-generated message code
is automatically displayed, followed
by the literal AWAITING REPLY.
- System input device
- environment-name
- Identifies the source of input data. An environment-name from the names given in Table 1 can be specified.
If the device is the same as that used for READ statements for a LINE SEQUENTIAL file, results are unpredictable.