Copying files from Tapes to DASD

Copying files from Tapes to DASD The following article presents two methods of retrieving  A file can be saved on different volumes of tapes using the same name.  If we do not specify the volume then,it will get the file recently 

//STEP001  EXEC PGM=IDCAMS                           //INPUT    DD DSN=FILE.ON.TAPE,                      //OUTPUT   DD DSN=FILE.ON.DASD,                      //            DISP=(NEW,CATLG,DELETE),               //            DCB=(RECFM=FB,LRECL=200,BLKSIZE=0),    //            SPACE=(CYL,(500,500),RLSE)           REPRO INFILE(INPUT) OUTFILE(OUTPUT) –              

//COPY1    EXEC PGM=IEBGENER                                 //SYSUT1 DD DSN=FILE.ON.TAPE,                      //SYSUT2   DD DSN=FILE.ON.DASD,                      //         DISP=(NEW,CATLG,DELETE)                          

//STEP001  EXEC PGM=IDCAMS                                  //INPUT    DD DSN=FILE.ON.TAPE,DISP=OLD,       //OUTPUT   DD DSN=FILE.ON.DASD,          //            DISP=(NEW,CATLG,DELETE),               //            DCB=(RECFM=FB,LRECL=200,BLKSIZE=0),    //            SPACE=(CYL,(500,500),RLSE)           REPRO INFILE(INPUT) OUTFILE(OUTPUT) –              

//COPY1    EXEC PGM=IEBGENER                               //SYSUT1 DD DSN=FILE.ON.TAPE, //SYSUT2   DD DSN=FILE.ON.DASD,          //         DISP=(NEW,CATLG,DELETE),                       

Where VOL001 is the volume number of the dataset on tape. Note:- If you are using IDCAMS then you must specify the LRECL and RECFM otherwise  the JCL will fail with return code of 12, as it will not be able to open the new file. and when no volume is specified remember to give the disposition of tape file as OLD instead