The ACCEPT Screen-Name statement moves data entered by the terminal operator from fields on the terminal screen to data items defined in the Data Division.The organization, placement and visual attributes of the fields on the screen are defined in the Screen Section of the Data Division.
Format 5:Accept Screen-Name
screen-name-1 must be defined as an elementary or group entry in the Screen Section of the Data Division. identifier-1 and identifier-2, when used, must refer to elementary numeric integer data items.
COL is a synonym for COLUMN.
ESCAPE is a synonym for EXCEPTION.
If the LINE phrase is specified, the value of integer-1 or the current value of the data item referred to by identifier-1 is used as an increment to each of the explicit or implicit LINE specifications within screen-name-1, thus shifting the screen downward the specified number of lines.
A similar rule applies if the COLUMN phrase is specified:the value of integer-2 or the current value of the data item referred to by identifier-2 is used as an increment to each of the explicit or implicit COLUMN specifications within screen-name-1, thus shifting the screen to the right the specified number of columns.
The following discussion uses the phrase “each input field referred to by screen-name-1.”Within the Screen Section, an input field is defined by an elementary entry that contains a PICTURE clause having the TO or USING option.If screen-name-1 is an elementary item having a PICTURE clause with a TO or USING option, the phrase “each input field referred to by screen-name-1” is a reference to the screen field defined by screen-name-1.If screen-name-1 is a group item, the phrase is a reference to each subordinate elementary input field, taken in the order of their definition.
For each input field referred to by screen-name-1, the cursor is positioned at the beginning of the field, the field is filled with the retained value and the operator is given control to enter a new value for that field.If the operator does not wish to change the retained value of the field, the Return key can be used to terminate entry for the field, leaving the value unchanged.
While the operator is entering a value into a field, the local editing keys may be used to revise the value being entered. Until the last input field has been completed, the operator may move the cursor to previously entered input fields to revise their contents.The keys needed to perform these operations are defined in the RM/COBOL User’s Guide.
The retained value that is shown in the field when the field first becomes active during an ACCEPT operation depends on whether screen-name-1 has previously been the subject of an ACCEPT or DISPLAY operation within this run unit.If this is the first usage of screen-name-1 within the run unit, the retained value is ZEROES for numeric items or SPACES for nonnumeric items.If this is not the first usage of screen-name-1 within the run unit, the retained value is the value left from the last ACCEPT or DISPLAY of screen-name-1.
If the current input field is numeric, the operator may enter a leading or trailing sign character (provided the input field allows for a sign) and a decimal point in addition to the numeric digits.The sign and decimal point characters are recognized and removed, using the same de-editing algorithm that is used during a Format 3 ACCEPT of a numeric operand that specifies the CONVERT phrase.
After each input field is completed, the runtime system checks that the characters entered are valid for that particular field. If invalid characters have been entered, an error message is displayed on the bottom line of the screen, and the operator is given control to correct the field.(When the correction operation occurs, existing information on the bottom line, if any, is overlayed and not restored.)
During the course of an ACCEPT operation, the operator may terminate the operation prematurely by use of the Escape key or one of the function keys.If the Escape key is used, the current and all remaining input fields within screen-name-1 are passed over without changing their retained values.If one of the function keys is used, the current field is completed and becomes the retained value; further input fields, if any, are passed over without changing their retained values.In either case, the escape condition is raised.If neither the Escape key nor one of the function keys is used to signal premature termination, the ACCEPT operation terminates normally after the last input field has been completed.
The circumstance that caused termination of the ACCEPT operation is recorded by the runtime system, and may be interrogated by executing an ACCEPT . . . FROM ESCAPE KEY statement.
When the ACCEPT operation completes (either normally or prematurely), each retained value corresponding to an input field within screen-name-1 is moved to its associated item.The move is done according to the standard MOVE rules with the sending item being the retained value as described by the PICTURE clause in the Screen Section entry, and the destination item being the associated item.
If the escape condition is raised during an ACCEPT operation and there is an ON ESCAPE phrase in the ACCEPT statement, control is transferred to imperative- statement-1 and execution continues according to the rules for each statement specified in imperative-statement-1.If a procedure branching or conditional statement that causes explicit transfer of control is executed, control is transferred in accordance with the rules for that statement; otherwise, upon completion of execution of imperative-statement-1, control is transferred to the end of the ACCEPT statement and the NOT ON ESCAPE phrase, if present, is ignored.
If the escape condition is raised during an ACCEPT operation and there is no ON ESCAPE phrase, the escape condition is ignored.
If the escape condition is not raised during an ACCEPT operation and there is a NOT ON ESCAPE phrase, imperative-statement-1 is ignored, control is transferred to imperative-statement-2 and execution continues according to the rules for each statement specified in imperative-statement-2.If a procedure branching or conditional statement that causes explicit transfer of control is executed, control is transferred in accordance with the rules for that statement; otherwise, upon completion of execution of imperative-statement-2, control is transferred to the end of the ACCEPT statement.
Screen fields within screen-name-1 that are not input fields have no effect on the operation of the ACCEPT statement.
The BLANK LINE, BLANK REMAINDER and BLANK SCREEN attributes are not active during an ACCEPT operation.The effect of other attributes (AUTO, BELL, BLINK, FULL, REQUIRED, SECURE, and so forth) is as described in Chapter Data Division.
The appearance of the screen is undefined and unpredictable when LINE or COLUMN values are specified such that screen fields extend beyond the boundaries of the physical screen, either horizontally or vertically.
ACCEPT Screen-Name Statement Examples
COBOL Related Interview Questions
|VSAM Interview Questions||IBM - VSAM Interview Questions|
|IBM-CICS Interview Questions||JCL Interview Questions|
|IBM DB2 Interview Questions||IBM-JCL Interview Questions|
|DB2 Using SQL Interview Questions||IBM-JCL&VSAM Interview Questions|
|IBM Mainframe Interview Questions||COBOL, CICS, JCL, VSAM, DB2 Interview Questions|
|DB2 SQL Programming Interview Questions||IMS/DB Interview Questions|
|Mainframe DB2 Interview Questions|
Procedure Division Statements
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.