/*--------------------------------------------------------------------+ | Copyright (c) 1995, SAS Institute Inc. | | Unpublished - All Rights Reserved | | S A S / C S A M P L E | | | | NAME: JOBDDN | | LANGUAGE: C | | PURPOSE: Displays the Jobname/Stepname and all DDs associated | | with a job. In addition to the DDname, it also | | displays datasetname, lrecl, blksize, and recfm. | | MVS - | | COMPILE: Use JCL in prefix.SAMPLE.AUX(JOBDDN). | | LINK: Use JCL in prefix.SAMPLE.AUX(JOBDDN). | | Use JCL in prefix.SAMPLE.AUX(JOBDDN). | | INPUT: None | | OUTPUT: Jobname/Stepname and all DDnames allocated to current | | job. DDnames info include datasetname, lrecl, | | blksize, and recfm. | | TSO - N/A | | MVS - N/A | | | | MISC NOTES: The TIOT info is accessed directly from system | | control blocks. | | | | The tiotlist function will access the TIOT control | | block for each DD allocated to a job. The first | | invocation will return the Jobname and Step name as | | well as the first DD name. Subsequent invocations | | will return the next DD name allocated. | | RETURN VALUE: | | The tiotlist function returns a pointer to the TIOT | | structure. This structure was generated by the DSECT2C | | utility. A zero in the TIOELNGH field indicates that | | there are no more DD entries. | | CAUTIONS: | | If there are no allocated datasets the result is | | undefined. | | | | | | | +--------------------------------------------------------------------*/ #include #include #include #include "tiot.h" main() { int type = 0; char dsn(|46|), recfm, recfmf(|9|); int i, j, lrecl, blksize; struct TIOT *tiot=NULL; /*----------------------------------------------------------------+ | Search for all DD entries for this job. Then request info | | on each entry. | +----------------------------------------------------------------*/ for (i=0;;i++) { tiot = tiotlist(tiot, &type); if (tiot->TIOELNGH == 0) break; /* end of DD list */ /*-------------------------------------------------------------+ | on first call get job and step name | +-------------------------------------------------------------*/ if (i == 0) { printf("Job name=%-8.8s Step name=%-16.16s\n", tiot->TIOCNJOB, tiot->TIOCSTEP); printf("\n\nDDname Dataset name " " Lrecl Blksize Recfm\n"); } /*-------------------------------------------------------------+ | make sure entry is a valid DDname (ie: start with alpha) | +-------------------------------------------------------------*/ if (isalpha(*tiot->TIOEDDNM)) { /* valid name? */ /*----------------------------------------------------------+ | get info on ddname | +----------------------------------------------------------*/ osddinfo(tiot->TIOEDDNM, dsn, NULL, &recfm,&lrecl,&blksize); j = 0; strcpy(recfmf, " "); if ((recfm & RECFM_F) && (recfm & RECFM_V)) recfmf(|j++|) = 'U'; else if (recfm & RECFM_F) recfmf(|j++|) = 'F'; else if (recfm & RECFM_V) recfmf(|j++|) = 'V'; if (recfm & RECFM_B) recfmf(|j++|) = 'B'; if (recfm & RECFM_D) recfmf(|j++|) = 'D'; if (recfm & RECFM_T) recfmf(|j++|) = 'T'; if (recfm & RECFM_S) recfmf(|j++|) = 'S'; if (recfm & RECFM_A) recfmf(|j++|) = 'A'; if (recfm & RECFM_M) recfmf(|j++|) = 'M'; if (recfm == '\0') strcpy(recfmf, "unknown"); /*----------------------------------------------------------+ | print it. | +----------------------------------------------------------*/ printf("%-8.8s %-45.45s %10d %10d %-9.9s\n", tiot->TIOEDDNM, dsn, lrecl, blksize, recfmf); } } return(0); }