A terminal I-O DISPLAY statement causes individual data items to be displayed on the terminal screen. DISPLAY statement phrases allow the specification of the position, form, and format of the displayed data.
Format 2:Display Terminal I-O
The DISPLAY statement transfers the contents of each sending operand, identifier-1 or literal-1 to the terminal screen in the order listed.
If a figurative constant is specified as one of the sending operands, only a single occurrence of the figurative constant is displayed, except as specified in the rules for the SIZE phrase.
identifier-2, identifier-3, identifier-5 and identifier-6 must be described as integer numeric data items. literal-2, literal-3, literal-5 and literal-6 must be nonnegative integer numeric literals.
identifier-4 must be a nonnumeric data item. literal-4 must be a nonnumeric literal.
Several terms are used to describe the detailed function of each phrase in a Format 2 DISPLAY statement:
DISPLAY Statement Phrases and Output and Screen Fields
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. Any features that are not supported compile correctly but are 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, BLINK, REVERSE, ERASE EOL and ERASE EOS phrases).It is the programmer’s responsibility to allow for attribute characters by not juxtaposing fields that may require them.
The phrases following a sending operand apply only to that operand. When the DISPLAY statement contains multiple sending operands and any of the phrases are omitted for a particular operand, the defaults described below for that phrase are applied to that operand.
BELL is a synonym for BEEP.
The presence of the BEEP phrase in a DISPLAY statement causes the audio alarm signal to occur prior to the display of the data. If the BEEP phrase is omitted, no signal is given.
The presence of the BLINK phrase causes the 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-4 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 sending item. Keywords may be specified in any order. Keywords, which specify options that do not apply to the statement, are ignored.
The keywords that affect a DISPLAY statement are BEEP, BLINK, CONVERT, ERASE, ERASE EOL, ERASE EOS, HIGH, LOW, NO BEEP, NO BLINK, NO CONVERT, NO ERASE, NO REVERSE, NO UNDERLINE, REVERSE and UNDERLINE. 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 DISPLAY statement, with the addition of the negative forms to allow suppression of statically declared options.The keyword UNDERLINE is an exception.It is not recognized as a static option, but it may be used in the value of the CONTROL phrase operand. When it is used, there it causes the field on the screen to be shown in underline 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 groupings are as follows:
The presence of the CONVERT phrase causes the contents of the sending item to be converted before being moved to the output field and displayed.
If the sending item is numeric or numeric edited and CONVERT is specified, the value of the sending item is converted from its internal form into display digits, which are moved to the output field with leading zero digits removed. The display digits are left justified in the output field, with a leading, separate minus sign provided if the value is negative and an explicit decimal point provided if the sending item is noninteger. The representation of this explicit decimal point is a period, except that, if the DECIMAL-POINT IS COMMA clause is specified in the source program, a comma is used instead. Unused character positions to the right of the converted number in the output field are space filled. If the SIZE phrase specifies a value too small for the converted number, the string resulting from the conversion is truncated on the right.
If the sending item is nonnumeric, or if the CONVERT phrase is not specified, the sending item is treated as an alphanumeric item and the contents of the sending item are moved to the output field according to the rules of a simple alphanumeric move (that is, left justified, with space fill to the right).
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 the screen field. When the ERASE phrase is not specified, no erasure occurs before displaying the data. The displayed data will replace any previous contents of the screen field and the remainder of the screen will be undisturbed.
HIGH and LOW Phrases
HIGHLIGHT is a synonym for HIGH.LOWLIGHT is a synonym for LOW. The presence of the HIGH or LOW phrase causes the data to be displayed at the specified intensity. When HIGH or LOW is not 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 DISPLAY 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 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 succeeding 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-5 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-3 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 2 DISPLAY statement; this value is also set to 1 if a UNIT phrase is specified for the same id entifier-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.
REVERSED and REVERSE-VIDEO are synonyms for REVERSE.
The presence of the REVERSE phrase causes the 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-6 or literal-6 in the SIZE phrase specifies the size of the screen field and the output field.
If the SIZE phrase is not present or a value of zero is specified, the size of identifier-1 or literal-1 is used.If identifier-1 or literal-1 is numeric or numeric edited and the CONVERT phrase is specified for the same
identifier-1 or literal-1, the size is considered to be the number of digits (9’s and P’s) defined in the PICTURE character- string or literal plus one if the item is signed and plus one if the item is noninteger.
If literal-1 is a figurative constant and the SIZE phrase is specified, then the figurative constant is repeated to match the specified size before being displayed.
The UNIT phrase, if specified, must be written first.The other phrases may be written in any order.
The value of identifier-2 or literal-2 in the UNIT phrase specifies the terminal upon which the data is to be displayed. 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 in its effect on the default value of the POSITION phrase (described previously). This situation will occur in all systems that do not allow the use of terminals other than the one associated with the rununit execution.
DISPLAY 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.