Wednesday, July 3, 2013

IBM UTILITY WITH EXAMPLES

IBM utility functions are those which are supplied with IBM mainframe operating systems  by IBM.
List of commonly used utilities
IDCAMS
IEBCOMPR
IEBCOPY
IEBDG
IEBEDIT
IEBGENER
IEBIMAGE
IEBISAM
IEBPTPCH
IEBUPDTE
IEFBR14
These UTILITIES are invoked via JCL. They use some common JCL DD identifier for their datasets.
Like:
SYSIN — input file for the 'commands' for the utility. Often set to DUMMY if the default action is desired.
SYSUT1 —>        input file.
SYSUT2 —>        output file.
SYSPRINT —>    output file for printed output from the utility.
SYSOUT — >      output file for messages from the utility.
SYSUDUMP —> output file if the program fails

UTILITY - IDCAMS:
 IDCAMS  is the Most versatile Utility. It can perfrom almost every function other utilities do.
IDCAMS ("Access Method Services") generates and modifies VSAM and Non-VSAM datasets.
Some of the functions which IDCAMS can do are
1. Create GDG   2.Create VSAM   3.Copy dataset  4.Delete Dataset   5.Check for empty file
6. Print Dataset.

" SYSPRINT is a mandatory JCL statement for IDCAMS "

CREATE A GDG USING IDCAMS
//STEP1    EXEC PGM=IDCAMS,TIME=4
//SYSDUMP  DD  SYSOUT=$
//SYSPRINT DD  SYSOUT=$
//SYSIN    DD  *
 DEFINE GDG -
        (NAME(TEST.OUTPUT.GDGBASE) -
        SCRATCH -
        LIMIT(03))
//*
Delete a Dataset USING IDCAMS

//STEP01 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SYSIN DD *
    DELETE TEST.SORT.OUTPUT
/*
//*
Check for Empty File using IDCAMS
//STEP02   EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INPUT    DD DSN=TEST.SORT.INPUT,DISP=SHR
//SYSIN    DD DATA
      PRINT INFILE(INPUT) COUNT(1)
/*
Return Code will be '0' if there is atleast 1 record in input file.  If no Records then RC will be '4'

Create Vsam File using IDCAMS
//STEP1   EXEC PGM=IDCAMS
// SYSPRINT  DD SYSOUT=*
// SYSIN     DD *
DELETEDA0001T.LIB.KSDS.CLUSTER
DEFINE    CLUSTER(
NAME(DA0001T.LIB.KSDS.CLUSTER)-          
INDEXED-
KEYS(4 0)-
FSPC(10 20)-
RECORDSIZE(125 125) -
RECORDS(100 10)    -
NONSPANNED-
VOLUMES (BS3013)-
NOREUSE-)-
DATA(NAME(DA0001T.LIB.KSDS.DATA)) INDEX(NAME(DA0001T.LIB.KSDS.INDEX))
/*
//
 REPRO USING IDCAMS

//STEP02   EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INPUT    DD DSN=TEST.SORT.INPUT,DISP=SHR
//OUTPUT   DD DSN=TEST.SORT.OPUT,DISP=MOD
//SYSIN    DD DATA
     REPRO INFILE(INPUT) OUTFILE(OUTPUT)
/*
//*  Using SKIP COUNT in REPRO

//SYSIN    DD DATA
     REPRO INFILE(INPUT) OUTFILE(OUTPUT) -
     SKIP(4) COUNT(2)
/*
UTILITY - IEFBR14 : UTILITY TO CREATE DATASET

//STEP2  EXEC PGM=IEFBR14
//MODEL1 DD   DSN=TEST.OUTPUT.B14TEST,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(TRK,(100,100),RLSE),
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=800)

UTILITY - IEBCOPY
//STEP001U EXEC PGM=IEBCOPY
//MYDD     DD DSN=TEST.INPUT,DISP=SHR
//CPYDD    DD DSN=TEST.OUTPUT,DISP=SHR
//SYSUDUMP DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN  DD *
    COPY INDD=((MYDD,R)),OUTDD=CPYDD
    SELECT MEMBER=REPORT
/*
It will copy from TEST.INPUT  to TEST.OUTPUT.  If the member REPORT exists in Output, it will be replaced.
Without Replace Option.
//SYSIN  DD *
    COPY INDD=MYDD,OUTDD=CPYDD
    SELECT MEMBER=REPORT
/*

UTILITY - IEBGENER(COPY FROM TAPE TO DISK)

//STEP1    EXEC PGM=IEBGENER
//SYSUT1    DD DSN=TAPE.DATASET.LOAD,DISP=SHR
//SYSUT2    DD DSN=TEST.DISK.DATASET,
//            DISP=(,CATLG,KEEP),
//            DCB=*.SYSUT1,
//            SPACE=(CYL,(900,900,0),RLSE),
//            UNIT=(DISK,10)
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *


UTILITY - IEBGENER (TO MERGE FILES) 

//STEP02   EXEC PGM=IEBGENER

//SYSOUT   DD SYSOUT=*


//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSN=TEST.SORT.MERGE1,DISP=SHR
//         DD DSN=TEST.SORT.MERGE2,DISP=SHR
//SYSUT2   DD DSN=TEST.SORT.OUTPUNT,
//            DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
//            SPACE=(TRK,(350,200),RLSE


Features of a Tape dataset using IDCAMS.
Using LISTCAT Command

//STEP01 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SYSIN DD *
    LISTCAT ENTRIES(data-set name) ALL
/*
//*

 

No comments:

Post a Comment