Issuing requests from CL programs

This section provides you with CL examples to issue request commands.

<About CL Examples>

  • You will receive error codes that are assigned to &EXT. In CL examples, the variable &EXT is initialized using the spaces of 7 bytes followed by "0x00", before the issuance of each request command.

    = Remarks =

    When you receive error codes assigned to the CL variable, initialize the variable before you use it, as it is shown in the CL examples.

  • Concerning the examples in which "OUTPUT=" is specified for the PARM, the error messages are output to the file specified for MSG and the member specified for the MSG in the library specified for MYLIB. Refer to Error Codes and Messages for the details of error codes.

(1) Executing Send File Issuance command with file ID "TEST01"

START:PGM
DCL   &FILEID   TYPE(*CHAR)    LEN(11)
DCL   &EXT      TYPE(*CHAR)    LEN(8)
DCL   &NULL     TYPE(*CHAR)    LEN(1)         VALUE(X'00')

CHGVAR          VAR(&FILEID)   VALUE('F=TEST01' *CAT &NULL)
CHGVAR          VAR(&EXT)      VALUE('       ' *CAT &NULL)

CALL  PGM(HULFT/UTLSEND) +
PARM(&FILEID 'OUTPUT=MYLIB/MSG(MSG)' 'EXIT' &EXT)

SNDPGMMSG       MSG('EXIT=' *BCAT &EXT)      MSGTYPE(*COMP)
ENDPGM

(2) Issuing Resend File to the host "RS6000" with file ID "TEST01"

START:PGM
DCL   &FILEID   TYPE(*CHAR)    LEN(11)
DCL   &HOST     TYPE(*CHAR)    LEN(71)
DCL   &EXT      TYPE(*CHAR)    LEN(8)
DCL   &NULL     TYPE(*CHAR)    LEN(1)         VALUE(X'00')

CHGVAR          VAR(&FILEID)   VALUE('F=TEST01' *CAT &NULL)
CHGVAR          VAR(&HOST)     VALUE('R=RS6000' *CAT &NULL)
CHGVAR          VAR(&EXT)      VALUE('       ' *CAT &NULL)

CALL  PGM(HULFT/UTLSEND) +
PARM(&FILEID 'OUTPUT=MYLIB/MSG(MSG)' &HOST 'EXIT' &EXT)

SNDPGMMSG       MSG('EXIT=' *BCAT &EXT)      MSGTYPE(*COMP)
ENDPGM

(3) Issuing Send Request to the host "RS6000" with file ID "TEST01"

START:PGM
DCL   &FILEID   TYPE(*CHAR)    LEN(11)
DCL   &HOST     TYPE(*CHAR)    LEN(71)
DCL   &EXT      TYPE(*CHAR)    LEN(8)
DCL   &NULL     TYPE(*CHAR)    LEN(1)         VALUE(X'00')

CHGVAR          VAR(&FILEID)   VALUE('F=TEST01' *CAT &NULL)
CHGVAR          VAR(&HOST)     VALUE('H=RS6000' *CAT &NULL)
CHGVAR          VAR(&EXT)      VALUE('       ' *CAT &NULL)

CALL  PGM(HULFT/UTLRECV) +
PARM(&FILEID 'OUTPUT=MYLIB/MSG(MSG)' &HOST 'EXIT' &EXT)

SNDPGMMSG       MSG('EXIT=' *BCAT &EXT)      MSGTYPE(*COMP)
ENDPGM

(4) Issuing Resend Request to the host "RS6000" with file ID "TEST01"

START:PGM
DCL   &FILEID   TYPE(*CHAR)    LEN(11)
DCL   &HOST     TYPE(*CHAR)    LEN(71)
DCL   &EXT      TYPE(*CHAR)    LEN(8)
DCL   &NULL     TYPE(*CHAR)    LEN(1)         VALUE(X'00')

CHGVAR          VAR(&FILEID)   VALUE('F=TEST01' *CAT &NULL)
CHGVAR          VAR(&HOST)     VALUE('H=RS6000' *CAT &NULL)
CHGVAR          VAR(&EXT)      VALUE('       ' *CAT &NULL)

CALL  PGM(HULFT/UTLRECV) +
PARM(&FILEID 'OUTPUT=MYLIB/MSG(MSG)' &HOST 'R' 'EXIT' &EXT)

SNDPGMMSG       MSG('EXIT=' *BCAT &EXT)      MSGTYPE(*COMP)
ENDPGM

(5) Issuing Job Execution Result Notification to the host "RS6000" with job ID "JOB0001"

START:PGM
DCL   &HOST     TYPE(*CHAR)    LEN(71)
DCL   &JOB      TYPE(*CHAR)    LEN(11)
DCL   &MSG      TYPE(*CHAR)    LEN(53)
DCL   &RC       TYPE(*CHAR)    LEN(7)
DCL   &EXT      TYPE(*CHAR)    LEN(8)
DCL   &NULL     TYPE(*CHAR)    LEN(1)         VALUE(X'00')

CHGVAR          VAR(&JOB)      VALUE('J=JOB0001' *CAT &NULL)
CHGVAR          VAR(&HOST)     VALUE('H=RS6000' *CAT &NULL)
CHGVAR          VAR(&MSG)      VALUE('M=PERSONNEL INFORMATION' *CAT &NULL)
CHGVAR          VAR(&RC)       VALUE('R=0000' *CAT &NULL)
CHGVAR          VAR(&EXT)      VALUE('       ' *CAT &NULL)

CALL  PGM(HULFT/HULSNDRC) +
PARM(&HOST &JOB &MSG &RC 'EXIT' &EXT)

SNDPGMMSG       MSG('EXIT=' *BCAT &EXT)      MSGTYPE(*COMP)
ENDPGM

(6) Issuing Remote Job Execution to the host "RS6000" with job ID "JOB01"

START:PGM
DCL   &HOST     TYPE(*CHAR)    LEN(71)
DCL   &JOBID    TYPE(*CHAR)    LEN(11)
DCL   &EXT      TYPE(*CHAR)    LEN(8)
DCL   &NULL     TYPE(*CHAR)    LEN(1)        VALUE(X'00')

CHGVAR          VAR(&JOBID)    VALUE('J=JOB01' *CAT &NULL)
CHGVAR          VAR(&HOST)     VALUE('H=RS6000' *CAT &NULL)
CHGVAR          VAR(&EXT)      VALUE('       ' *CAT &NULL)

CALL  PGM(HULFT/UTLRJOB) +
PARM(&HOST &JOBID 'SYNC' 'EXIT' &EXT)

SNDPGMMSG       MSG('EXIT=' *BCAT &EXT)      MSGTYPE(*COMP)
ENDPGM

(7) Treminating the Send Acknowledge, Receive Acknowledge and Observe jobs

START:PGM
DCL   &EXT      TYPE(*CHAR)    LEN(8)
DCL   &NULL     TYPE(*CHAR)    LEN(1)        VALUE(X'00')

CHGVAR          VAR(&EXT)      VALUE('      ' *CAT &NULL)

CALL  PGM(HULFT/UTLKILLSND) +
PARM('OUTPUT=MYLLIB/MSG(MSG)' 'EXIT' &EXT)

CALL  PGM(HULFT/UTLKILLRCV) +
PARM('OUTPUT=MYLLIB/MSG(MSG)' 'EXIT' &EXT)

CALL  PGM(HULFT/UTLKILLOBS) +
PARM('OUTPUT=MYLLIB/MSG(MSG)' 'EXIT' &EXT)

SNDPGMMSG       MSG('EXIT=' *BCAT &EXT)      MSGTYPE(*COMP)
ENDPGM