How to Create a VSAM file in Mainframe environment

In this blogpost I am going to explain about
1> How to Create VSAM file using IDCAMS Utility
2> How to load the flat file to VSAM file.


The following is a sample of the mainframe JCL needed to run on an IBM mainframe as an MVS batch job.
The Source code below works for how to create VSAM file and how to load it.


The JOB and DD statements will require modification prior to execution in different mainframe environments. Replace XXXX with your mainframe user id and give the correct program name.


//XXXX JOB (CS),'AIX  ',CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1),
//          NOTIFY=XXXX
//
//STEP001  EXEC PGM=IDCAMS,COND=(0,NE)
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
         DEF CL (NAME(XXXX.K030.YYYY) -
                 VOL(TST232)            -
                 UNIQUE                 -
                 KEYS(21 1)   -
                 RECORDS(100  100)-
                 SHR(2 3)        -
                 FREESPACE(2 1)     -
                 RECSZ(50 50)         -
                 INDEXED                -
                 CISZ(4096)) -
       DATA                             -
           (NAME(XXXX.K030.YYYY.DATA)-
                 KEYS (21 1)            -
                 RECSZ(50 50)         -
                 CISZ(7096)) -
       INDEX                            -
           (NAME(XXXX.K030.YYYY.INDEX))
         IF LASTCC = 0 THEN             -
         REPRO IDS(XXXX.F030.YYYY)   -
               ODS(XXXX.K030.YYYY)
         IF LASTCC = 0 THEN              -
           DEF AIX (NAME(XXXX.K999.YYYY.ALTX)-
               REL(XXXX.K030.YYYY)-
               KEYS(47 2) -
               RECSZ(100 100)           -
               SHR(2 3))                -
            DATA                        -
                 (NAME(XXXX.K999.YYYY.ALTX.DATA) -
               CYL(1   1)         -
               CISZ(4096)               -
               RECSZ(50 50))
         IF LASTCC = 0 THEN             -
           DEF PATH(NAME(XXXX.K999.YYYY.ALTX.PATH)-
               PENT(XXXX.K030.YYYY.ALTX))
         IF LASTCC = 0 THEN               -
           BIX IDS(XXXX.K030.YYYY)-
               ODS(XXXX.K999.YYYY.ALTX)
//*
/*
//STEP002  EXEC PGM=IDCAMS
//INFILE    DD DSN=XXXX.K030.YYYY,DISP=SHR
//OUFILE    DD DSN=XXXX.F030.YYYY,DISP=OLD
//SYSPRINT  DD SYSOUT=*
//SYSIN     DD *
  REPRO INFILE(INFILE) OUTFILE(OUFILE) COUNT(10)
/*
//

No comments:

Post a Comment