TRANSFER Programming Manual
COBOL STRING and UNSTRING Operations
Designing and Writing a Client
069138, Update 1 to 040970 Tandem Computers Incorporated 9–17
02 num-returned NATIVE-2.
02 recs-returned OCCURS 0 TO 20 TIMES
DEPENDING ON
num- returned.
03 rec-type PIC 9(4) COMP.
03 rec-seq-num PIC 9(4) COMP.
03 data-len NATIVE-2.
03 data-string PIC X(80).
4. In the Procedure Division, after opening your file and performing other
preparatory operations, compute the sizes of the various fields to be returned by
TISERV. These include computations for the fixed-length fields, the variable-
length fields, and the IPC header. In these computations, you use the COBOL
STRING statement as noted below.
Fixed-length field:
MOVE 0 TO num-returned
MOVE 1 TO fixed-part-size
STRING get-item-rec-rsp DELIMITED BY SIZE INTO
temp-str
POINTER fixed-part-size
SUBTRACT 1 FROM fixed-part-size
Variable-length field:
MOVE 1 TO num-returned
MOVE 1 TO variable-part-size
STRING get-item-rec-rsp DELIMITED BY SIZE INTO
temp-str
POINTER variable-part-size
COMPUTE variable-part-size = variable-part-size -
fixed-part-size - 1
IPC header field:
MOVE 1 TO header-size
STRING ipc-hdr DELIMITED BY SIZE INTO temp-str
POINTER header-size
5. In this example, assume that you wish to transmit two GET-ITEM-REC UOWs in
your request to TISERV. Move the value 2 into the UOWS-TO-PROCESS field in
the IPC header and initialize the other fields in the header appropriately.
6. Next, set up the first UOW and move it to the buffer for transmittal. Next, do the
same for the second UOW .
ADD 1 TO header-size GIVING ptr
STRING get-item-rec-uow DELIMITED BY SIZE INTO
xfer-rec
POINTER ptr
STRING get-item-rec-uow DELIMITED BY SIZE INTO
xfer-rec
POINTER ptr