Pathway/iTS TCP and Terminal Programming Guide

Programming for Intelligent Devices
Compaq NonStop™ Pathway/iTS TCP and Terminal Programming Guide426751-001
6-5
Processing Field Delimiters on Input
The message template declares that the associated message will contain a field delimiter
(a comma, by default) but no message delimiter.
Each field in the message template is fixed in length, to accommodate the maximum-
size data item, whereas the corresponding fields in working storage are variable in
length and rely on the content of an associated count field to determine their length.
Processing Field Delimiters on Input
When a message is received from a Message Section template MSG-FORMAT4, the
data for each field is stored in the working-storage item specified by the associated
USING clause, and a count of the actual number of characters received before
encountering the field delimiter is stored in the working-storage item specified by the
associated RESULTING COUNT clause.
For example, suppose that the incoming message is as follows:
JOHN DOE,MARIA GONZALES,WILLIAM DEFOE,TONY ALLEN,SUE QUICK,
and that it is received from the Message Section template MSG-FORMAT4:
SEND MESSAGE
YIELDS msg-format4
ON ERROR GO TO error-exit.
Upon successful completion of the SEND MESSAGE statement, the various working-
storage data items referred to by the MSG-FORMAT4 message-template declaration
contain the following data. (The apostrophes merely illustrate the beginning and ending
of each field; they do not actually occupy any space within the fields themselves.)
ws-item1-cnt '8'
ws-item1-data 'JOHN DOE'
ws-item2-cnt '14'
ws-item2-data 'MARIA GONZALES'
ws-item3-cnt '13'
ws-item3-data 'WILLIAM DEFOE'
ws-item4-cnt '10'
ws-item4-data 'TONY ALLEN'
ws-item5-cnt '9'
ws-item5-data 'SUE QUICK'
Using Field Delimiters on Output
When sending a message to the external device or front-end process by using a Message
Section template MSG-FORMAT4, you move the appropriate data values and the byte
counts into the working-storage structure and then issue a SEND MESSAGE statement
specifying the MSG-FORMAT4 template.