Pathway/iTS TCP and Terminal Programming Guide
Programming for Intelligent Devices
Compaq NonStop™ Pathway/iTS TCP and Terminal Programming Guide—426751-001
6-6
Using Message Delimiters
For example, suppose you want to send the following message to the external device or 
process:
BILL WINN,GIUSEPPE PINELLI,JOE BLOW,LING CHIN,SARAH HARRAH,
To do so, you would move the following values to the specified working-storage 
locations:
'BILL WINN' ws-item1-data
'9' ws-item1-cnt
'GIUSEPPE PINELLI' ws-item2-data
'16' ws-item2-cnt
'JOE BLOW' ws-item3-data
'8' ws-item3-cnt
'LING CHIN' ws-item4-data
'9' ws-item4-cnt
'SARAH HARRAH' ws-item5-data
'12' ws-item5-cnt
and then issue a SEND MESSAGE statement such as:
SEND MESSAGE msg-format4
 ON ERROR GO TO error-exit.
Before moving a data element from working storage to its output buffer, the TCP 
examines the location referenced by the associated RESULTING COUNT clause to find 
out how many bytes of data the field actually contains.  After retrieving the specified 
number of bytes from the particular working-storage location, the TCP appends a field-
delimiter character (in this case, a comma) to the end of the outbound field.
Thus, you can directly control the placement of field delimiters in the output stream.
Using Message Delimiters
The use of a RESULTING COUNT clause at the message level allows you to determine, 
on input, how long an incoming variable-length record was, without having to do a 
backward search through your working-storage data structure.
If the external device or process requires the message to include a message delimiter, 
you must declare the message delimiter in your message template; otherwise, the TCP 
mistakes the message-delimiter characters for actual data.
For example, if the external device or process requires that each message be terminated 
by a colon (:), you must change the beginning of the preceding sample message template 
declaration to the following:
01 msg-format4
 MESSAGE IS DELIMITED
 MESSAGE DELIMITER IS ":".










