Copying MVS Datasets to Unix files

  • Post category:JCLUtilities
  • Reading time:1 mins read

Recently I had to get some people started with a few utilities. I thought to share this here. They will be in the next few posts for searchability reasons.

There are more ways to Rome, as we say here, so please feel free share you variants in a comment. (I unfortunately need manually curate comments to filter out the spam which is even with this small site overwhelming.)

//STEP1 EXEC PGM=IKJEFT01
//INMVS DD DSN=TEST.TRADMVS.DATA,
// DISP=SHR
//OUTFILE DD FILEDATA=TEXT,
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=SIRWXU,
// PATH='/mydir/myunixfile.txt’
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*//SYSTSIN DD *
 OCOPY IND(INMVS) OUTDD(OUTFILE)
//*

Here’s a link to the IBM documentation on OCOPY.

Change the volume of the entry for a dataset in a catalog

  • Post category:JCLUtilities
  • Reading time:1 mins read

When you have defined a dataset in the wrong catalog – in this case a master catalog – and you want to correct this you can use this technique.The DELETE NOSCRATCH option assures only the catalog entry is deleted. If you would omit this, the entire dataset would be deleted, so be cautious.

//DEFCAT   EXEC PGM=IDCAMS          
//STEPCAT DD DISP=SHR,DSN=SYS1.MSTRCTLG           
//SYSPRINT DD SYSOUT=*                          
//SYSIN    DD *                  
DELETE (SYS1.DATASET) NVSAM NOSCRATCH CAT(SYS1.MSTRCTLG)     
DEFINE NVSAM (NAME(SYS1.DATASET) DEVT(3390) VOL(VOL123)) - 
            CAT(SYS1.MSTRCTLG)   

//Pierre G

Copy members from one PDS(E) to another using the IEBCOPY utility

  • Post category:Utilities
  • Reading time:3 mins read

This JCL script shows how to copy members from one PDS library to another. 

I have retained the input file being tape in the original JCL script for nostalgic reasons only; you will unlike ever use this nowadays. As unlikely, you will be allocating the output dataset on a specific volume, so normally you could omit the VOL=SER= clause as well.

If you omit the S M= (SELECT MEMBER=) clauses, the entire content of the INDD input PDS will be copied to the OuTDD output PDS.

//STEP01   EXEC PGM=IEBCOPY                  
//SYSPRINT DD SYSOUT=*                        
//*INDOC     DD DISP=SHR,DSN=SYS1.ST006868.DOCLIB,LABEL=(06,SL),
//*         VOL=SER=R6868A,UNIT=CTAPE                    
//INDOC     DD DISP=SHR,DSN=YOUR.INPUT.LIBRARY
//OUTDOC     DD DISP=(NEW,CATLG,DELETE),DSN=YOUR.OUTPUT.PDSLIB, 
//         VOL=SER=DASD1A,UNIT=SYSDA,SPACE=(9600,(240,30,20))
//SYSIN    DD *                                    
COPY INDD=INDOC,OUTDD=OUTDOC                       
S M=MEMBER1                                         
S M=MEMBER2                                        
S M=OTHERMEM                                       
S M=MEM4          

THe IEBCOPY is a simple copy utility but it has many many options, of which you will only practically use a fraction. The application above I think is the one you will use in 99% of occasions. The DFDMDdfp Utilities manual sums all the options up.