Date: Wed, 27 May 2009 09:07:55 -0400
Reply-To: msz03@albany.edu
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mike Zdeb <msz03@ALBANY.EDU>
Subject: Re: OT Need help on how to call jcl job in a sas program
Content-Type: text/plain;charset=iso-8859-1
hi ... just thought I'd point out that a search of the archives shows that Mike Raithel's
posting includes the first use on SAS-L of the word 'halcyon' in a sentence
there are a number of other postings with 'halcyon' in either an e-mail or web address
it is also in one posting with the subject line "Be a more enormous gent" ... but 'halcyon' is just
listed in a long string of words (that also includes, among others, 'buckaroo' 'cytochemistry' 'aristotelean' and 'yarmulke')
so, Mike Raithel receives a "Dorfman" ... a prize awarded for expanding the list vocabulary
--
Mike Zdeb
U@Albany School of Public Health
One University Place
Rensselaer, New York 12144-3456
P/518-402-6479 F/630-604-1475
> Dear SAS-L-ers,
>
> DATA NULL or Ravi calling himself DATA NULL posted the following:
>
>>
>> Hi All,
>>
>> I am working on a project where i require to automate the
>> process.It involves few steps like :
>> 1) Converting the Variable block(VB) DSN to fixed block
>> (FB)DSN file in mainframe.
>> 2) I will parse the FB DSN file .
>> 3) Then update the master dataset in sas.
>> So now the issue is i want to call the the JCL code which
>> converts the VB to FB in sas so that i can reduce the
>> interaction with mainframe and by that i will reduce the
>> total time taken in the process.As this is an daily excercise
>> its taking a lot of time.
>>
>> Mainly i am looking out how to execute a JCL code in sas program.
>>
>> So can anyone help me out.
>>
>> Thanks in advance.
>
> Ravi, you are welcomed in arears:-)
>
> I would second, third and fourth the suggestions put forth by SAS-L mainframe heroes JF Berube, Gerhard Hellriegel, and (mad doggie) Michael Davis
> concerning using the Internal reader to submit the JCL. The Internal reader, know as INTRDR to its friends, is a very flexible facility that you
> can grab and use to dynamically mold and shape mainframe SAS batch programs.
>
> In my halcyon, carefree, I-can-do-anything, mainframe SAS programming days, I used to code the following (Man, if this example wraps, then you will
> need either a good eye doctor or a great psychiatrist)!:
>
> //*********************************************
> //* THIS DETERMINES THE CORRECT DAYS OF LAST *
> //* WEEK AND SUBMITS THE TYPE1415/1718 BUILD *
> //* JOB. *
> //*********************************************
> //STEP02 EXEC SAS
> //INTRDR DD SYSOUT=(A,INTRDR)
> //SYSIN DD *
> ****************************************;
> * OPTIONS, MACROS, FORMATS. *;
> ****************************************;
> OPTIONS MACROGEN SYMBOLGEN MPRINT;
>
> ****************************************;
> * GET START DATE OF PREVIOUS WEEK. *;
> ****************************************;
>
> %STRTDATE;
>
> ****************************************;
> * ENSURE JOB IS RUNNING ON MONDAY *;
> ****************************************;
> DATA _NULL_;
>
> IF WEEKDAY(&STRTDATE) = 2 THEN;
> ELSE ABORT;
>
> RUN;
>
> ****************************************;
> * SUBMIT JOB AFTER DETERMINING CORRECT *;
> * JULIAN DAYS FOR SMF TAPE DSN'S. *;
> ****************************************;
> DATA _NULL_;
> FILE INTRDR LRECL=80 BLKSIZE=80 RECFM=F NOPRINT NOTITLES;
>
> SUNDATE = JULDATE(&STRTDATE - 1);
> MONDATE = JULDATE(&STRTDATE );
> TUEDATE = JULDATE(&STRTDATE + 1);
> WEDDATE = JULDATE(&STRTDATE + 2);
> THUDATE = JULDATE(&STRTDATE + 3);
> FRIDATE = JULDATE(&STRTDATE + 4);
> SATDATE = JULDATE(&STRTDATE + 5);
>
> PUT "//ABCPACE1 JOB (XXXX,1234),'ABCS SEC RPT',CLASS=H, ";
> PUT '// MSGCLASS=W, ';
> PUT '/*JOBPARM SYSAFF=ABCD ';
> PUT '//*************************************************** ';
> PUT '//* DELETE DATA SETS WITH IEFBR14 * ';
> PUT '//*************************************************** ';
> PUT '//STEP01 EXEC PGM=IEFBR14 ';
> PUT '//SYSPRINT DD SYSOUT=* ';
> PUT '//OUT1415 DD DSN=ABC.AAA.TYPE1415.TYPE1718.PDB, ';
> PUT '// DISP=(MOD,DELETE,DELETE), ';
> PUT '// UNIT=SYSDA,SPACE=(TRK,(1,0)) ';
> PUT '//* ';
> PUT '//*************************************************** ';
> PUT '//* CREATE A PDB OF TYPE 1415 RECORDS FOR SUNDAY * ';
> PUT '//*************************************************** ';
> PUT "//STEP02 EXEC MXGSAS,WORK='500,50', ";
> PUT "// OPTIONS='SYSPARM=SUN' ";
> PUT '//SMF DD DISP=SHR,DSN=SMF.DAILY.FILE.D' SUNDATE 5. ;
> PUT '//WK1 DD DISP=SHR,DSN=ABC.WEEK1 ';
> PUT '//PDB DD DISP=SHR,DSN=ABC.PROD.PDB ';
> PUT '//TOP DD DISP=SHR,DSN=ABC.AAA.TSS.OUTLIST.PDB ';
> PUT '//PDBNEW DD DSN=ABC.AAA.TYPE1415.TYPE1718.PDB, ';
> PUT '// DISP=(,CATLG,DELETE), ';
> PUT '// UNIT=SYSDA,SPACE=(CYL,(300,100)) ';
> PUT '//SYSIN DD DSN=ABC.PROD.JOBS(ABCPACE2),DISP=SHR ';
> PUT '//* ';
> PUT '//**************************************************** ';
> PUT '//* CREATE A PDB OF TYPE 1415 RECORDS FOR MONDAY * ';
> PUT '//**************************************************** ';
> PUT "//STEP03 EXEC MXGSAS,WORK='500,50', ";
> PUT "// OPTIONS='SYSPARM=MON' ";
> PUT '//SMF DD DISP=SHR,DSN=SMF.DAILY.FILE.D' MONDATE 5. ;
> PUT '//WK1 DD DISP=SHR,DSN=ABC.WEEK1 ';
> PUT '//PDB DD DISP=SHR,DSN=ABC.PROD.PDB ';
> PUT '//TOP DD DISP=SHR,DSN=ABC.AAA.TSS.OUTLIST.PDB ';
> PUT '//PDBNEW DD DSN=ABC.AAA.TYPE1415.TYPE1718.PDB, ';
> PUT '// DISP=OLD ';
> PUT '//SYSIN DD DSN=ABC.PROD.JOBS(ABCPACE2),DISP=SHR ';
> PUT '//* ';
> PUT '//**************************************************** ';
> PUT '//* CREATE A PDB OF TYPE 1415 RECORDS FOR TUESDAY * ';
> PUT '//**************************************************** ';
> PUT "//STEP04 EXEC MXGSAS,WORK='500,50', ";
> PUT "// OPTIONS='SYSPARM=TUE' ";
> PUT '//SMF DD DISP=SHR,DSN=SMF.DAILY.FILE.D' TUEDATE 5. ;
> PUT '//WK1 DD DISP=SHR,DSN=ABC.WEEK1 ';
> PUT '//PDB DD DISP=SHR,DSN=ABC.PROD.PDB ';
> PUT '//TOP DD DISP=SHR,DSN=ABC.AAA.TSS.OUTLIST.PDB ';
> PUT '//PDBNEW DD DSN=ABC.AAA.TYPE1415.TYPE1718.PDB, ';
> PUT '// DISP=OLD ';
> PUT '//SYSIN DD DSN=ABC.PROD.JOBS(ABCPACE2),DISP=SHR ';
> PUT '//* ';
> PUT '//**************************************************** ';
> PUT '//* CREATE A PDB OF TYPE 1415 RECORDS FOR WEDNESDY * ';
> PUT '//**************************************************** ';
> PUT "//STEP05 EXEC MXGSAS,WORK='500,50', ";
> PUT "// OPTIONS='SYSPARM=WED' ";
> PUT '//SMF DD DISP=SHR,DSN=SMF.DAILY.FILE.D' WEDDATE 5. ;
> PUT '//WK1 DD DISP=SHR,DSN=ABC.WEEK1 ';
> PUT '//PDB DD DISP=SHR,DSN=ABC.PROD.PDB ';
> PUT '//TOP DD DISP=SHR,DSN=ABC.AAA.TSS.OUTLIST.PDB ';
> PUT '//PDBNEW DD DSN=ABC.AAA.TYPE1415.TYPE1718.PDB, ';
> PUT '// DISP=OLD ';
> PUT '//SYSIN DD DSN=ABC.PROD.JOBS(ABCPACE2),DISP=SHR ';
> PUT '//* ';
> PUT '//**************************************************** ';
> PUT '//* CREATE A PDB OF TYPE 1415 RECORDS FOR THURSDAY * ';
> PUT '//**************************************************** ';
> PUT "//STEP06 EXEC MXGSAS,WORK='500,50', ";
> PUT "// OPTIONS='SYSPARM=THU' ";
> PUT '//SMF DD DISP=SHR,DSN=SMF.DAILY.FILE.D' THUDATE 5. ;
> PUT '//WK1 DD DISP=SHR,DSN=ABC.WEEK1 ';
> PUT '//PDB DD DISP=SHR,DSN=ABC.PROD.PDB ';
> PUT '//TOP DD DISP=SHR,DSN=ABC.AAA.TSS.OUTLIST.PDB ';
> PUT '//PDBNEW DD DSN=ABC.AAA.TYPE1415.TYPE1718.PDB, ';
> PUT '// DISP=OLD ';
> PUT '//SYSIN DD DSN=ABC.PROD.JOBS(ABCPACE2),DISP=SHR ';
> PUT '//* ';
> PUT '//**************************************************** ';
> PUT '//* CREATE A PDB OF TYPE 1415 RECORDS FOR FRIDAY * ';
> PUT '//**************************************************** ';
> PUT "//STEP07 EXEC MXGSAS,WORK='500,50', ";
> PUT "// OPTIONS='SYSPARM=FRI' ";
> PUT '//SMF DD DISP=SHR,DSN=SMF.DAILY.FILE.D' FRIDATE 5. ;
> PUT '//WK1 DD DISP=SHR,DSN=ABC.WEEK1 ';
> PUT '//PDB DD DISP=SHR,DSN=ABC.PROD.PDB ';
> PUT '//TOP DD DISP=SHR,DSN=ABC.AAA.TSS.OUTLIST.PDB ';
> PUT '//PDBNEW DD DSN=ABC.AAA.TYPE1415.TYPE1718.PDB, ';
> PUT '// DISP=OLD ';
> PUT '//SYSIN DD DSN=ABC.PROD.JOBS(ABCPACE2),DISP=SHR ';
> PUT '//* ';
> PUT '//**************************************************** ';
> PUT '//* CREATE A PDB OF TYPE 1415 RECORDS FOR SATURDAY * ';
> PUT '//**************************************************** ';
> PUT "//STEP08 EXEC MXGSAS,WORK='500,50', ";
> PUT "// OPTIONS='SYSPARM=SAT' ";
> PUT '//SMF DD DISP=SHR,DSN=SMF.DAILY.FILE.D' SATDATE 5. ;
> PUT '//WK1 DD DISP=SHR,DSN=ABC.WEEK1 ';
> PUT '//PDB DD DISP=SHR,DSN=ABC.PROD.PDB ';
> PUT '//TOP DD DISP=SHR,DSN=ABC.AAA.TSS.OUTLIST.PDB ';
> PUT '//PDBNEW DD DSN=ABC.AAA.TYPE1415.TYPE1718.PDB, ';
> PUT '// DISP=OLD ';
> PUT '//SYSIN DD DSN=ABC.PROD.JOBS(ABCPACE2),DISP=SHR ';
> PUT '//* ';
> PUT '//TEST09 IF (RC NG 0) THEN ';
> PUT '//* ';
> PUT "//STEP09 EXEC MXGSAS,WORK='500,50' ";
> PUT '//COPYIN DD DSN=ABC.AAA.TYPE1415.TYPE1718.PDB,DISP=SHR ';
> PUT '//COPYOUT DD DSN=ABC.AAA.TYPE1415.TYPE1718.WK' MONDATE 5. ',';
> PUT '// DISP=(,CATLG,DELETE),UNIT=(CTAPE,,DEFER) ';
> PUT '//SYSIN DD DSN=ABC.PROD.JOBS(PROCCOPY),DISP=SHR ';
> PUT '//* ';
> PUT '//TEST09 ENDIF ';
> PUT '//* ';
> //*
>
> Hey, Ravi, did that come through the 'L okay? If not, push this button for your refund: <??>!
>
> As you can see, this VERY OLD Raithel program is fed the STRTDATE, and then determines the values of seven Julian dates. Then it does a series of
> PUT statements to the Internal Reader, INTRDR, putting fully formed Job Control Language statements. When the last JCL statement is PUT to INTRDR,
> z/OS fires off the new batch job and executes away--processing the tape data sets in this case.
>
> Ravi, you should be able to blow off the dust, sweep off the cobwebs, and then remold the above example to fit your own mainframe processing needs.
> Right?
>
> ALLRIGHT!!!!!!
>
> Ravi, best of luck in all of your SAS endeavors!
>
>
> I hope that this suggestion proves helpful now, and in the future!
>
> Of course, all of these opinions and insights are my own, and do not reflect those of my organization or my associates. All SAS code and/or
> methodologies specified in this posting are for illustrative purposes only and no warranty is stated or implied as to their accuracy or
> applicability. People deciding to use information in this posting do so at their own risk.
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Michael A. Raithel
> "The man who wrote the book on performance"
> E-mail: MichaelRaithel@westat.com
>
> Author: Tuning SAS Applications in the MVS Environment
>
> Author: Tuning SAS Applications in the OS/390 and z/OS Environments, Second Edition
>
> http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=58172
>
> Author: The Complete Guide to SAS Indexes
>
> http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=60409
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Anyone can do any amount of work provided it isn't the work
> he is supposed to be doing at the moment. - Robert Benchley
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
|