03-26-2016 06:43 AM
I have to link and execute a JCL step from the SAS statements provided after SYSIN DD * . In SAS statements I have to check a condition which if satisfies, I need to go and execute a different JCL step in the same job. Can any one put a light on this?
I am unable to invoke a JCL step from SAS statements within SYSIN cards.
//EXIST1 EXEC SAS93
//SYSIN DD *
%macro check(dir= ) ;
%if %sysfunc(fileexist(&dir)) %then %do;
PUT 'FILE EXISTS';
>>>Here I need to invoke/link JCL Step STEP015 that is out of the scope of SYSIN Cards but present in same JOB<<
%else %do ;
%PUT 'DOES NOT EXIST';
//STEP015 EXEC PGM=SYNCSORT
03-26-2016 09:09 AM
I have an untested suggestion. First, there is afik no way to directly influence the execution flow of the JCL that started the SAS job. What can be done is have SAS end with a specific condition code if your condition is TRUE and have th enext step execute only if that condition is met.
SAS will set the condition code under control of the SYSCC macro var and/or the ABORT statement.
JCL will execute conditionally on that code using the COND= parameter on the EXEC card. For example:
//CNDSAMP JOB CLASS=6,NOTIFY=&SYSUID //* //STP01 EXEC SAS93 //* Assuming STP01 ends with RC0. //STP02 EXEC PGM=SYNCSORT,COND=(0,EQ,STP01) //* In STP02, condition evaluates to TRUE and step bypassed. //STP03 EXEC PGM=IEBGENER,COND=((10,LT,STP01),(10,GT,STP02)) //* In STP03, first condition fails and hence STP03 executes. //* Since STP02 is bypassed, the condition (10,GT,STP02) in //* STP03 is not tested.
Hope this helps,
03-26-2016 09:35 AM
03-26-2016 10:13 AM
Well than, short of an excursion towards USS and doing your thing in a shell script, I can only express my sympathy. If a warning (RC=4) raises an abend that catches the attention of your systems people they must be very busy folk and you have one hand tied to your back. I have nothing more to offer for the moment. I wish you all the best and look forward to learning how this is handled in the end.
03-26-2016 01:52 PM
You might consider calling SYNCSORT as a PROC. You would need to put the SYNCSORT control cards into //SYSIN DD * which requires using a different SYSIN name for SAS (there's and option for that).
I used to use IEBUPDTE in that way. It went something like this.
//SAS EXEC SAS93,OPTIONS=('SYSIN=SASIN")
//SYSIN DD *
iebupdte control cards
//SASIN DD *
more sas code
I haven't done this is over 25 years and only assume it still works.
Another alternative would be to read the file into a SAS data set and sort it.
Maybe it would helpful to tell us the whole story.