Martin Spence
Martin Spence

Reputation: 23

Delete a &&TEMP dataset in JCL

I have the following JCL:

//REGTEST3 JOB 00000000,'REG COPY CDB  ',MSGLEVEL=(1,1),
//             NOTIFY=&SYSUID,CLASS=I,MSGCLASS=X,REGION=1200M
/*JOBPARM S=ESYS
//PROCLIB JCLLIB ORDER=PWSX.KAMSP2T.PROCLIB
//****************************************************************
//*****    SETUP TEST RAPW, RAP2, RAXY, RASV IMS DATABASES
//****************************************************************
//RENAME   EXEC FINDREP,FIND=KAMSP2T,REPLACE=&SYSUID,
//         OUTFILE=&&TEMP01
//SORTUSER.SORTIN DD *

  DELETE KAMSP2T.#TEST2.RAPW0RDS PURGE
  DELETE KAMSP2T.#TEST2.RAPW1RDW PURGE
  DELETE KAMSP2T.#TEST2.RAPW2RDS PURGE
  DELETE KAMSP2T.#TEST2.RAXY0RDA PURGE
  DELETE KAMSP2T.#TEST2.RASV0RDA PURGE
/*
//DEL01   EXEC PGM=IEFBR14
//DELDD    DD DSN=&&TEMP01,
//         DISP=(MOD,DELETE,DELETE),
//         SPACE=(TRK,0)
//SYSPRINT DD SYSOUT=X

The PROC does this:
//FINDREP  PROC FIND=,
//         REPLACE=,
//         INPFILE=,
//         OUTFILE=
//**********************************************************************
//C1PARM01 EXEC PGM=PARMCOPY,
//             PARM='  SORT FIELDS=COPY'
//PARMFILE DD DSN=&&PARM,DISP=(NEW,PASS,DELETE),UNIT=DISK,
//         SPACE=(6233,(3),RLSE),DCB=(LRECL=80,BLKSIZE=1680,RECFM=FB)
//SYSPRINT DD   DUMMY
//**********************************************************************
//C1PARM02 EXEC PGM=PARMCOPY,
//             PARM=' OUTREC  FINDREP=(INOUT=(JP1,JP2))'
//PARMFILE DD DSN=&&PARM,DISP=(MOD,PASS,DELETE),UNIT=DISK,
//         SPACE=(6233,(3),RLSE),DCB=(LRECL=80,BLKSIZE=1680,RECFM=FB)
//SYSPRINT DD   DUMMY
//**********************************************************************
//SORTUSER EXEC PGM=SORT,PARM='JP1"&FIND",JP2"&REPLACE"'
//SORTLIB  DD   DSN=SYS1.SORTLIB,DISP=SHR
//SYSOUT   DD   SYSOUT=*
//SORTIN   DD  DISP=SHR,DSN=&INPFILE
//SORTOUT  DD  DSN=&OUTFILE,
//             DISP=(NEW,PASS),
//             DCB=(RECFM=FB,BLKSIZE=6240,LRECL=80),
//             UNIT=DISK,SPACE=(TRK,(1,1),RLSE)
//SORTWK01 DD   UNIT=SYSDA,SPACE=(32016,(428,1600))
//SORTWK02 DD   UNIT=SYSDA,SPACE=(32016,(428,1600))
//SORTWK03 DD   UNIT=SYSDA,SPACE=(32016,(428,1600))
//SORTWK04 DD   UNIT=SYSDA,SPACE=(32016,(428,1600))
//SORTWK05 DD   UNIT=SYSDA,SPACE=(32016,(428,1600))
//SYSIN    DD   DISP=(OLD,DELETE),DSN=&&PARM
//       PEND

However my issue is the &&TEMP01 dataset doesn't delete all the files listed in:

DELETE KAMSP2T.#TEST2.RAPW0RDS PURGE DELETE KAMSP2T.#TEST2.RAPW1RDW PURGE DELETE KAMSP2T.#TEST2.RAPW2RDS PURGE DELETE KAMSP2T.#TEST2.RAXY0RDA PURGE DELETE KAMSP2T.#TEST2.RASV0RDA PURGE

Is there any way I can delete these?

Grateful for any suggestions.

Thanks Martin

Upvotes: 1

Views: 2101

Answers (2)

wolfen244
wolfen244

Reputation: 11

This can also be done in SAS. Realize that in z/OS that UNIT is often defaulted to something like SYSDA and therefore is optional in most shops these days. SAS on the other hand will not allow a UNIT to be coded in this particular piece of code because of the MOD parameter. Also to SAS programmers, realize that this will work for even SAS libraries themselves because SAS is shifting access methods - from SAS's custom-designed EXCP to BSAM - and just like IEFBR14 that does "nothing", because it merely begins and branches to register 14 - finishes - whatever is requested in the disposition - in this case "delete" - will take place regardless of the access method that built that file.

filename dd1 'myid.x.saslib' disp=(mod,delete) space=(trk,0);
filename dd1 clear;

SAS programmers - realize also that this method of deleting a SAS library - as opposed to a SAS dataset that resides on a SAS library - is not in any SAS documentation. This is it!!

And then of course to allocate it inline then code this right afterward. Notice that anything larger than 300 for a secondary needs to have dsntype=large. And finally since this isn't using QSAM or BSAM but instead EXCP then the blocking factor should be consistent with the way SAS accesses data - by the page not the block. Notice also that similar to a TSO PDS, it isn't wise to code RLSE in the SPACE parameter.

libname dd1 'myid.x.saslib' disp=(,catlg,delete) space=(cyl,(50,500)) dsntype=large unit=(sysallda,59) blksize=6144;

Upvotes: 0

Bruce Martin
Bruce Martin

Reputation: 10553

IEFBR14 is a do nothing step (it stands for Branch R14 which in mainframe assembler is the standard program return. IEFBR14 does not do anthing

You could use IDCAMS like:

//DELETE   EXEC  PGM=IDCAMS
//SYSPRINT  DD   SYSOUT=*
//SYSIN     DD   *
   DELETE KAMSP2T.#TEST2.RAPW0RDS PURGE
   DELETE KAMSP2T.#TEST2.RAPW1RDW PURGE
   DELETE KAMSP2T.#TEST2.RAPW2RDS PURGE
   DELETE KAMSP2T.#TEST2.RAXY0RDA PURGE
   DELETE KAMSP2T.#TEST2.RASV0RDA PURGE
/*

in your case you might do

//DELETE   EXEC  PGM=IDCAMS
//SYSPRINT  DD   SYSOUT=*
//SYSIN     DD   DSN=&&TEMP01,DISP=SHR

a IEFBR14 delete is coded like

//DELETE EXEC PGM=IRFBR14
//DEL01   DD  DSN=KAMSP2T.#TEST2.RAPW0RDS,DISP=(MOD,DELETE),
//            SPACE=(TRK,(1,1))
//DEL02   DD  DSN=KAMSP2T.#TEST2.RAPW1RDW,DISP=(MOD,DELETE),
//            SPACE=(TRK,(1,1)) 
//DEL04   DD  DSN=KAMSP2T.#TEST2.RAXY0RDA,DISP=(MOD,DELETE),
//            SPACE=(TRK,(1,1))
//DEL05   DD  DSN=KAMSP2T.#TEST2.RASV0RDA,DISP=(MOD,DELETE),
//            SPACE=(TRK,(1,1))  

Traditionally IDCAMS was more flexible than IEFBR14 deletes

Upvotes: 2

Related Questions