JCL and COND CODE



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

JCL and COND CODE

Postby samb01 » Mon Oct 14, 2019 9:01 pm

Hello,

in my jcl, i would like the steps flush if any RC is>=4 (superior or equal)

And i have a last step (a warning mail) i d like to execute if any RC is >=4 (superior or equal) or if there an ABEND or Abend User

So in the job card, i have


//JOB3 JOB  S,'ADDVOL',MSGCLASS=P,CLASS=Y,    
//     COND=(4,LE)                                

 


and the last step


//***************************************************
//MAIL EXEC PGM=IEFBR14,COND=((4,GE),ONLY)      
//SYSPRINT DD SYSOUT=*                              
//SYSUT1   DD DISP=SHR,DSN=DATA.SET    
//SYSUT2   DD SYSOUT=(H,SMTP)                        
//SYSIN    DD DUMMY                                  
//*                                                  

 


This last step is not executing with a previous step rc=4


//DEL   EXEC PGM=IDCAMS              
//SYSPRINT DD SYSOUT=*              
//SYSIN    DD *                      
 DELETE DATA.SET.DELETE  
 SET MAXCC = 4                      
/*                                  

 
samb01
 
Posts: 427
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: JCL and COND CODE

Postby Robert Sample » Mon Oct 14, 2019 10:03 pm

The system is doing EXACTLY what you told it to do. From the JOB statement COND parameter description in the MVS JCL Reference manual:
Overrides If you code the COND parameter on the JOB statement and on one or more of the job’s EXEC statements, and if a return code test on the JOB statement is satisfied, the job terminates. In this case, the system ignores any EXEC statement COND parameters.
Your JOB statement has COND=(4,LE). A step condition code of 4 means the return code test on the JOB statement is satisfied, hence the job terminates -- just as the manual tells you. And the EXEC COND has absolutely no bearing on what happens.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: JCL and COND CODE

Postby samb01 » Tue Oct 15, 2019 11:59 am

Hello Robert and thank's for your answer.
So how could i do if i want to execute only the last step (a warning by mail) if any RC>= 4 and i don't want to execute the other step if at least one RC is >= 4.

I can't use COND CODE in the job card ?
samb01
 
Posts: 427
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: JCL and COND CODE

Postby NicC » Tue Oct 15, 2019 4:03 pm

Use conditions on the individual EXEC PGM= statements.
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: JCL and COND CODE

Postby Robert Sample » Tue Oct 15, 2019 6:26 pm

I can't use COND CODE in the job card ?
There are times when using COND= on the JOB card makes sense. Your situation is NOT one of them. Based upon what you've posted, you do not want a COND on the JOB card so you'll want to use COND= on each EXEC (as NicC said).
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: JCL and COND CODE

Postby samb01 » Tue Oct 15, 2019 8:33 pm

thank you.
may be i have an other way to do that by using TWS and COND Internal Predecessor.
samb01
 
Posts: 427
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: JCL and COND CODE

Postby Robert Sample » Tue Oct 15, 2019 8:41 pm

may be i have an other way to do that by using TWS and COND Internal Predecessor.
Since I don't use TWS here, I suggest you start reading the manual -- or ask one of your coworkers.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: JCL and COND CODE

Postby samb01 » Wed Oct 16, 2019 8:02 pm

Sorry to disturb you an other time,

ia can't anderstand why the last step FLUSH. i remove de condition code of the job card :


XCHGA       00
XCHGB       00
XCHG1       00
XCHG2       00
XCHG3       00
DELFTP    1262
TESTNSMS    02
SDSFOFF  FLUSH
STEP1    FLUSH
GENMAIL  FLUSH
MAILOK   FLUSH
MAILKO   FLUSH
 


I would like to run : MAILKO because a previous RC is equal to 1262 (DELFTP) et 1262 is greater than 4

this is my jcl :


//MAILOK   EXEC PGM=IEFBR14,COND=(4,LE)                              
//******************************************************
//MAILKO   EXEC PGM=IEFBR14,COND=(4,GT)                              
 


Thank to help me anderstand.
samb01
 
Posts: 427
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: JCL and COND CODE

Postby Robert Sample » Wed Oct 16, 2019 8:19 pm

From the MVS JCL Reference manual (emphasis added by me):
When the program does not have control: For the system to act on the COND parameter, the step must abnormally terminate while the program has control. If a step abnormally terminates during scheduling, due to failures such as JCL errors or the inability to allocate space, the system bypasses the remaining steps, no matter what the COND parameter requests.

You are consistently providing too little information to help you -- for example, WHY did SDSFOFF flush? Was it a space or data set allocation error, which is the situation the manual refers to? In such a case, there is nothing you can do to get your last step to execute.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: JCL and COND CODE

Postby samb01 » Thu Oct 17, 2019 12:14 pm

Sorry Robert, here is the whole JCL :


//JOBCAR01  JOB  S,'XXXXXX',MSGCLASS=I,CLASS=L      
//DELFTP   EXEC PGM=FTP,PARM='(EXIT TRAN CPNT'      
//SYSTCPD  DD DISP=SHR,DSN=TCP.CVFO.USER(DATACVFO)  
//NETRC    DD DISP=SHR,DSN=DATA.TWS.NETRC            
//OUTPUT   DD SYSOUT=*                              
//SYSPRINT DD SYSOUT=*                              
//INPUT    DD *                                      
SRVFTP                                              
ASCII                                                
SENDSITE                                            
CD /DATA                                            
DELETE DATA.SET.CSV                                  
QUIT                                                
//TESTNSMS EXEC PGM=IDCAMS                          
//SYSPRINT DD SYSOUT=*                              
//FILE1 DD DISP=SHR,DSN=DATA.SET.VOLNSMS            
//SYSUDUMP DD SYSOUT=*                              
//SYSIN DD *                                        
 PRINT INFILE(FILE1) -                                              
 DUMP COUNT(1)                                                      
 IF LASTCC = 4 THEN SET MAXCC=2                                    
/*                                                                  
//*                                                                
//IFADEBUT  IF TESTNSMS.RC = 0 THEN                                
//SDSFOFF   EXEC PGM=SDSF                                          
//ISFOUT DD DUMMY                                                  
//ISFIN  DD DISP=SHR,DSN=DATA.SET.DASDAP                            
//*                                                                
//STEP1  EXEC PGM=SORT                                              
//SYSOUT DD SYSOUT=*                                                
//INPUT1 DD DISP=SHR,DSN=DATA.SET.AV                          
//INPUT2 DD DISP=SHR,DSN=DATA.SET.AP                          
//SORTOUT DD DISP=SHR,DSN=DATADATA.DIFF                            
//SYSIN DD DISP=SHR,DSN=DATA.SET.SYSCOMP2        
//GENMAIL  EXEC PGM=IKJEFT01,DYNAMNBR=30,REGION=5000K                
//SYSEXEC  DD DISP=SHR,DSN=DATA.PARAM                                
//IN       DD DISP=SHR,DSN=DATADATA.DIFF                            
//SYSTSPRT DD SYSOUT=*                                              
//OUT      DD DISP=SHR,DSN=DATA.SET.FIXE                            
//*%OPC BEGIN ACTION=NOSCAN                                          
//SYSTSIN  DD *,SYMBOLS=EXECSYS                                      
 %REXX01                                                          
//*%OPC END ACTION=NOSCAN                                            
//IFAFIN    ENDIF    
//MAILOK   EXEC PGM=IEBGENER,COND=(0,NE)                              
//SYSPRINT DD SYSOUT=*                                                
//SYSUT1   DD DISP=OLD,DSN=MAIL.GOOD.FIXE              
//SYSUT2   DD SYSOUT=(H,SMTP)                                        
//SYSIN    DD DUMMY                                                  
//MAILOK   EXEC PGM=IEBGENER,COND=(0,EQ)                      
//SYSPRINT DD SYSOUT=*                                        
//SYSUT1   DD DISP=OLD,DSN=MAIL.ABEND.FIXE      
//SYSUT2   DD SYSOUT=(H,SMTP)                                
//SYSIN    DD DUMMY                                          
 
 


the step with a RC=1262 is a FTP Delete . If the dataset to delete does not exist, the step have a RC=1262. And it is the case.

the three steps :

SDSFOFF FLUSH
STEP1 FLUSH
GENMAIL FLUSH

Flush because of the condition IF


//IFADEBUT  IF TESTNSMS.RC = 0 THEN
...
//   ENDIF
 
samb01
 
Posts: 427
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Next

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post