TRANSFER Programming Manual
COBOL STRING and UNSTRING Operations
Designing and Writing a Client
069138, Update 1 to 040970 Tandem Computers Incorporated 9–15
You can use the working storage established for the initial transmission of some
UOWs to TISERV repeatedly in subsequent transmissions of the same UOW. This
is true, in particular, where the responses for some UOWs have the same format
and can thus be used as the requests. The READ-NEXT-MEMBER and READ-
NEXT-NAME UOWs fall into this category. Such UOWs also return parameters
properly for the next call, so you need not move data around when taking
advantage of this feature.
COBOL STRING and
UNSTRING Operations
If you are writing a program in COBOL that includes UOWs with variable-length
responses, you need to take special steps when using the STRING or UNSTRING
statements to manipulate the data returned. For example, consider the GET-ITEM-
REC UOW. In the response for this UOW, the RECS-RETURNED array can vary in
length, as indicated by the OCCURS-DEPENDING-ON clause appearing in the UOW
definition. The size of the RECS-RETURNED array depends on the value reflected in
the NUM-RETURNED field that precedes this array in the definition.
To manipulate the data returned in RECS-RETURNED using COBOL85, you would
take the following steps (shown with sample code):
1. In the File Section of the Data Division, specify that variable-length records will be
returned to your program:
FILE SECTION.
FD xfer-file
RECORD IS VARYING DEPENDING ON rec-size.
2. Next, define the IPC header for the request that will contain the GET-ITEM-REC
UOW. You may either copy this header into your program from the CGOB file
supplied on the TRANSFER distribution subvolume or use the IPC header
description in this manual to write the header yourself. A typical IPC header is
shown below:
01 ipc-hdr.
02 request-code NATIVE-2
02 pw-reply-code REDEFINES request-code NATIVE-2.
02 FILLER PIC X.
02 version-code.
03 letter PIC A.
03 rev-number PIC 99.
02 ipc-retn-code NATIVE-2.
02 ipc-retn-code-detail NATIVE-2.
02 session-id.
03 dummy PIC X(18).
02 uows-to-process NATIVE-2.
02 uows-returned NATIVE-2.
02 log-this-ipc PIC X.
02 FILLER PIC X.