Pathway/iTS SCREEN COBOL Reference Manual (G06.24+, H06.03+, Pathway/iTS 1.0+)
Data Division
Compaq NonStop™ Pathway/iTS SCREEN COBOL Reference Manual—426750-001
5-89
Clauses in Message Description Entry
On output, the RESULTING COUNT clause combined with the field delimiter permits
the length of each field to be equal to or less than the declared field length. A field of
RESULTING COUNT length terminated by a field delimiter is created, unless field
delimiting has been disabled. When formatting a message of DELIMITED format for
output to the device, you can control the length of the overall message by using the
RESULTING COUNT clause on a field-by-field basis.
You do not reserve a position for the field delimiter in the Message Section description
for the delimited field.
On output of a delimited field, the TCP assembles the field by taking the number of
bytes specified by the RESULTING COUNT length from the Working-Storage
FROM/USING field and placing those bytes into the message. The TCP will then
append the field delimiter, if any, to the field. If the RESULTING COUNT length is 0,
only the field delimiter will be output in the message. If the RESULTING COUNT
length exceeds the maximum number of bytes defined for the field, an ON ERROR
clause will be executed.
Minimum occurrence detection is not enforced. That is, if x > 0 and the delimiter is
found before enough data items are processed to satisfy x, an error will not be generated.
Resulting Count With Message Delimiter
For input, the RESULTING COUNT clause combined with the MESSAGE-
DELIMITER clause allows you to determine the length of a variable-length message.
This is for information only; it does not control the length of the message.
For input, the RESULTING COUNT length at the message level includes the field
delimiters.
For output, the only time you can use the RESULTING COUNT clause on the message
level is to send a one-field message. With a one-field message, the RESULTING
COUNT clause allows you to send a message that is the actual length of the data and
remove any padding characters. To output multifield messages, use the RESULTING
COUNT clause on each field of the message. This causes the message to be compacted
on a field-by-field basis.
Example of Resulting Count on Field Level
Assume that an input data stream consists of from 1 to 101 characters. The last
character in the field is a semicolon (;) and acts as a field delimiter. There is, therefore,
a maximum of 100 data characters plus one delimiting character.
The following code segment shows the flow of the data on an input operation.
WORKING-STORAGE SECTION.
01 WS-Name-Record.
05 WS-Name-Length PIC 9(4) COMP.
05 WS-Name PIC X(1)
OCCURS 1 TO 100 TIMES
DEPENDING ON WS-Name-Length.