KB Article #67864

CFTUTIL commands in batch mode

Problem

cftutil /  CL
-- example
How to run CFTUTIL commands in batch modes


Resolution

The execution of CFTUTIL in batch can be done via a CALL, according 3 alternative modes
       * CFTUTIL_QI, in a CL, by providing a DATA file
       * CFTUTIL_CD, in a CLP, followed by 2 (exactly) parameters (variable or fixed length chain)
       * CFTUTIL_MI, in a CLP, in order to provide a parameters file with many CFT commands .



Examples :



1) CL -> to execute aknowledgment procedure
CFTACQUIT :
//BCHJOB   JOB(CFTACQUIT)  JOBD(ALB241PROD/CFTJOBD1) JOBQ(*JOBD)
   /* -------------------------------------------------------------*/
   /* in RECEPTION :                                                    */
   /*set status  to A                                                        */  
   /*  Send   aknowledgment message to Sender  */
   /* --------------------------------------------------------------/



/* SET TO LINE of  COM1 File          */
  OVRDBF FILE(CFTCOM) TOFILE(ALB241PROD/COM1) LVLCHK(*NO)
CALL       PGM(CFTUTIL_QI) /* CALL CFTUTIL WITH INPUT FLOW QINLINE*/
//DATA     FILETYPE(*DATA)
 SEND TYPE=REPLY,PART=?PART, IDT=?IDT, IDM=&IDTU ,
              MSG="ENVOI ?IDT DU FICHIER ?NFNAME VERS AS400 : OK"
 ABOUT
//



(for a simple transfer, replace command in DATA by a classical SEND or RECV command)



2) CLP -> to start a transfer



        PGM  
/* To call CFTUTIL_CD you must respect the following rules :        */
/*    -  size of command    field up to   8                         */
/*    -  Size of parameters field up to 512                         */
/* All user strings must be in "upper case" !!!!!!!!!!!!!!!!!!!!!!! */



/* Command field */
            DCL        VAR(&CD) TYPE(*CHAR) LEN(8) VALUE('SEND    ')
/* Parameter field */
            DCL        VAR(&CD_PARMS) TYPE(*CHAR) LEN(512) +
            VALUE('PART=BOUCLE,IDF=TEST,FNAME=BIBALB/FIC1S(M1)')
/* MISE EN LIGNE DU FICHIER COM1          */
            OVRDBF FILE(CFTCOM) TOFILE(ALB241PROD/COM1) LVLCHK(*NO)
/* CFTUTIL command submit */
            CALL       PGM(CFTUTIL_CD)  PARM(&CD &CD_PARMS)
        ENDPGM



There is also information in CFT400 Exploitation guide ; and there are other samples in software itself (in files UTIN, CFTSRC, ...)