BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sayanapex06
Obsidian | Level 7

Hi,

 

I have a following a jcl step and I know it is not a jcl forum, but I would be highly oblidged to get a help...

 

//STEP102  EXEC  PGM=IDCAMS                                         
//SYSPRINT DD  DSN=CHMICST.LISTCAT3,DISP=SHR                        
//SYSIN    DD  *                                                    
   LISTCAT LVL('EDIB88T.NTRCS1T.D102916.T*.M*.ENTC')ALL             
/* 

 

Is there any other way other than to hardcode the date 'D102916' cause its a dynamic name. SO i want to get another way to give the name instead of hard coding it.                                                          

1 ACCEPTED SOLUTION

Accepted Solutions
sayanapex06
Obsidian | Level 7

@Tom @rogerjdeangelis @Patrick  I got it and heres the solution... If you guys need it in future in any of your endeavors..

 

//RDDATA   EXEC  SAS,WORK='40000,40000'                 
//SYSPRINT DD SYSOUT=*                                  
//CTLR    DD  DSN=CHMICST.LISTCAT.OUTPUT,DISP=SHR       
//SYSIN DD  *                                           
OPTIONS NOCENTER PS=1000 ;                              
DATA DATE;                                              
%LET TODAY=%SYSFUNC(TODAY(),MMDDYYN7.);                 
* %PUT D&TODAY.;                                        
%LET DTVAR = D&TODAY. ;                                 
%PUT &DTVAR;                                            
RUN;                                                    
DATA FINAL;                                             
  SET DATE;                                             
  INPUT FUNCTION          $ 4-16                        
        EDINAME           $ 17-24      

                SECNDQUL          $ 25-32                              
         DTEQUAL           $ 33-41                              
         TIMEQUL           $ 42-44                              
         MQUAL             $ 45-47                              
         LASTQUL           $ 48-52                              
         EQUAL             $ 53-57                              
         ;                                                      
        DTEQUAL = "&DTVAR" ;                                    
        ;                                                       
   DATALINES;                                                   
    LISTCAT LVL('EDIB88T.NTRCS1T.D&DTVAR...T*.M*.CTLR')ALL      
    ;                                                           
    PROC PRINT DATA=FINAL NOOBS;                                
    ;                                                           
  DATA _NULL_;                                                  
  SET FINAL ;                                                   
  FILE CTLR NOPRINT NOTITLES MOD ;                              
  PUT FUNCTION          $ 4-16                                  

      EDINAME           $ 17-24       
      SECNDQUL          $ 25-32       
      DTEQUAL           $ 33-39       
      TIMEQUL           $ 40-42       
      MQUAL             $ 43-45       
      LASTQUL           $ 46-50       
      EQUAL             $ 51-58       
      ;                               
 RUN;                                 

 

 

which gives me the output in the dataset : CHMICST.LISTCAT.OUTPUT

 

as :

 

LISTCAT LVL('EDIB88T.NTRCS1T.D010417.T*.M*.CTLR')ALL

 

 

Thanks,

 

Hope you find it  useful                

View solution in original post

7 REPLIES 7
Patrick
Opal | Level 21

There are ways in JCL to actually code this and then use a variable instead of the name - but JCL is now so long ago for me that I would have to look up all the details of how that's done as well.

 

 

Another approach I've used in a SAS life long long ago was to generate the code - JCL and SAS code - and then pass it to the internal reader (intrdr).

rogerjdeangelis
Barite | Level 11
Not sure if this is still relavant but I used it in the late 80's

I believe IDCAMS can be run interactively so you can
wrap it in macro, or you can create a JCL proc with an argument

Untested proc

HERE IS A PROC WITH THREE PARAMETERS

//*
//*  PROC PARAMETERS
//*   STATE  IS STATE TO PROCESS
//*   PRIOR  IS STATE TO STACK THIS ONE BEHIND
//*   FILE   IS FILE SEQUENCE NUMBER
//*
//*  NOTE: - FIRST STATE HAS STARTING VOLSERS CODED AS OVERRIDE
//*

//MAT PROC DATE=DEC87
//UNCATLG EXEC PGM=IEFBR14
//DUM DD UNIT=(CART,,DEFER)
//    DD UNIT=AFF=DUM,DISP=(MOD,UNCATLG),
//       DSN=XXXXXXX.M12.M703.FULL.&STATE..&DATE
//    DD UNIT=AFF=DUM,DISP=(MOD,UNCATLG),
//       DSN=XXXXXXX.M12.M703.STRIP.&STATE..&DATE
//*
//MATCH EXEC PGM=YYYY532
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//IDQ11521 DD DSN=XXX.XXX.STIDFILE,DISP=SHR
//IDQ11522 DD DSN=XXX.XXXZIPSTAT,DISP=SHR
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(100,25))
//SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,(100,25))
//SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,(100,25))
//SORTWK04 DD UNIT=SYSDA,SPACE=(CYL,(100,25))
//SORTWK05 DD UNIT=SYSDA,SPACE=(CYL,(100,25))
//SORTWK06 DD UNIT=SYSDA,SPACE=(CYL,(100,25))
//SORTWK07 DD UNIT=SYSDA,SPACE=(CYL,(100,25))
//SORTWK08 DD UNIT=SYSDA,SPACE=(CYL,(100,25))
//SORTWK09 DD UNIT=SYSDA,SPACE=(CYL,(100,25))
//SORTWK10 DD UNIT=SYSDA,SPACE=(CYL,(100,25))
//OUT   DD UNIT=CARTX,
//      DCB=(LRECL=532,RECFM=FB,BLKSIZE=32452,TRTCH=COMP),
//      DISP=(,CATLG),
//      LABEL=&FILE,
//      VOL=(,RETAIN,,99,
//      REF=XXXXXXX.M12.M703.FULL.&PRIOR..&DATE),
//      DSN=XXXXXXX.M12.M703.FULL.&STATE..&DATE
//STRIP DD UNIT=CARTX,
//      DCB=(LRECL=144,RECFM=FB,BLKSIZE=32688,TRTCH=COMP),
//      DISP=(,CATLG),
//      LABEL=&FILE,
//      VOL=(,RETAIN,,99,
//      REF=XXXXXXX.M12.M703.STRIP.&PRIOR..&DATE),
//      DSN=XXXXXXX.M12.M703.STRIP.&STATE..&DATE
//LONG  DD  DISP=(MOD,CATLG),DCB=(LRECL=532,RECFM=FB,BLKSIZE=27664),
//          SPACE=(CYL,(10,10),RLSE),UNIT=SYSDA,
//          DSN=XXXXXXX.MAR97.LONG.ADDRESS.RECORDS
//IN    DD DISP=OLD,DSN=YYYY0397.S0400.XXXS04.STATE&STATE,
//         DCB=TRTCH=COMP
//      PEND



//*
//*  PROC PARAMETERS
//*   STATE  IS STATE TO PROCESS
//*   PRIOR  IS STATE TO STACK THIS ONE BEHIND
//*   FILE   IS FILE SEQUENCE NUMBER
//*
//*  NOTE: - FIRST STATE HAS STARTING VOLSERS CODED AS OVERRIDE
//*
//MA EXEC MAT,STATE=MA,FILE=01,
//       PRIOR=NONE
//MATCH.OUT DD VOL=(,RETAIN,,99)   FULL  STARTING VOLSER
//STRIP     DD VOL=(,RETAIN,,99)   STRIP STARTING VOLSER
//*
//RI EXEC MAT,STATE=RI,FILE=02,PRIOR=MA
//NH EXEC MAT,STATE=NH,FILE=03,PRIOR=RI
//ME EXEC MAT,STATE=ME,FILE=04,PRIOR=NH
//VT EXEC MAT,STATE=VT,FILE=05,PRIOR=ME
//CT EXEC MAT,STATE=CT,FILE=06,PRIOR=VT
//NJ EXEC MAT,STATE=NJ,FILE=07,PRIOR=CT
//NY EXEC MAT,STATE=NY,FILE=08,PRIOR=NJ
//PA EXEC MAT,STATE=PA,FILE=09,PRIOR=NY
//DE EXEC MAT,STATE=DE,FILE=10,PRIOR=PA
//DC EXEC MAT,STATE=DC,FILE=11,PRIOR=DE


It is possible to eliminate JCL entirely and run using
old text editor. You run 'interactive' batch
that can communicate with a master interactive SAS.
I found this very usefull back in the 80s, although IT hated it.

Here is some info (somewhat incomplete) on 'interactive' MVS batch.


%MACRO UTLTSO(STATE)

   / des="Bring up TSO batch xeq SAS and SAS objects";


/*-------------------------------------*\
|                                       |
| This is some really old code circa    |
| 1988                                  |
|                                       |
| The pupose of this utility was to     |
| run a second SAS MVS 'interactive'    |
| batch session while in old text       |
| editor. No JCL.                      |
|                                       |
| I used to use this code to do         |
| some tasks batch while I was doing    |
| other things in display manager.      |
|                                       |
| You may ask why:                      |
|                                       |
|    1. A JCL oriented MVS batch        |
|       environment is quite different  |
|       from other batch environments   |
|       ie Unix, OS/2, WinNT etc.       |
|       This utility gives the user     |
|       some of the properties of MVS   |
|       batch, ie batch queues, good    |
|       mutiprogamming, time and        |
|       storage limits etc.             |
|                                       |
|    2. No JCL needed                   |
|                                       |
|    3. All TSO utilities like IEBCOPY, |
|       IDCAMS available with           |
|       IEBGENER available with         |
|       SAS 'X' command. No JCL.        |
|       Also things like LISTDS         |
|                                       |
|    4. Programs run exactly the same   |
|       in true interactive or          |
|       interactive batch               |
|                                       |
|    5. Some SAS interactive commands   |
|       are available in 'interactive'  |
|       batch.                          |
|                                       |
|                                       |
| Inputs                                |
| ======                                |
|                                       |
| 1. A member  UTLPRTX in PDS           |
|    XLR82SAS.UTL(UTLPRTX)              |
|                                       |
|                                       |
|     %UTLPRTX                          |
|        (                              |
|        UIN=XLR2SAS.UTL.SDL,           |
|        UMEM=SASCOBOL,                 |
|        UPRN=NO,                       |
|        UOT=XLR82SAS.UTL.&UTLTSO.PRT,  |
|        UFLOP=05.06.07                 |
|        );                             |
|                                       |
| 2. You may want to customize the      |
|    config and autoexec files for      |
|    communication between the two      |
|    interactive SAS sessions.          |
|                                       |
|                                       |
| Process                               |
| =======                               |
|                                       |
|    In an active display manager       |
|    submit the following code          |
|                                       |
|    %utltso(utlprtx);                  |
|                                       |
|    What happens:                      |
|                                       |
|      1. UTLTSO is located in          |
|          the current autocall         |
|         library                       |
|                                       |
|      2. SAS dynamically creates       |
|         MVS JCL and submits the JCL   |
|         the appropriate batch que.    |
|         (using the internal reader)   |
|                                       |
|      3. MVS brings up a TSO session   |
|         in batch mode.                |
|                                       |
|      4. The Batch TSO session executes|
|         the SAS clist.                |
|                                       |
|           A. SASTSO is the name of    |
|              the CLIST.               |
|                                       |
|           B. The Clist communicates   |
|              with the interactive     |
|              session through          |
|                                       |
|       5. Job runs.                    |
|                                       |
|                                       |
| OUTPUT                                |
| =======                               |
|                                       |
|      XLR82SAS.UTL.UTLPRTX.PRT         |
|                                       |
|=======================================|
|                                       |
|                                       |
\*-------------------------------------*/


