SEND TEXT
The SEND TEXT command is used to send unformatted text directly to a terminal screen. SEND TEXT can do the following things -
- If the text exceeds a line, SEND TEXT can split it up into multiple lines without splitting words.
- If the text exceeds a page, SEND TEXT can split into multiple pages according to the terminal size.
SEND TEXT sends text data without mapping. The very first byte of the screen is reserved. The first byte is used to place a blank or newline character. The data text starts from the screen's first row and second column.
If the data exceeds a page, then the ERASE option needs to be coded along with the SEND TEXT to clear the screen before the next SEND TEXT. Otherwise, the screen will not be cleared, and the data will be overwritten, which produces unpredictable results.
Single SEND TEXT command can send up to 4096 bytes of data stream in a single execution. If the data stream is greater than 4096 bytes, then multiple SEND TEXT commands are required to be coded to pass the data.
Purpose -
- Display unformatted, plain text messages or prompts to the user.
- Communicate system messages, error notifications, or simple responses to the terminal.
- Quick messaging without the need for predefined maps.
Syntax -
EXEC CICS
SEND TEXT
FROM (data-area)
LENGTH (data-area-length)
CURSOR(cursor-position)
ERASE
PRINT|FREEKB|ALARM
HEADER (header-data)
TRAILER (trailer-data)
JUSTIFY (position-value)
RESP(response-variable)
END-EXEC.
- FROM(data-area) - Optional. It contains the data to be passed to the screen.
- LENGTH (data-area-length) - Optional. It specifies the length of the data.
- CURSOR(cursor-position) - Optional. It specifies the cursor's position on the terminal after the data is displayed. If no value is coded, then the cursor will be positioned at the top left corner on the screen.
- ERASE - Optional. Clears the screen before displaying the text.
- RESP(response-variable) - Optional. It captures the response code of the SEND MAP operation and used to check if the command executed successfully or encountered an error.
- PRINT - Optional. This option specifies that text printing should be initiated at the printer.
- FREEKB - Optional. This option indicates that the keyboard should be unlocked after the data has been written. If the FREEKB option is not used, the keyboard will remain locked.
- ALARM - Optional. This option activates the audible alarm feature of the 3270.
- HEADER (header-data) - Specifies the header data to be placed at the beginning of each page of text data.
- TRAILER (trailer-data) - Specifies the text data area that contains trailer data to be placed at the bottom of each page.
- JUSTIFY (position-value) - Specifies the page line at which the text data is to be positioned. The data value must be a halfword binary value from 1 through 240.
Short Examples -
Scenario - Displaying a Static Welcome Message.
EXEC CICS SEND
TEXT('Welcome to the CICS.')
ERASE
FREEKB
RESP(RESP-CODE)
END-EXEC.
Explanation -
- TEXT: Displays a static message.
- ERASE: Clears the screen before displaying the message.
- FREEKB: Unlocks the keyboard for user input after the message is displayed.
- RESP: Captures the response code to handle errors if needed.
Error Conditions -
Eror Condition | RESP | RESP2 | Reason |
---|---|---|---|
INVREQ | 16 | RESP2 not set |
|
LENGERR | 22 | Occurs if an out-of-range value is supplied in the LENGTH option. | |
RETPAGE | 32 | Occurs if the SET option is specified and a completed page is ready for return to the application program. | |
TSIOERR | 35 | Occurs if there is an irrecoverable temporary storage input/output error. | |
IGREQID | 39 | Occurs if the prefix specified in the REQID option is different from that established by a previous REQID option. |