JCL for DB2 LOAD and UNLOAD Utilities

Here are sample JCL you need for DB2 Load and Unload utilities.

On this page

  1. DB2 UNLOAD JCL
  2. DB2 LOAD JCL

Sample DB2 UNLOAD JCL

//UNLOAD JOB (ACCOUNT),'NAME'
//*
//* THIS JCL HAS BEEN REWRITTEN IN ORDER
//* TO PROPERLY UNLOAD THE DATA FROM DB2 TABLES.
//* DSNTIAUL IS USED FOR UNLOAD INSTEAD OF DSNUPROC
//* UTILITY.
//* THEREFORE, PLEASE, NOTE THAT THIS IS ONLY
//* A SAMPLE THAT NEEDS TO BE PROPERLY CUSTOMIZED.
//* WARNINGS :
//* PLEASE CHECK PLAN NAME (NORMALLY DSNTIBVR),
//* V=DB2 VERSION, AND R=DB2 RELEASE;
//* TWO NEW DATASETS ARE DEFINED (SYSREC00 AND SYSPUNCH).
//* SYSPUNCH DATASET, IS CREATED AT UNLOAD STEP,
//* as USERID.SYSPUNCH (USERID.SYSPUNCH).
//* SYSREC00 DATASET IS SELECTED FROM the PREVIUOS PANEL.
//*
//* I M P O R T A N T :
//* CHECK THE DATA SET PARAMETER IF YOU HAVE CHOSEN
//* THE UNLOAD ON TAPE.
//*
//UNLOAD EXEC PGM=IKJEFT01,DYNAMNBR=20
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
DSN SYSTEM(DSN6)
RUN PROGRAM(DSNTIAUL) PLAN(DSNTIB71) -
PARMS('SQL') LIB('DSN710.RUNLIB.LOAD')
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSREC00 DD DSN=USERID.DAT.UNLOAD,
// UNIT=TAPE_UNIT,
// SPACE=(4096,(5040,504)),
// DISP=(,PASS),
// LABEL=(1,SL),
// DCB=(RECFM=FB,LRECL=410,BLKSIZE=27880),
// VOL=SER=TAPE_LABEL
//SYSPUNCH DD DSN=USERID.SYSPUNCH,
// UNIT=xxxx,
// VOL=SER=xxxxxx,
// SPACE=(4096,(5040,504)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920),
// DISP=(NEW,CATLG,CATLG)
//SYSIN DD *
SELECT * FROM USERDB.AVAILABILITY_D;

Sample DB2 LOAD Utility JCL

Below are the control statements for the Load utility. Data is loaded from tape into the AVAILABILITY_D table. The DDNAME for the SYSPUNCH data set is completed with the UNIT and VOLSER information about the Tape Unit used. The data set input from panel is SYSREC00.

//LOAD JOB (ACCOUNT),'NAME'
//*
//* THIS JCL HAS BEEN REWRITTEN IN ORDER
//* TO PROPERLY LOAD THE DATA FROM DB2 TABLES.
//* DSNTIAUL IS PREVIOUSLY USED FOR UNLOAD
//* INSTEAD OF DSNUPROC UTILITY.
//* THEREFORE, PLEASE, NOTE THAT THIS IS ONLY
//* A SAMPLE THAT NEEDS TO BE PROPERLY CUSTOMIZED.
//* WARNINGS :
//* PLEASE CHECK PLAN NAME (NORMALLY DSNTIBVR),
//* V=DB2 VERSION, AND R=DB2 RELEASE;
//* TWO NEW DATASETS ARE DEFINED (SYSREC00 AND SYSPUNCH).
//* as USERID.SYSPUNCH (USERID.SYSPUNCH).
//* SYSREC00 DATASET IS SELECTED FROM the PREVIUOS PANEL
//*
//*
//* I M P O R T A N T :
//* SYSPUNCH DATASET NEEDS TO BE EDITED FROM USER
//* BEFORE EXECUTING LOAD,
//* INSERTING "RESUME YES LOG YES" OPTIONS,
//* IN ORDER TO CONTAIN COMMAND :
//* "LOAD DATA RESUME YES LOG YES INDDN
//* SYSREC00 INTO TABLE tablename"
//* CHECK THE DATA SET PARAMETER IF YOU HAVE CHOSEN
//* THE LOAD FROM TAPE.
//*
//LOAD EXEC DSNUPROC,PARM='DSN6,MYUID'
//DSNTRACE DD SYSOUT=*
//SORTLIB DD DSN=SYS1.SORTLIB,DISP=SHR
//SORTWK01 DD UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND)
//SORTWK02 DD UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND)
//SORTWK03 DD UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND)
//SORTWK04 DD UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND)
//SORTOUT DD UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND)
//SYSREC00 DD DSN=USERID.DAT.UNLOAD,
// UNIT=TAPE_UNIT,VOL=SER=TAPE_LABEL,
// LABEL=(1,SL),
// DISP=SHR
//SYSUT1 DD UNIT=SYSDA,SPACE=(4000,(20,20),,,ROUND)
//SYSIN    DD DSN=USERID.SYSPUNCH,DISP=SHR

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.