FILENAME OUTRDR SYSOUT=A PGM=INTRDR RECFM=FB LRECL=80;

DATA _NULL_;

 LENGTH J1-J8 $72.;

 FILE OUTRDR NOPRINT NOTITLES;

 J1="//XLR82SASW JOB (XXXXXXXX,XXXXXXX),MSGCLASS=X,CLASS=B,REGION=0M";
 J2="//TSO      EXEC PGM=IKJEFT01,REGION=16M,DYNAMNBR=30";
 J3="//SYSTSPRT DD   SYSOUT=*";
 J4="//SYSPRINT DD   SYSOUT=*";
 J5="//SASUSR   DD   DSN=XLR82SAS.UTLTSO.SASUSER.SDL,DISP=OLD";
 J6="//SASIN    DD   DISP=SHR,DSN=XLR82SAS.UTL(&STATE)";
 J7="//SYSTSIN  DD   *";
 J8="EX 'XLR82SAS.CLIST(SASTSO)'";

 PUT (J1-J8) ($CHAR72. /);

RUN;


%MEND UTLTSO;


%utltso(state=FL);
%utltso(state=NY);


sayanapex06
Obsidian | Level 7

@rogerjdeangelis Hi Roger, Thanks!

 

but I need to use listcat and have the value pass through instream sysin. Can you help me with that

