IKJEFT01 Utility


Introduction

IKJEFT01 is an IBM mainframe utility commonly used to execute TSO commands in a batch job. This utility allows users to perform TSO functions without being logged into a TSO session, which can be useful for automating tasks. The same utility is used to run the TSO/E commands is called Terminal Monitor Program (TMP). The terminal monitor program may be one of the following - IKJEFT01, IKJEFT1A, or IKJEFT1B. IKJEFT1A and IKJEFT1B are not utilities and are alternates (aliases) to IKJEFT01.

Submitting a batch job with the utility IKJEFT01 can execute the TSO commands. The EXEC format is -

//stepname EXEC PGM=IKJEFT01,DYNAMNBR=nn,PARM='command'

Functions -

IKJEFT01 performs the below functions –

  • Submit TSO commands.
  • BIND COBOL + DB2 program.
  • Runs COBOL + DB2 program.
  • Unload DB2 table.

Submit TSO Commands


IKJEFT01 is used to execute TSO commands via batch jobs. And also, REXX commands can be executed via batch Job.

Practical Example -

Scenario - JCL to execute the TSO command to delete the dataset using IKJEFT01 utility.

JCL -

----+----1---+---2---+---3---+----4---+---5---+
...
//STEP01   EXEC PGM=IKJEFT01,
//             DYNAMNBR=20,REGION=4096K
//STEPLIB  DD  DISP=SHR,DSN=DSNA10.DBAG.SDSNEXIT
//         DD  DISP=SHR,DSN=DSNA10.SDSNLOAD
//SYSTSIN  DD  *
    DEL 'MATEPK.TEST.PDS'
