Empty dataset and step execution



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Empty dataset and step execution

Postby samb01 » Tue Feb 26, 2019 7:28 pm

Hello,

in my jobcard, there is : COND=(4,LT)
So my job ended in error if a step is equal or higher the RC = 4

if my DATASET.A have at least a record, the execute :

STEP1A

STEP2A

STEP3A

if my DATASET.B have at least a record, the execute :

STEP1B

STEP2B

STEP3B

is it possible without using IF THEN ELSE ?
samb01
 
Posts: 431
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Empty dataset and step execution

Postby prino » Tue Feb 26, 2019 9:05 pm

samb01 wrote:in my jobcard, there is : COND=(4,LT)
So my job ended in error if a step is equal or higher the RC = 4


And why is that an error? A job can end with RC=4095 and still be OK!

[quote="samb01"]
if my DATASET.A have at least a record, the execute :

STEP1A
STEP2A
STEP3A

if my DATASET.B have at least a record, the execute :

STEP1B
STEP2B
STEP3B

is it possible without using IF THEN ELSE ?
IF-THEN-ELSE logic cannot look at the contents of datasets. In other words, the answer is NO!
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 641
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 29 times

Re: Empty dataset and step execution

Postby willy jensen » Tue Feb 26, 2019 9:16 pm

I assuming that you intend to use something like ICETOOL .. COUNT to set a return code of an early step. As you want to control running of steps, then the job statement COND is not the way to go, you must use the IF/THEN/ELSE/ENDIF statement constructs between steps.
willy jensen
 
Posts: 467
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: Empty dataset and step execution

Postby samb01 » Tue Feb 26, 2019 9:20 pm

But i can test if the dataset is empty (at least on record) or not empty ?
samb01
 
Posts: 431
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Empty dataset and step execution

Postby willy jensen » Tue Feb 26, 2019 10:09 pm

Certainly:
//* COUNT .. EMPTY|NOTEMPTY -> RC 12 IF CONDITION IS MET
//C1    EXEC PGM=ICETOOL                                
//TOOLMSG  DD SYSOUT=*                                  
//DFSMSG   DD SYSOUT=*                                  
//DD1      DD DISP=SHR,DSN=dataset.name                  
//TOOLIN   DD *                                          
  COUNT FROM(DD1) EMPTY                                  

But that wasn't your question, as I understood the subject.
willy jensen
 
Posts: 467
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: Empty dataset and step execution

Postby samb01 » Wed Feb 27, 2019 1:51 pm

Hello willy jensen.
You're right, i want to control running of steps, then the job statement COND.
But i can't anderstand why it is not the right way to do.

With IF THEN ELSE, it might have probleme with rerun the job wich abended. I thought it easier to resstart the job with Code Condition...
samb01
 
Posts: 431
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Empty dataset and step execution

Postby willy jensen » Wed Feb 27, 2019 2:18 pm

Because the JOBCOND applies to all steps in a job, except the first. Or in other words, depending on the cc of the first step then either all or none of the following steps will be executed, depending on cc from the exected steps.
You can choose between the step COND statement or the IF/THEN/ELSE construct, I will definitely recommand the latter.
willy jensen
 
Posts: 467
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: Empty dataset and step execution

Postby NicC » Wed Feb 27, 2019 2:49 pm

If this is a job controlled by a scheduler then you stop the job after discerning that the data set is empty or not. Then the scheduler will submit the 'A' job or the 'B' job depending on the return code from this job.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Empty dataset and step execution

Postby expat » Thu Feb 28, 2019 12:28 pm

samb01 wrote:Hello,

in my jobcard, there is : COND=(4,LT)
So my job ended in error if a step is equal or higher the RC = 4

I would say that if the RC issued was 4, which is NOT less than 4 then the condition would not be met.
perhaps using 4,LE would be better.
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times

Re: Empty dataset and step execution

Postby samb01 » Thu Feb 28, 2019 1:44 pm

Hello expat, you are right !!! Thank's for your vigilance :D
samb01
 
Posts: 431
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post