SEND Statement COBOL

The SEND statement causes a message, a message segment, or a portion of a message or segment to be released to one or more output queues maintained by the Message Control System (MCS).

Format 1:Send (Simple)

Send (Simple)

Format 2:Send (Advancing/Replacing)

Send (Advancing/Replacing)

cd-name-1 must reference an output CD or an input-output CD.

identifier-2 must reference a one-character integer without an operational sign.

When identifier-3 is used in the ADVANCING phrase, it must be the name of an elementary integer item.

When the mnemonic-name phrase is used, the name must be identified with a feature-name that is a channel-name.See the syntax and rules for mnemonic-name-2.

integer-1 or the value of the data item referenced by identifier-3 may be zero.

General Rules

The following general rules apply to both formats of the SEND statement:

  1. When a receiving communication device (printer, display screen, card punch, and so forth) is oriented to a fixed line size:
    • Each message or message segment begins at the leftmost character position of the physical line.
    • A message or message segment that is smaller than the physical line size is released so as to appear space-filled to the right.
    • Excess characters of a message or message segment are not truncated. Characters are packed to a size equal to that of the physical line and then output to the device.The process continues on the next line with the excess characters.
  2. When a receiving communication device (paper tape punch, another computer, and so forth) is oriented to handle variable-length messages, each message or message segment begins on the next available character position of the communication device.
  3. As part of the execution of a SEND statement, the MCS interprets the content of the text length data item of the area referenced by cd-name-1 to be the user’s indication of the number of leftmost character positions of the data item referenced by identifier-1 from which data is to be transferred.
  4. If the content of the text length data item of the area referenced by cd-name-1 is zero, no characters of the data item referenced by identifier-1 are transferred.

    If the content of the text length data item of the area referenced by cd-name-1 is outside the range of zero through the size of the data item referenced by identifier-1 inclusive, an error is indicated by the value of the status key data item of the area referenced by cd-name-1, and no data is transferred.

  5. As part of the execution of a SEND statement, the content of the status key data item of the area referenced by cd-name-1 is updated by the MCS.
  6. The effect of having special control characters within the contents of the data item referenced by identifier-1 is undefined.
  7. A single execution of a SEND statement represented by Format 1 releases only a single portion of a message segment or a single portion of a message to the MCS.A single execution of a SEND statement represented by Format 2 never releases to the MCS more than a single message or a single message segment as indicated by the content of the data item referenced by identifier-2 or by the specified indicator ESI, EMI or EGI.
  8. However, the MCS does not transmit any portion of a message to a communication device until the entire message has been released to the MCS.

  9. During the execution of the run unit, the disposition of a portion of a message which is not terminated by an EMI or EGI or which has not been eliminated by the execution of a PURGE statement is undefined.
  10. However, the message does not logically exist for the MCS and hence cannot be sent to a destination.

  11. Once the execution of a SEND statement has released a portion of a message to the MCS, only subsequent executions of SEND statements in the same run unit can cause the remaining portion of the message to be released.
  12. For Format 2:

  13. The content of the data item referenced by identifier-2 indicates that the content of the data item referenced by identifier-1, when specified, is to have an associated end of segment indicator, end of message indicator, end of group indicator or no indicator (which implies a portion of a message or a portion of a segment).If identifier-1 is not specified, only the indicator is transmitted to the MCS.
  14. Any character other than ‘1’, ‘2’ or ‘3’ is interpreted as ‘0’.

    If the content of the data item referenced by identifier-2 is other than ‘1’, ‘2’ or ‘3’, and identifier-1 is not specified, an error is indicated by the value in the data item referenced by data-name-3 (STATUS KEY) of the area referenced by cd-name-1, and no data is transferred.

    Data Item Contents

    Data Item Contents

  15. The WITH EGI phrase indicates to the MCS that the group of messages is complete. The WITH EMI phrase indicates to the MCS that the message is complete. The WITH ESI phrase indicates to the MCS that the message segment is complete. The MCS recognizes these indications and uses them to maintain segment, message and group control.
  16. The hierarchy of ending indicators is EGI, EMI and ESI. An EGI need not be preceded by ESI or EMI.An EMI need not be preceded by an ESI.

ADVANCING Phrase

ADVANCING Phrase

The ADVANCING phrase allows control of the vertical positioning of each message or message segment on a communication device where vertical positioning is applicable. If vertical positioning is not applicable on the device, the ADVANCING phrase is ignored.

If identifier-2 is specified and the content of the data item referenced by identifier-2 is zero, the ADVANCING phrase is ignored.

On a device where vertical positioning is applicable and the ADVANCING phrase is not specified, the default advance is one line.

If vertical positioning is applicable, the following rules apply to the ADVANCING phrase:

  1. If identifier-3 or integer-1 is specified, characters transmitted to the communication device are repositioned vertically downward the number of lines equal to the value associated with the data item referenced by identifier-3 or integer-1.
  2. If mnemonic-name-2 is specified, characters transmitted to the communication device are positioned downward to the next occurrence of the channel indicator for the channel number associated with mnemonic-name-2.If the communication device does not support channel skipping, advancing defaults to ADVANCING 1 LINE.
  3. If the BEFORE phrase is used, the message or message segment is represented on the communication device before vertical repositioning.
  4. If the AFTER phrase is used, the message or message segment is represented on the communication device after vertical repositioning.
  5. If PAGE is specified, characters transmitted to the communication device are represented before or after (depending on the phrase used) the device is repositioned to the next page.If PAGE is specified but has no meaning with a specific device, advancing defaults to ADVANCING 1 LINE.
  6. When the receiving communication device is a character imaging device on which it is possible to present more than one character at the same position, and the device permits the choice of either the second or subsequent characters appearing superimposed on characters already displayed at that position or each character appearing in place of the characters previously transmitted to that line, then:
    • If the REPLACING phrase is specified, the characters transmitted by the SEND statement replace all characters that may have previously been transmitted to the same line beginning with the leftmost character position of the line.
    • If the REPLACING phrase is not specified, the characters transmitted by the SEND statement appear superimposed upon the characters that may have previously been transmitted to the same line beginning with the leftmost character position of the line.
  7. When the receiving communication device does not support the replacement of characters, regardless of whether the REPLACING phrase is specified, the characters transmitted by the SEND statement appear superimposed upon the characters that may have previously been transmitted to the same line, beginning with the leftmost character position of the line.
  8. When the receiving communication device does not support the superimposition of more than one character at the same position, regardless of whether the REPLACING phrase is specified, the characters transmitted by the SEND statement replace all characters that may have previously been transmitted to the same line, beginning with the leftmost character position of the line.

SEND Statement Examples



Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

COBOL Topics