Pathway/iTS TCP and Terminal Programming Guide
Programming for Intelligent Devices
Compaq NonStop™ Pathway/iTS TCP and Terminal Programming Guide—426751-001
6-12
Using PRESENT IF Clauses
When it is time to gather all of the specified data values from their diverse locations in
working storage, convert them from alphabetic or numeric to alphanumeric format if
necessary, and store them in the proper order into the data structure
SERVER-RECORD-1, the requester can use a TRANSFORM statement such
as the following:
TRANSFORM data-fld-A, data-fld-H, data-fld-G,
data-record-2, data-fld-B, data-fld-F
YIELDS server-record-1
ON ERROR GO TO error-exit.
You can specify a mixture of 01-level, group, and elementary items in either the source
or target list of the TRANSFORM statement.
When the TRANSFORM statement is executed, the TCP uses the source list to construct
a buffer filled with alphanumeric, alphabetic, and numeric bytes. The TCP then
disperses the bytes from that buffer to the target data structure on a byte-for-byte basis,
converting the data as necessary. When the target list comprises working-storage items,
the total number of bytes in the source list must exactly match the total number of bytes
in the target list, or a run-time error occurs.
When moving bytes from the buffer to the target structure, all of the standard MOVE
statement rules apply, as described in the Compaq NonStop™ Pathway/iTS SCREEN
COBOL Reference Manual. For example, a byte that originates as part of a numeric
data item in the source list cannot be moved to an alphabetic data item in the target list;
it can, however, be moved to either a numeric or alphanumeric data item. The transfer
of data bytes from source to target data items in this particular example can be illustrated
as follows:
10 bytes DATA-FLD-A
6 bytes DATA-FLD-H SRVR-FLD-1 21 bytes
5 bytes DATA-FLD-G
SRVR-FLD-2 1 byte
3 bytes DATA-FLD-C SRVR-FLD-3 1 byte
SRVR-FLD-4 1 byte
5 bytes DATA-FLD-D SRVR-FLD-5 10 bytes
5 bytes DATA-FLD-E
10 bytes DATA-FLD-B
Using PRESENT IF Clauses
The SCREEN COBOL programming language PRESENT IF clause lets you declare
that certain fields in Message Section data structures are present only if a particular
preceding field is nonzero (if numeric) or nonblank (if nonnumeric).
The following sample code illustrates two ways that you might use this capability. In
the first example (which uses the Message Section template MSG-IN-FLAVOR1), the
presence of the alias address, city, state, and ZIP fields all depend on the presence of the
alias name field. In the second example (which uses the Message Section template