KB Article #69304

How to change the return code of SWAITCAT - Synchronous transfer CLEARRC usage

Problem

It may be useful to change the return code of SWAITCAT in a synchronous transfer
The example provided here allows the change of the RC after a list of files has been sent and the SWAITCAT did exit with a RC not equal to zero because in that case the transfer 1st end in status K for the generic catalog entry (changed to T only after the status K has been detected by the SWAITCAT)


Resolution

The SWAITCAT command receives the K state and generates a return code different from zero.
The IF command, tests that return code and when not equal to zero, the return code is then cleared using the CLEARRC and the TEST command is executed.
This command read the CFT Catalog and search for the 1st matching record with the parameters/values provided.
The IDA has been set with a unique value (DATETIME) so only one record is selected.
If the state is "T", the return code of the test command will be equal to zero.



CONFIG TYPE=COM, MEDIACOM=TCPIP, FNAME=xhttp://server_address:server_port
/* Init internal variable date&time to initialize IDA parameter */
CHAR name=DATETIME, size = 16
_DatTim parm = DATETIME
/* ********************************************/
SEND PART=LIST_1, IDF=TEST, IDA="%DATETIME%"
SWAITCAT SELECT='IDTU=="%_CAT_IDTU%"'
IF NAME = _CMDRET, VALUE = 0, TYPE = NEQ
  CLEARRC
  TEST DIRECT=SEND, IDA="%DATETIME%"
ENDIF