Pathway/iTS TCP and Terminal Programming Guide

Programming for Intelligent Devices
Compaq NonStop™ Pathway/iTS TCP and Terminal Programming Guide426751-001
6-3
Using Delimiters and the RESULTING COUNT
Clause
Using Delimiters and the RESULTING COUNT
Clause
Among the IDS extensions to the SCREEN COBOL programming language is one that
provides the ability to send and receive messages that contain message-delimiter and
field-delimiter characters.
The use of delimiters makes it possible for your requester and the external device or
front-end process to exchange compact variable-length messages efficiently.
The presence and use of delimiters is not an optional choice for you but rather
something that is dictated by the design characteristics of whatever entity your requester
is communicating with. When the external device or process uses a message delimiter,
your message template must also declare the same message delimiter. When the
external device or process uses a field delimiter, your message template must also
declare the same field delimiter.
Declaring Delimiters
You declare a message format to be delimited by including a MESSAGE FORMAT IS
DELIMITED clause or a MESSAGE FORMAT IS FIXED-DELIMITED clause at the
01 level of the particular message template in the Message Section. The only difference
between the two formats is that DELIMITED messages contain entirely variable-length
fields while FIXED-DELIMITED messages contain entirely fixed-length fields.
Having declared the message format to be delimited, you then declare (again at the 01
level):
1. Whether the message includes a message delimiter and, if so, what characters it
consists of (The default message delimiter is //.)
2. Whether the message includes field delimiters and, if so, what characters they
consist of (The default field delimiter is , [comma].)
Sample Declarations
In the examples that appear later in this section, assume that the following data
structures have been declared in the Working-Storage Section and the Message Section:
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-ITEM1.
05 WS-ITEM1-CNT PIC 9(2) COMP.
05 WS-ITEM1-GROUP.
10 WS-ITEM1-DATA PIC X(1)
OCCURS 1 TO 30 TIMES
DEPENDING ON ws-item1-cnt.