Most COBOL + DB2 batch jobs do not call Db2 by magic. They run under the TSO Terminal Monitor Program IKJEFT01, start the DSN command processor with DSN SYSTEM(ssid), then RUN the program or BIND a package. This page shows the JCL skeleton, every important DD name, how SYSTSIN differs from SYSIN, and how DB2I / SPUFI relate to the same processor.
IKJEFT01 is the TSO/E Terminal Monitor Program. Foreground, you log on to TSO and type commands. Background, JCL EXEC PGM=IKJEFT01 and the commands come from SYSTSIN. That is how shops run BIND, DSNTEP2, and COBOL programs that use the TSO attachment facility—without a human at a terminal.
Related entry points: IKJEFT1A and IKJEFT1B are also TMP aliases. They differ in whether a failing command abends the step or only sets a return code. IBM Db2 samples typically show IKJEFT01. Use DYNAMNBR (IBM examples often use 20) so DSN can dynamically allocate DBRM libraries, load libraries, and SYSPRINT-type files.
Db2 batch execution of an application is almost always: TMP → DSN → RUN PROGRAM. The program uses the TSO attach to talk to Db2. CAF and RRSAF programs can EXEC the application module directly without DSN; that is a different pattern (IMS/CICS batch connections, or a CAF stub). This page stays on the IKJEFT01 + DSN pattern beginners meet first.
DSN is a TSO command. It starts a session attached to one Db2 subsystem. Until you type END, further lines are DSN subcommands or hyphenated operator commands—not raw TSO.
| Command | Meaning |
|---|---|
| DSN SYSTEM(ssid) | Start session; attach to subsystem or group name |
| RUN PROGRAM(name) PLAN(plan) LIB(dsn) | Run a Db2 application (TSO attach) |
| BIND PACKAGE / BIND PLAN | Bind DBRMs or copy packages into a plan |
| DCLGEN | Generate host structures from a table |
| -DISPLAY THREAD | Hyphen operator command (not START DB2) |
| END | Leave DSN; return to TSO or end the batch commands |
DSN SYSTEM(ssid) names the Db2 subsystem, a data sharing group attachment name, or a subgroup attachment. If you omit SYSTEM, the install default (often DSN) is used—which is wrong on a machine with DB2T and DB2P. Always code the ssid your job is meant to hit.
Optional DSN operands you will see in production:
You can issue Db2 commands that start with a hyphen (-DISPLAY THREAD, -STOP DATABASE) from the session. You cannot issue -START DB2 from DSN: the session already requires Db2 to be the attach target. Keep DSN job steps short. If the application abends or returns non-zero, DSN typically terminates.
| DD name | Role |
|---|---|
| SYSTSIN | Input: DSN, RUN, BIND, END (TSO command stream) |
| SYSTSPRT | TSO/DSN session print (prompt, messages, return codes) |
| SYSPRINT | Application or precompiler listing (DSNTEP2, DCLGEN, compilers) |
| SYSUDUMP | SYSUDUMP dump if the program abends; allocate SYSOUT=* |
| SYSIN | Not read by IKJEFT01 itself; DSNTEP2/DSNTIAUL SQL or data after RUN |
| STEPLIB | SDSNEXIT, SDSNLOAD, then application LOADLIBs |
| DBRMLIB | BIND PACKAGE/PLAN member search (if not using LIB on BIND) |
Beginners mix SYSIN and SYSTSIN constantly.
Online utilities do the opposite: DSNUTILB reads utility statements from SYSIN and writes messages to SYSPRINT. There is no DSN prompt. Putting BIND PLAN in DSNUTILB SYSIN fails; putting COPY TABLESPACE in SYSTSIN fails.
The DSN processor and TSO attach modules live in prefix.SDSNLOAD. The customized application defaults module (DSNHDECP or your shop’s name) and many exits live in prefix.SDSNEXIT. Concatenate EXIT before LOAD so the right DECP is found. Both libraries must be APF-authorized for attach. The maintenance level must match the running subsystem or you get module mismatch errors.
123456789101112//GO EXEC PGM=IKJEFT01,DYNAMNBR=20 //STEPLIB DD DISP=SHR,DSN=DSN.DB2T.SDSNEXIT // DD DISP=SHR,DSN=DSN.DB2T.SDSNLOAD // DD DISP=SHR,DSN=HR.LOADLIB //SYSTSPRT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSTSIN DD * DSN SYSTEM(DB2T) RETRY(5) RUN PROGRAM(PAYROLL) PLAN(PAYPLAN) LIB('HR.LOADLIB') END /*
JOB USER= on the JOB card often becomes the Db2 primary authorization ID for the TSO attach. RACF, GRANT EXECUTE on the plan, and the package owner must all line up or you see SQLCODE -922 / plan-not-found errors that look like JCL problems.
DB2I (Db2 Interactive) is the ISPF panel set: SPUFI, DCLGEN, Program Preparation, Bind, Utilities, Commands, Defaults. Under the covers, many of those panels build the same DSN commands you put in SYSTSIN. The Defaults panel SSID is SYSTEM(). AS USER is ASUSER().
SPUFI (SQL Processor Using File Input) lets you edit an SQL file and execute it, with output to another file. It is a DSN/TSO tool, not DSNUTILB. Batch equivalent: IKJEFT01 + RUN PROGRAM(DSNTEP2) + SQL in SYSIN. Use SPUFI for ad-hoc SELECTs; use DSNTEP2 when the same SQL must run overnight; use UNLOAD/LOAD when the volume is a table space, not a query.
The DB2I Utilities option is different: it generates DSNUTILB JCL (or submits a utility job). That job will not contain IKJEFT01. Knowing which panel produces which program saves hours of “why is SYSTSIN ignored?”
123456789101112//BIND EXEC PGM=IKJEFT01,DYNAMNBR=20 //STEPLIB DD DISP=SHR,DSN=DSN.DB2T.SDSNEXIT // DD DISP=SHR,DSN=DSN.DB2T.SDSNLOAD //DBRMLIB DD DISP=SHR,DSN=HR.DBRMLIB //SYSTSPRT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSTSIN DD * DSN SYSTEM(DB2T) BIND PACKAGE(HR) MEMBER(PAYROLL) - ACTION(REPLACE) ISOLATION(CS) VALIDATE(BIND) END /*
IKJEFT01 is a robot that types TSO commands when nobody is at the keyboard. DSN is the doorbell for the Db2 house: SYSTEM(DB2T) picks which house. Inside, you can BIND (file the lesson plan), RUN (send a kid in to do homework), or ask “who is in the hallway?” (-DISPLAY). END walks back outside. SYSTSIN is the robot’s instruction card. SYSTSPRT is the robot’s diary. SYSIN is a different notebook that only the kid (DSNTEP2) reads. SDSNLOAD is the toolbox; SDSNEXIT is the labeled wrench set for this house. DB2I is the same doorbell with pretty ISPF buttons. The loading dock for COPY and LOAD is a different building called DSNUTILB—do not hand the robot a forklift work order.
1. What is IKJEFT01?
2. DSN SYSTEM(DB2T) does what?
3. SYSTSIN versus SYSIN in a Db2 batch job:
4. Which libraries belong on STEPLIB for a DSN batch step?
5. DB2I and SPUFI relate to IKJEFT01 how?