The terminal I-O ACCEPT statement causes low volume data to be accepted from the terminal keyboard and transferred to the specified data item.ACCEPT statement phrases allow the specification of position, form, and format of the accepted data.
Format 3:Accept Terminal I-O
The Format 3 ACCEPT statement causes the transfer of data from the terminal keyboard. The data replaces the contents of the data item named by identifier-1. The receiving data item may have any usage except INDEX.
identifier-2, identifier-3, identifier-5, identifier-6, identifier-7, identifier-8, and identifier-9 must be described as integer numeric data items. literal-1, literal-2, literal-4, literal-5, literal-7, and literal-8 must be nonnegative integer numeric literals.
identifier-5 must be a nonnumeric data item. literal-4 must be a nonnumeric literal. literal-6 must be a nonnumeric literal one character in length.
It is worthwhile to define several terms used to describe the detailed function of each phrase.
Table shows the relationship of the various Format 3 ACCEPT statement phrases to the characteristics of the input field and screen field subject to control by the program. Note that the CONTROL phrase may be used in many instances to allow dynamic (that is, runtime as opposed to compile time) specification of characteristics.
Features that require support of the host operating system or terminal hardware may not be supported in all circumstances. Unsupported features will compile correctly, but will be ignored at runtime. Also note that some phrases may require that character positions on the screen between fields be reserved for attribute characters (typically, to support the HIGH, LOW, OFF, BLINK, REVERSE, ERASE EOL and ERASE EOS phrases).Take care to allow for attribute characters by not juxtaposing fields that may require them.
ACCEPT Statement Phrases and Output and Screen Fields
When an ACCEPT statement contains more than one receiving operand (identifier-1), the values are transferred in the sequence in which the operands are encountered.ACCEPT phrases apply to the previously specified identifier-1 only. A subsequent identifier-1 in the same ACCEPT statement is treated as if no previous phrases had been specified.
An ACCEPT statement may contain no more than one ON EXCEPTION phrase, and if present it must be associated with the last (or only) identifier-1.
NO BEEP Phrase
BELL is a synonym for BEEP.
The presence of the NO BEEP phrase in an ACCEPT statement causes suppression of the audio alarm signal.
If the NO BEEP phrase is omitted, an audio alarm signal occurs.
The presence of the BLINK phrase causes the PROMPT fill character and any displayed data to be displayed in a blinking mode.
If the BLINK phrase is not specified, the data is displayed in a nonblinking mode.
The value of identifier-4 or literal-3 in the CONTROL phrase is used to specify a dynamic option list.The value must be a character-string consisting of a series of keywords delimited by commas; some keywords allow assignment of a value by following the keyword with an equal sign and the value.Blanks are ignored in the character-string.Lowercase letters are treated as uppercase letters within keywords. Keywords specified override corresponding static options specified as phrases for the same identifier-1.Keywords may be specified in any order. Keywords, which specify options that do not apply to the statement, are ignored.
The keywords that affect an ACCEPT statement are BEEP, BLINK, CONVERT, ECHO, ERASE, ERASE EOL, ERASE EOS, HIGH, LOW, NO BEEP, NO BLINK, NO CONVERT, NO ECHO, NO ERASE, NO PROMPT, NO REVERSE, NO TAB, NO UNDERLINE, NO UPDATE, OFF, PROMPT, REVERSE, TAB, UNDERLINE, UPDATE and UPPER.The meanings of these keywords when they appear in the value of the CONTROL phrase operand are the same as the corresponding phrases which may be written as static options of the ACCEPT statement, with the addition of the negative forms to allow suppression of statically declared options.The keywords UNDERLINE and UPPER are not available as static options of the ACCEPT statement.When specified, UPPER causes all lowercase alphabetic characters contained in the screen field to be changed to uppercase alphabetic characters before input data conversion and storing in the receiving field.When specified, UNDERLINE causes the field on the screen to be shown in underlined mode, provided the terminal supports that mode. Additional keywords may be supported in environments that have device dependent functions (for example, color control);
The keywords are grouped by function such that only the rightmost appearance in the control value of a keyword from a functional group actually affects the screen field.The functional groupings are as follows:
• Erasure:ERASE, ERASE EOL, ERASE EOS, NO ERASE
• Alarm:BEEP, NO BEEP
• Intensity:HIGH, LOW, OFF
• Blinking:BLINK, NO BLINK
• Video:REVERSE, NO REVERSE
• Termination:TAB, NO TAB
• Prompting:PROMPT, NO PROMPT
• Input data conversion:CONVERT, NO CONVERT
• Output data conversion:UPDATE, NO UPDATE
• Verification:ECHO, NO ECHO
• Input data editing:UPPER
• Underscoring:UNDERLINE, NO UNDERLINE
Note that if the keyword UPDATE is specified, input data conversion is implied; unless identifier-1 is numeric edited, the keywords CONVERT and NO CONVERT are ignored. In the cases when identifier-1 is numeric and UPDATE is not specified, NO CONVERT may be used to suppress implicit or explicit input conversion.
If identifier-1 is numeric, the CONVERT phrase causes input conversion of the input field to a signed numeric value that is then stored in identifier-1. The CONVERT phrase is implied when identifier-1 is numeric, unless specifically overridden by the NO CONVERT keyword in identifier-7 or literal-7 of the CONTROL phrase, or by the use of the compiler option to suppress implied input conversion
Numeric input conversion is accomplished by a scan of the input field according to the following rules:
See the discussion of the ON EXCEPTION phrase for more rules which, if violated, cause an error code to be stored in identifier-8 and an exception condition to exist.A value will be stored in identifier-1, however, according to the rules listed above without regard to the presence of an exception condition.
The CONVERT phrase is implied by the UPDATE phrase when identifier-1 is numeric, but the CONVERT and UPDATE phrases may both be specified without error.
The use of input conversion is strongly recommended for numeric receiving items unless the program needs a different conversion algorithm and performs its own input validation.
If identifier-1 is numeric and input conversion is not specified (either explicitly or implicitly), identifier-1 is treated as an elementary alphanumeric data item whose size is equal to the number of data storage positions occupied by identifier-1.The data from the unconverted input field is moved to identifier-1 according to the rules for an alphanumeric move.The use of identifier-1 , whose value has been set in this manner, in an arithmetic operation, will have unpredictable results.
If identifier-1 is numeric edited and the CONVERT phrase is specified, the input field is converted to a signed numeric value as described above and that value is then stored in identifier-1 with editing according to the PICTURE character-string for identifier-1.
If identifier-1 is justified right alphanumeric and the CONVERT phrase is specified, the data from the input field is moved to identifier-1 according to the move rules for a justified right receiving data item.
If identifier-1 is alphanumeric edited and the CONVERT phrase is specified, those characters in the input field which correspond in position (from the left) to the PICTURE symbols A, X or 9 are moved to their respective positions in identifier-1.Spaces will be moved to those positions in identifier-1 that are represented by the PICTURE symbols A, X or 9 but which have no corresponding positions in the input field.The insertion characters 0, space and / will be stored in identifier-1 character positions represented by PICTURE symbols 0, B and /, respectively.
If identifier-1 is any other type, or if the CONVERT phrase is not specified, the data from the input field is moved to identifier-1 according to the rules for an alphanumeric move.
The value of identifier-5 or literal-4 in the CURSOR phrase specifies the initial cursor offset within the screen field from which the data is to be accepted.When identifier-5 is specified, the cursor offset at field termination is also returned to the program in identifier-5.
An offset of 1 represents the leftmost character position of the screen field. A value of zero is treated as 1; a value greater than the size of the screen field is treated as equal to the size of the screen field.
The presence of the ECHO phrase in an ACCEPT statement causes the contents of identifier-1 to be displayed in the screen field following data input.The display of the data is done as if a DISPLAY statement with similar options were executed. Note, however, that the CONVERT phrase in an ACCEPT statement controls only input conversion:output conversion is controlled by the UPDATE phrase.
If identifier-1 is numeric and input conversion was specified either explicitly or implicitly, the display of the data uses output conversion. When the ECHO phrase is not specified, the original input data remains in the screen field.
The presence of the ERASE phrase without either of the reserved words EOL or EOS causes the entire screen of the terminal to be erased.The current line and current position are set to 1.
The presence of the ERASE EOL phrase causes the portion of the line containing the leftmost character of the screen field to be erased from the leftmost character of the screen field to the rightmost character of that line.
The presence of the ERASE EOS phrase causes the portion of the screen to be erased from the leftmost character of the screen field to the rightmost character of the bottom line of the screen.
In all three cases above, erasure occurs before any data is displayed in or accepted from the screen field.
When no ERASE phrase is specified, no erasure occurs before accepting the data.
ON EXCEPTION and NOT ON EXCEPTION Phrases
ESCAPE is a synonym for EXCEPTION.
The presence of the ON EXCEPTION phrase allows field termination characteristics and conversion errors to be reported.
At field termination, a field termination code is stored in identifier-9.This code is normally the code associated with a field termination key.However, if the TAB phrase is not specified for the same identifier-1, the field may also be terminated by typing a data character (in other words, not a field termination key) in the rightmost character position of the screen field; this method of field termination results in a value of zero being stored in identifier-9. If identifier-9 is omitted, the value of the termination code may be obtained with a Format 2 ACCEPT statement that specifies the ESCAPE KEY option.
If input data conversion has been specified (see the discussions of the CONVERT and UPDATE phrases and the conversion process detects a violation of the following rules, the value 98 is stored in identifier-9, overriding the field termination key code.
If identifier-1 is numeric or numeric edited, the following rules are checked:
Note that input data conversion will store a value in identifier-1 even if one of these rules is violated; see the discussion of the CONVERT phrase.
If identifier-1 is alphanumeric edited, an input data conversion error occurs when an input field character in a position corresponding to the PICTURE symbol 0, B, or / (in the PICTURE character-string describing identifier-1 ) exists but is not equal to 0, blank or /, respectively.
When the value of identifier-9 is nonzero, imperative-statement-1 may be executed. imperative-statement-1 will be executed when identifier-9 has the value 98 (input data conversion rule violation) or the value 99 (input timed out).For other values of identifier-9 , the execution of imperative-statement-1 depends on the field termination key.
See Table for field termination keys and the corresponding field termination codes placed in identifier-9.
Generic Key Names
HIGH, LOW and OFF Phrases
HIGHLIGHT is a synonym for HIGH.LOWLIGHT is a synonym for LOW.SECURE is a synonym for OFF.
The presence of the HIGH or LOW phrase causes the PROMPT fill character and the accepted data (if UPDATE, ECHO or both are specified) to be displayed at the specified intensity.
The presence of the OFF phrase causes data to be input from the terminal keyboard but not displayed in the screen field.Space characters are displayed in the screen field in lieu of data characters.
When none of the phrases HIGH, LOW or OFF is specified, the default intensity is HIGH.
LINE and POSITION Phrases
COLUMN and COL are synonyms for POSITION.
The screen field is positioned on the terminal screen by specifying the line and position (that is, the character position within the line) of the leftmost character of the screen field.The top line of the terminal screen is line 1, the line below line 1 is line 2, and so forth.The rightmost character position of a line is immediately followed by the leftmost character position (position 1) of the line below; a screen field may overlap line boundaries on the terminal screen.The leftmost character of the screen field refers to the leftmost character position of that portion of the screen field that is on the topmost line containing a portion of the screen field.Similarly, the rightmost character position of the screen field refers to the rightmost character position of that portion of the screen field that is on the bottommost line containing a portion of the screen field.
The current line and current position prior to the ACCEPT operation for each identifier-1 may affect the position of the screen field as described in the rules below.At the beginning of a run unit, the current line is the last (bottommost) line and the current position is the leftmost position (position 1) of that line.The current line and current position are changed by each Format 3 ACCEPT and Format 2 DISPLAY operation to be the line and position of the character immediately following the rightmost character of the screen field.If the ERASE phrase (without EOL or EOS) is specified for the same identifier-1, the current line and current position are both set to 1.
The value of identifier-6 or literal-5 in the LINE phrase specifies the line value for the leftmost character of the screen field.The value of identifier-3 or literal-2 in the POSITION phrase specifies the position value for the leftmost character of the screen field.
Determining Line and Position
If the POSITION phrase is omitted, the position value is set to 1 for the first identifier-1 of a Format 3 ACCEPT statement; this value is also set to 1 if a UNIT phrase is specified for the same identifier-1. It is set to zero in all other cases.
If the line value is zero, or if the LINE phrase is omitted, the line value is set according to the following rules:
If the position value is greater than the maximum number of characters within a line, the position value is reduced by the maximum number of characters within a line and the line value is incremented by 1.This process is repeated until the position value is not greater than the maximum number of characters within a line.
If the position value is equal to zero, the position value is set to the current position. If the line value exceeds the number of lines on the screen, the contents of the screen are scrolled up one line and the line value is set to the number of lines on the screen. If the line of the rightmost character of the screen field exceeds the number of lines on the screen, the contents of the screen are scrolled up the amount of the excess and the line value is reduced by the amount of the excess.
The resulting line value and position value specify the position of the leftmost character of the screen field.
The presence of the PROMPT phrase in an ACCEPT statement causes the data to be accepted with prompting.The action of prompting is to display fill characters on the screen in the positions from which data is to be accepted.
The value of literal-6 specifies the fill character to be used in prompting. literal-6 must be a single-character, nonnumeric literal or figurative constant.If literal-6 is omitted in the PROMPT phrase, an underscore is used as the fill character.
When the PROMPT phrase is not specified, the data is accepted without prompting; the original contents of the field on the screen are undisturbed before accepting input unless the UPDATE phrase is specified.
When both the UPDATE and PROMPT phrases are specified, the fill character fills any character positions not occupied by the original value of the receiving operand.
REVERSED and REVERSE-VIDEO are synonyms for REVERSE.
The presence of the REVERSE phrase causes any displayed data to be displayed in a reverse video mode.
If the REVERSE phrase is not specified, the data is displayed in normal video mode.
The value of identifier-7 or literal-7 in the SIZE phrase specifies the size of the screen field and the input field.
If the SIZE phrase is not present, or if a value of zero is specified, the size of the input field and screen field (called the size value) is determined by the characteristics of identifier-1 and by the presence or absence of input and output conversion as follows:
The presence of the TAB phrase in an ACCEPT statement causes a wait for a field termination key; the fieldtermination key will signal fieldtermination.
If the TAB phrase is omitted, field termination occurs when either the end of the input field is encountered or a field termination key is pressed.
The value of identifier-8 or literal-8 in the TIME phrase specifies the length of time to wait before automatically terminating when no data is entered during the execution of the ACCEPT statement.The time period is specified in hundredths of seconds, but should be considered only an approximate value because of system variations.For example, a value of 6000 specifies an approximate timeout value of one minute.
A time-out value of 0 indicates that the ACCEPT should terminate immediately if there is no character waiting.A time-out value greater than 4,294,967,295 (a PIC 9(10) data item set to a value 9999999999 is recommended) indicates that the TIME phrase is being overridden and the ACCEPT will behave as if the TIME phrase were not specified.
If the user enters any data during the execution of an ACCEPT statement prior to the completion of the timing interval, the timer is canceled.The user may then take any amount of time to complete the entry of data for the ACCEPT statement as if the TIME phrase had not been specified.
If the timing interval completes without any entry of data by the user, then the ACCEPT statement terminates and returns a value as if the user had typed the Return key, except that an exception condition is raised and the exception status code value 99 is returned.
The UNIT phrase, if specified, must be the first phrase entered.The other phrases may be written in any order.
The value of identifier-2 or literal-1 in the UNIT phrase specifies the terminal from which the data is to be accepted.If the UNIT phrase is omitted, the terminal that started the run unit is used.
The UNIT phrase may be ignored by some runtime implementations except as it affects the default value of the POSITION phrase (described previously).This will occur in all systems that do not allow use of terminals other than the one associated with the run unit execution.
The UPDATE phrase causes the current value of identifier-1 to be displayed in the screen field with output conversion (internal to human-readable form).The operator may then modify the contents of the screen field before indicating field termination.The data in the input field is then stored in identifier-1 with input conversion (human-readable to internal form; see the discussion of the CONVERT phrase.
In output conversion, the value of a numeric data item is converted to a standardized format according to the output conversion rules for the DISPLAY statement:
With the exception of numeric edited data items, nonnumeric data items are not converted before they are displayed (that is, output conversion for nonnumeric data items is a null operation).
If identifier-1 is numeric edited and both the CONVERT and UPDATE phrases are specified, a numeric value for identifier-1 is determined according to the rules for the MOVE statement (MOVE numeric-edited TO numeric).That value is then converted to a standardized form according to the rules listed above.If identifier-1 is numeric edited, the UPDATE phrase is specified, and the CONVERT phrase is not specified, identifier-1 is treated as a nonnumeric data item and is not converted before display.
Note that output conversion affects only the appearance of the value in the screen field. The contents of identifier-1 are not changed by output conversion itself.
Output conversion in an ACCEPT statement is controlled by the UPDATE phrase.The UPDATE phrase also implies input conversion (see the discussion of the CONVERT phrase).Unlike the action of the CONVERT phrase in a DISPLAY statement, the CONVERT phrase in an ACCEPT statement does not control output conversion but instead affects input conversion.
ACCEPT Statement (Terminal I-O) 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.