Tom
Super User Tom
Super User

Instead of using 

//SYSIN    DD  *    

to read the list from the JCL stack point SYSIN to an actual file that you created in a earlier step.

rogerjdeangelis
Barite | Level 11

It hase been over 20 years since I was on the maiframe but I found this code.

 

I am not sure this is relavent. Just can't remember.

 

This is an interactive solution?

 

Also I think you can stil use a JCL proc, but you may need aparameter for each listcat,

 

Some special chars did not map correctly to ascii. I think this does a bunch of listcats.

 

%macro utl04LP(__OF=&__OF., /* DSN of output file */
__USTR=&__USTR., /* HLQ String (blank-delimited) */
__OPTS=&__OPTS.); /* LISTCAT Options */
%utldelf(&__OF); * delete output fiel if it exists;


filename a "&__OF." disp=(mod,catlg)
space=(trk,(50,10),rlse) recfm=vba lrecl=255;run;

%local __C __HLQ __UGH;
%let __C = 1;
%let __HLQ = %scan( &__USTR., &__C., ' ' );
%do %while ( &__HLQ ª= );
%let __UGH = %str('&__HLQ.');
x "listcat level(&__UGH.) ofile(A) &__OPTS.";run;
%let __C = %eval( &__C. + 1 );
%let __HLQ = %scan( &__USTR., &__C., ' ' );
%end;
filename a clear;run;

