DGADTDYN Sample Program Uses

The following examples demonstrate how you can use the functions of the DGADTDYN program.

Example 1: Locate and Allocate a Data Set

The following example calls the program DGADTDYN using the LOCATE parameter to determine if a cataloged file exists.

If the file does not exist, the program issues a nonzero return code and makes a call to allocate the file through the ALLOC parameter.

PROC1 PROCESS SNODE=BOSTON
LOCATE    RUN TASK(PGM=DGADTDYN -
          PARM=(C'LOCATE DSN=XYZ.CUSTOMER.FILE'))SNODE
     IF (LOCATE NE 0) THEN
ALLOC     RUN TASK (PGM=DGADTDYN -
          PARM=(C'ALLOC', -
          C' DSN=XYZ.CUSTOMER.FILE', -
          C' DISP=(NEW,CATLG)', -
          C' VOL=SER=DCM009', -
          C' SPACE=(CYL,(1,1))', -
          C' DSNTYPE=EXTPREF', -
          C' DCB=(RECFM=FB,DSORG=PS,LRECL=80,BLKSIZE=3120)', -
          C' UNIT=3380'))SNODE
      EIF

Example 2: Delete and Uncatalog a Data Set

The following example deletes and uncatalogs a data set.

The first function, ALLOC, allocates the data set specifying a current status of OLD and a secondary (or normal step completion) disposition of DELETE, which deletes the data set.

The second function, UNALLOC, unallocates the data set. Because of the disposition (the data set is originally allocated with disposition DELETE), the data set is uncataloged.

Use the F'-1' as a separator between allocation functions.

PROC2 PROCESS SNODE=BOSTON
DELETE RUN TASK(PGM = DGADTDYN -
    PARM = (C'ALLOC DSN=XYZ.TEMP DISP=(OLD,DELETE)' -
            F'-1' -
            C'UNALLOC DSN=XYZ.TEMP'))

Example 3: Allocate and Concatenate Data Sets

The following example calls the program to allocate each data set through the ALLOC parameter. Then it calls DGADTDYN again to do the concatenation through the CONCAT parameter. The data set is concatenated under the first DDNAME in the CONCAT list.

RTDYNCON PROCESS SNODE=BOSTON
ALLOC1 RUN TASK (PGM=DGADTDYN -
   PARM=(C'ALLOC DSN=XYZ.TEMP DISP=SHR DD=OLD1'))  PNODE
ALLOC2 RUN TASK (PGM=DGADTDYN -
   PARM=(C'ALLOC DSN=XYZ.TEMP2 DISP=SHR DD=OLD2')) PNODE
CONCAT RUN TASK (PGM=DGADTDYN -
   PARM=(C'CONCAT DD=(OLD1,OLD2)'))  PNODE

Example 4: Deconcatenate and Unallocate Data Sets

The following example calls the program to deconcatenate by DDNAME using the DECONCAT parameter. Then it calls DGADTDYN again to unallocate each data set in the concatenation with the UNALLOC command.

RTDYNCON PROCESS SNODE=BOSTON
DECONCAT RUN TASK (PGM=DGADTDYN -
     PARM=(C'DECONCAT DD=(OLD1)')) PNODE
UNALLO1 RUN TASK (PGM=DGADTDYN -
     PARM=(C'UNALLOC DD=OLD1')) PNODE
UNALLO2 RUN TASK (PGM=DGADTDYN -
     PARM=(C'UNALLOC DD=OLD2'))  PNODE