/*
...

BIND DB2 Program


The bind process builds a connection between an application program and its relational data(table data). The binding process is responsible for detecting errors and correcting them before the execution of the program.

The BIND command builds an access path for DB2 statements coded in an application program. This process is essential for preparing DB2 programs to be run. The BIND command converts the SQL statements in the program into an executable form that DB2 can process. COBOL + DB2 program should bound to either package or plan. IKJEFT01 utility is used to bound the DBRM to the package or plan.

BIND PLAN JCL -

Note! Below BIND PLAN JCL works as it is when you change your project-specific utility libraries and DBRM libraries.

BIND PLAN JCL Code -

----+----1----+----2----+----3----+----4----+----5----+
//MTH001B JOB MSGLEVEL=(1,1),NOTIFY=&SYSUID
//*************************************************
//*  DB2 BIND JCL
//*************************************************
//BIND     EXEC PGM=IKJEFT01
//STEPLIB  DD  DISP=SHR,DSN=MTHA10.DBAG.SDSNEXIT
//         DD  DISP=SHR,DSN=MTHA10.SDSNLOAD
//DBRMLIB  DD  DSN=MTH001.COBDB2.DBRMLIB,DISP=SHR
//SYSPRINT DD  SYSOUT=*
//SYSTSPRT DD  SYSOUT=*
//SYSUDUMP DD  SYSOUT=*
//SYSTSIN  DD  *
DSN SYSTEM (system-name)
BIND  PLAN      (plan-name)         -
      MEMBER    (program-name)      -
      ACTION    (action-options)    -
      ISOLATION (isolation-options) -
      VALIDATE  (validate-options)  -
      RELEASE   (release-options)   -
      EXPLAIN   (explain-options)   -
      OWNER     (owner-id)          -
      QUALIFIER (qualifier-name)    -
      ENCODING  (encoding-options)
END
/*
  • MEMBER (program-name) - MEMBER is the name of the DBRM member used for the application program in the DBRM library.
  • PACKAGE (package-name) - The package is a non-executable component and can contain one or more DBRMs.
  • PLAN (plan-name) - The plan is an executable component and used to execute the program.
  • ACTION (action-options) - The ACTION option defines whether the plan or package replaces an existing one with the same name or is new.
  • ISOLATION (isolation-options) - The ISOLATION option defines how far to isolate an application/application program from the effects of other running applications/application programs.
  • VALIDATE (validate-options) - VALIDATE option specifies that BIND or REBIND errors should revalidate while the program runs.
  • RELEASE (release-options) - The RELEASE option is used to decide when to release resources that are used by the program.
  • EXPLAIN (explain-options) - The EXPLAIN option is used to obtain information about how SQL statements are executed in the package or plan.
  • OWNER (owner-id) - The OWNER option specifies the owner authorization id of the plan or package.
  • QUALIFIER (qualifier-name) - The QUALIFIER specifies the implicit qualifier for the tables, views, indexes, and aliases in the plan or package.
  • LIB - LIB is the library that specifies the partitioned dataset where the DBRMs are stored.

Practical Example -

Scenario - Binds the COBOL + DB2 program (SELECT1) to the plan (MATEPKA) using isolation level CS.

Input required -

  • DBRMLIB - MATEPK.COBDB2.DBRMLIB
  • PLAN - MATEPKA

BIND JCL Code -

----+----1----+----2----+----3----+----4----+----5----+
...
//BIND     EXEC PGM=IKJEFT01
//STEPLIB  DD  DISP=SHR,DSN=DSNA10.DBAG.SDSNEXIT 
//         DD  DISP=SHR,DSN=DSNA10.SDSNLOAD
//DBRMLIB  DD  DSN=MATEPK.COBDB2.DBRMLIB,DISP=SHR
//SYSTSIN  DD  *
DSN SYSTEM (DBAG)
BIND  MEMBER    (SELECT1 ) -
      PLAN      (MATEPKA ) -
      ACTION    (REP)      -
      ISOLATION (CS)       -
      VALIDATE  (BIND)     -
      RELEASE   (COMMIT)   -
      OWNER     (MATEPK )  -
      QUALIFIER (MATEPK )  -
      ENCODING  (1047) 
END
/*
...

Run DB2 Program


IKJEFT01 utility is used to run the DB2 program. The program should have bound successfully to the DB2 plan in the system before executing the program.

Practical Example -

Scenario - JCL to execute program (SELECT1) using IKJEFT01 utility.

RUN JCL -

----+----1----+---2---+---3---+----4---+---5---+
...                                           
//STEP01   EXEC PGM=IKJEFT01,
//             DYNAMNBR=20,REGION=4096K
//STEPLIB  DD  DISP=SHR,DSN=DSNA10.DBAG.SDSNEXIT
//         DD  DISP=SHR,DSN=DSNA10.SDSNLOAD
//SYSTSIN  DD  *
  DSN SYSTEM (DBAG)
  RUN PROGRAM   (SELECT1)  -
      PLAN      (MATEPKA ) -
      LIBRARY   ('MATEPK.COBDB2.LOADLIB')
END
/*
...

Unload DB2 Tables


IKJEFT01 is used to unload the DB2 table from the database and creates a flat file with the data. It uses the DSNTIAUL program to unload data from DB2 tables into sequential data sets. The table data are not affected by the unload operation. DSNTIAUL uses SQL to access DB2.

Practical Example -

Scenario - JCL to unload the db2 table (EMPLOYEE) using IKJEFT01 utility.

JCL -

----+----1----+----2----+----3----+----4----+----5----+
...
//UNLOAD   EXEC PGM=IKJEFT01,DYNAMNBR=50
//STEPLIB  DD  DSN=DSNA10.DBAG.SDSNEXIT,DISP=SHR 
//         DD  DSN=DSNA10.SDSNLOAD,DISP=SHR
//SYSIN    DD  *
  SELECT * FROM EMPLOYEE WITH UR;
/*
//SYSTSIN  DD  *
DSN SYSTEM(DBAG)
RUN PROGRAM(DSNTIAUL) -
    PLAN(DSNTIB10) -
    LIB('DSNA10.DBAG.RUNLIB.LOAD') -
    PARMS('SQL')
END
/*
//SYSREC00 DD  DSN=MATEPK.EMPL.UNLOAD,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE)
//SYSPUNCH DD  DSN=MATEPK.EMPL.SYSPUNCH,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE)
...

Want to Learn More?


If you want to learn more about IKJEFT01 utility, go through the below topics explained with examples -