%mend utl04LP;

rogerjdeangelis
Barite | Level 11
I think IBM came out with 'do loops' and ifs in a proc. But that was well after I left mainframes?
sayanapex06
Obsidian | Level 7

@Tom @rogerjdeangelis @Patrick  I got it and heres the solution... If you guys need it in future in any of your endeavors..

 

//RDDATA   EXEC  SAS,WORK='40000,40000'                 
//SYSPRINT DD SYSOUT=*                                  
//CTLR    DD  DSN=CHMICST.LISTCAT.OUTPUT,DISP=SHR       
//SYSIN DD  *                                           
OPTIONS NOCENTER PS=1000 ;                              
DATA DATE;                                              
%LET TODAY=%SYSFUNC(TODAY(),MMDDYYN7.);                 
* %PUT D&TODAY.;                                        
%LET DTVAR = D&TODAY. ;                                 
%PUT &DTVAR;                                            
RUN;                                                    
DATA FINAL;                                             
  SET DATE;                                             
  INPUT FUNCTION          $ 4-16                        
        EDINAME           $ 17-24      

                SECNDQUL          $ 25-32                              
         DTEQUAL           $ 33-41                              
         TIMEQUL           $ 42-44                              
         MQUAL             $ 45-47                              
         LASTQUL           $ 48-52                              
         EQUAL             $ 53-57                              
         ;                                                      
        DTEQUAL = "&DTVAR" ;                                    
        ;                                                       
   DATALINES;                                                   
    LISTCAT LVL('EDIB88T.NTRCS1T.D&DTVAR...T*.M*.CTLR')ALL      
    ;                                                           
    PROC PRINT DATA=FINAL NOOBS;                                
    ;                                                           
  DATA _NULL_;                                                  
  SET FINAL ;                                                   
  FILE CTLR NOPRINT NOTITLES MOD ;                              
  PUT FUNCTION          $ 4-16                                  

      EDINAME           $ 17-24       
      SECNDQUL          $ 25-32       
      DTEQUAL           $ 33-39       
      TIMEQUL           $ 40-42       
      MQUAL             $ 43-45       
      LASTQUL           $ 46-50       
      EQUAL             $ 51-58       
      ;                               
 RUN;                                 

 

 

which gives me the output in the dataset : CHMICST.LISTCAT.OUTPUT

 

as :

 

LISTCAT LVL('EDIB88T.NTRCS1T.D010417.T*.M*.CTLR')ALL

 

 

Thanks,

 

Hope you find it  useful                

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 2135 views
  • 0 likes
  • 4 in conversation