JCL- Check Dataset empty,If not empty do STEP2,nxt step RC=0

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

phaniyelugula
Member
Posts: 20
Joined: Mon Dec 30, 2013 6:03 pm

JCL- Check Dataset empty,If not empty do STEP2,nxt step RC=0

Post by phaniyelugula » Mon Dec 30, 2013 6:33 pm

Hi All,

My requirement:
I am having a job with 3 steps to do the following,
ST010 - To check if Data set is empty or not,
ST020 - If its not empty then do ST020 should execute.
ST030 - SET RC of the job to ZERO..

i am using the following code..

Code: Select all

//ST010   EXEC PGM=IDCAMS                               
//SYSOUT   DD SYSOUT=*                                  
//SYSPRINT DD SYSOUT=*                                  
//FILEIN   DD DSN=IN5637S.PL1.INOUT.IBANIN,DISP=SHR     
//SYSIN    DD *                                         
  PRINT INFILE(FILEIN) -                                
      CHARACTER COUNT(1)                                
/*                                                      
//ST020   EXEC PGM=SAMPLE1,COND=(4,EQ,ST010)            
//STEPLIB   DD DSN=NLHRPAY.DEV1.PGML,DISP=SHR           
//INFILE    DD DSN=IN5637S.PL1.INOUT.IBANIN,DISP=SHR    
//SYSPRINT  DD SYSOUT=*                                 
//SYSOUT    DD SYSOUT=*                                 
//*                                             
//ST030  EXEC PGM=IDCAMS,COND=EVEN              
//SYSPRINT DD SYSOUT=*                          
//SYSIN    DD *                                 
    SET MAXCC=0                                 
/*                                              
with the above code if the data set in ST010 is empty then its ST010 is returning RC 4...ST020 is Flushing(has expected)...ST030 is also executing(i.e. CC of this particular step is 0 in spool) but the MAXCC of the overall job is still 4...

If i use SET MAXCC=10 in ST030 then the MAXCC of the overall job is set to 10....But when i place 0 its not working out.

Please help me out.

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Mon Dec 30, 2013 9:25 pm

MAXCC sets the return code for that step only. There is no MAXCC for the job - just a "highest return code". However, if I recall correctly, the latest version of z/OS has new functionality which does allow the setting of the highest return code to a certain value but I have only heard about it and not studied it.
Regards
Nic

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Mon Dec 30, 2013 10:57 pm

Unless your system is running z/OS 1.13, i do not beileve you can do what you want.

Why does someone believe that the rc should be changed once set?

If you explain the needed process, we ma be able to offer a suggestion on how to accomplish this.
Have a good one

phaniyelugula
Member
Posts: 20
Joined: Mon Dec 30, 2013 6:03 pm

Post by phaniyelugula » Tue Dec 31, 2013 10:52 am

Thanks NicC and DikDude, for your quick response :) ..

Its is the requirement of the client to set returncode of the "job" to 0 so that our jobs in the application will be in complete state.So i was trying to set the MAXCC of the job to 0.
FYI, my system is running on z/OS 1.13

devegouda.chage
Member
Posts: 32
Joined: Mon Sep 12, 2011 10:50 am
Location: Bangalore

Post by devegouda.chage » Tue Dec 31, 2013 11:34 am

Hi,
Just for curious ,I tried setting up MAXCC for the 3rd step

Code: Select all

//ST010   EXEC PGM=IDCAMS                                
//SYSOUT   DD SYSOUT=*                                  
//SYSPRINT DD SYSOUT=*                                  
//FILEIN   DD DSN=IN5637S.PL1.INOUT.IBANIN,DISP=SHR      
//SYSIN    DD *                                          
  PRINT INFILE(FILEIN) -                                
      CHARACTER COUNT(1)                                
/*                                                      
//ST020   EXEC PGM=SAMPLE1,COND=(4,EQ,ST010)            
//STEPLIB   DD DSN=NLHRPAY.DEV1.PGML,DISP=SHR            
//INFILE    DD DSN=IN5637S.PL1.INOUT.IBANIN,DISP=SHR    
//SYSPRINT  DD SYSOUT=*                                  
//SYSOUT    DD SYSOUT=*                                  
//*                                              
//ST030  EXEC PGM=IDCAMS,COND=EVEN              
//SYSPRINT DD SYSOUT=*                          
//SYSIN    DD *                                  
    SET MAXCC=5                                  
/*                     

I am able to get the MAXCC as what i set in between 4 and 16 (Example: 4,5,6,.............13,14,16)but apart from these numbers if i try with other numbers(Example:17,18...Etc), its giving MAXCC as 16 only,is there any logic behind this :roll: :?:
Thanks & Regards
Dev

phaniyelugula
Member
Posts: 20
Joined: Mon Dec 30, 2013 6:03 pm

Post by phaniyelugula » Tue Dec 31, 2013 12:22 pm

Hi Dev,
Upto my knowledge MAXCC can be set to max of 16...

All, Correct me if i am wrong..

phaniyelugula
Member
Posts: 20
Joined: Mon Dec 30, 2013 6:03 pm

Post by phaniyelugula » Tue Dec 31, 2013 12:27 pm

I have achieved my task 8) ...

I have used "JOBRC" parameter in jobcard like the below.

Code: Select all

//123457S$ JOB (ACCOUNT),'NAME',                      
// MSGCLASS=A,CLASS=A,NOTIFY=123457S,                 
// USER=123457S,PASSWORD=1234577@,JOBRC=(STEP,ST030)  
//*       
                                            

and now the MAXCC of the job is set to 0..since i have set MAXCC to 0 in ST030.

Thanks all :)

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Tue Dec 31, 2013 3:28 pm

MAXCC of the job is set to 0
No - the JOBRC is set to 0. MAXCC is related to the IDCAMS step
Regards
Nic

phaniyelugula
Member
Posts: 20
Joined: Mon Dec 30, 2013 6:03 pm

Post by phaniyelugula » Tue Dec 31, 2013 5:44 pm

But in the SPOOL its showing MAC-RC as 0.

i am new, I dont know how to post images in the forum.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Tue Dec 31, 2013 7:56 pm

Please do NOT post images.

If you want to post info from a screen, use copy/paste and apply the Code tag.

The Code Tag is not available on the Quick Reply screen. Click Preview and several other options become available. Suggest you experiment and posting will work better for you.
Have a good one

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Tue Dec 31, 2013 10:28 pm

I am quite willing to be corrected. I have never seen JOBRC being used so i do not know how it would appear in the output. It would be nice to see for info. I could wait until I get back to work next year but I may have forgotten by then or work may get in the way of experimentation.
Regards
Nic

phaniyelugula
Member
Posts: 20
Joined: Mon Dec 30, 2013 6:03 pm

Post by phaniyelugula » Wed Jan 01, 2014 12:16 pm

Hi All,

Code: Select all

 COMMAND INPUT ===>                                            SCROLL ===> CSR  
 NP   JOBNAME  JobID    Owner    Prty Max-RC     Queue      C  Pos  SAff  ASys S
      125637S$ JOB09789 125637S     1 CC 0000    PRINT      A 22937             

This is the screen shot of the spool after using JOBRC , MAX-RC is set to 0.

By the way,
HAPPY NEW YEAR
:D

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Wed Jan 01, 2014 5:41 pm

Thank you for that and for using the code tags!

Happy New Year
Regards
Nic

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Thu Jan 02, 2014 5:34 am

But in the SPOOL its showing MAC-RC as 0.
NOTE: Max-Rc is NOT the same s MAXCC. . .

It really does make a difference . . .
Have a good one

Sureshpathi10
Member
Posts: 6
Joined: Thu Oct 15, 2009 11:12 am
Location: Kuala Lumpur

Post by Sureshpathi10 » Wed Jan 15, 2014 12:07 pm

Code: Select all

//ST010   EXEC PGM=IDCAMS                               
//SYSOUT   DD SYSOUT=*                                 
//SYSPRINT DD SYSOUT=*                                 
//FILEIN   DD DSN=IN5637S.PL1.INOUT.IBANIN,DISP=SHR     
//SYSIN    DD *                                         
  PRINT INFILE(FILEIN) -                               
      CHARACTER COUNT(1)                               
/*                      
//CONDIF   IF ST010.RC LE 4 THEN 
//ST020   EXEC PGM=SAMPLE1          
//STEPLIB   DD DSN=NLHRPAY.DEV1.PGML,DISP=SHR           
//INFILE    DD DSN=IN5637S.PL1.INOUT.IBANIN,DISP=SHR   
//SYSPRINT  DD SYSOUT=*                                 
//SYSOUT    DD SYSOUT=*                                 
//*                         
//CONDEL   ELSE                    
//ST030  EXEC PGM=IDCAMS,COND=EVEN             
//SYSPRINT DD SYSOUT=*                         
//SYSIN    DD *                                 
    SET MAXCC=0                                
/*    
//ENDCOND  ENDIF 
I would prefer IF condition to handle this kind of operation.
I Hope you have to consider the return code from ST020 also.
Thanks,
Suresh Ramaiyan

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others