Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

how the change the value of return codeHelpful Member! 

deveshjogal (Programmer)
16 May 03 11:53
Hi everybody

I have a requirement. I dont know how to change the value of Return Code parameter (RC) in JCL. My requirement is that if previous step's RC < 13 then dont execute the next step but the final RC should be zero. I am able to skip the step using the COND parameter. Also I know the syntax IF RC < 13 THEN  to check return code but dont know how to set it to value zero. Appreciate any help.

Thanks
Devesh
Truusvlugindewind (Programmer)
16 May 03 13:52
You mean from COBOL?  This is a cobol forum so you'll get a cobol answer.
Tty this:

move zero to RETURN-CODE.
STOP  RUN


or this:

GOBACK  0
webrabbit (MIS)
16 May 03 13:55
You can execute IEFBR14 to get a return code of zero.  The orginal version of IEFBR14 returned a very high random return code, but IBM has since fixed it.
Lunker (Programmer)
17 May 03 23:19
Each job step has its own return-code.  You can set a return code the way the other posts say, but you're still going to have a return code of 13 from your previous step.  
Helpful Member!  slade (Programmer)
18 May 03 1:23
Hi Dev,

Why do you need a zero RC at EOJ (you said "final RC", so I'm assuming EOJ)? What good things are you expecting to happen?  It might help us to devise a solution.

Thanx, Jack.
deveshjogal (Programmer)
19 May 03 10:11
Hi eveybody

Its look like I have confused you to some extent. Let me put in simple words.

This Job checks for existance of a file and if it exists then it FTP the file. Now the first step which check for the existance of a file returns 12 if the file doesnt exists. The next step which FTP the file will check this RC and will execute only if the RC is zero. So in case if the file doesnot exist(This is a valid condition), then the job returns 12. And this sometime disturbs my job monitoring people and they call me at midnight. The Job documention does discuss this. But they are not suppose to look at it.
So its better if I can set the MAXCC to zero irrespective of the existance of file.
webrabbit (MIS)
19 May 03 13:08
They are not supposed to look at the job documentation!?  That is what the job documentation is for!
dhecht (MIS)
19 May 03 19:04
In a COBOL progam you can set the RETURN-CODE system variable  which will populate that value in the LASTCC and MAXCC variables in the JCL.

You can check LASTCC (the return code of the last step) or MAXCC (the highest return code for all steps) implicitly by coding the COND= statement on the EXEC card or explicity by IF THEN ELSE LOGIC with LASTCC or MAXCC as the argument.

You can also SET MAXCC and SET LASTCC within the JCL if you want the job to always end with a zero return code.
kkitt (Programmer)
19 May 03 19:37
What routine are you using to check for the file existing?  Sound like using DFSORT, this will return a 12 if file is empty, this will mess up most shops that look at 8 and greater as an error.

I have used the following for quite a few application like this:

This will attempt to print 1 line out of the dataset. if unable to do that then set the MAX RC to 1. This return code can then be check to allow processing to continue. The



//*
//****************************************************
//* CHECK IF E-MAIL HAS BEEN GENERATED OUT OF MCEPO02
//****************************************************
//DSCNT1   EXEC PGM=IDCAMS,REGION=4096K
//SYSPRINT DD SYSOUT=*
//PRTDD    DD DSN=MC.PERM.EDI.EMAIL,DISP=SHR
//SYSIN    DD *
   PRINT IFILE(PRTDD) COUNT(1)
   IF LASTCC NE 0 THEN SET MAXCC = 1
/*
//DSCNT1A  IF  DSCNT1.RC = 0 THEN
//*
//*   Add addional step here
//*
//DSCNT1F   END


We have even got this very usefull in determing which steps in a job to perform based off data in none of the files, 1st file, 2nd file or both by the following code (comments in () and need to be removed):



PRINT IFILE(PRTDD) COUNT(1)
IF LASTCC EQ 0 THEN DO -
   SET MAXCC = 2                 (default to second file)
   PRINT IFILE(PRTD1) COUNT(1)
   IF LASTCC EQ 0 THEN -
      SET MAXCC = 0              (both files data)
   ELSE -
      SET MAXCC = 1              (1st file only has data)
END
ELSE DO                      (only here if 1st empty)
   PRINT IFILE(PRTD1) COUNT(1)
   IF LASTCC EQ 0 THEN -
      SET MAXCC = 2              (2nd file has data only)
   ELSE -
      SET MAXCC = 3              (no files have data)
END



As you can see the use of Idcams to check if the file has data can be very useful.
Crox (Programmer)
20 May 03 4:21
Hi,

I was surprised about the GOBACK statement with an extra option. It seems to be that this option is not available on the mainframe, looking at the COBOL 390 2.2 manual.

Regards,

   Crox

X 6.2.17 GOBACK statement





X The GOBACK statement functions like the EXIT PROGRAM statement when it is
X coded as part of a called program (or the EXIT METHOD statement when it is
X coded as part of an invoked method) and like the STOP RUN statement when
X coded in a main program.



X The GOBACK statement specifies the logical end of a called program or
X invoked method.


 X  ___ Format _____________________________________________________________
 X |                                                                        |
 X | >>__GOBACK__________________________________________________________>< |
   |                                                                        |
   |________________________________________________________________________|


X A GOBACK statement should appear as the only statement or as the last of a
X series of imperative statements in a sentence because any statements
X following the GOBACK are not executed. It must not be used in a
X declarative procedure in which the GLOBAL phrase is specified.



X If control reaches a GOBACK statement while a CALL statement is active,
X control returns to the point in the calling program immediately following
X the CALL statement, as in the EXIT PROGRAM statement.



X If control reaches a GOBACK statement while an INVOKE statement is active,
X control returns to the point in the invoking program or method immediately
X following the INVOKE statement, as in the EXIT METHOD statement.



X In addition, the execution of a GOBACK statement in a called program that
X possesses the INITIAL attribute is equivalent to executing a CANCEL
X statement referencing that program.



X The table below shows the action taken for the GOBACK statement in both a
X main program and a subprogram.


    _____________ ______________________________ ______________________________
 X | Termination |                              |                              |
 X | statement   | Main program                 | Subprogram                   |
   |_____________|______________________________|______________________________|
 X | GOBACK      | Return to calling program.   | Return to calling program.   |
 X |             | (Can be the system and thus  |                              |
 X |             | causes the application to    |                              |
 X |             | end.)                        |                              |
   |_____________|______________________________|______________________________|






3gm (Programmer)
20 May 03 10:11
Just before the end of your job, can't you insert the following:

// SET MAXCC = 0

???

Regards.

Glenn
slade (Programmer)
20 May 03 15:58
Hi Glen,

As far as I know "// SET MAXCC = 0" cannot be used in the JCL stream. It can be used in IDCAMS SYSIN, but I'm not sure if MAXCC refers to the RC for the entire job or just the functions executed by IDCAMS for that step.

Also, in spite of the fact that it might reset the job RC, the original MAXCC may be retained and displayed in SYSOUT for the job monitoring people to see.

Devesh might want to give it a try though.

Regards, Jack.
samiksaha (Programmer)
20 May 03 22:39
Hello Devesh,

Hope you have found the answer till now but I can tell you how I would have solved such problems:

1)If your job is just to check the file is there or not and if its there it will do an FTP,you can put a file dependency on the job ie as soon as the file will be there JOBTRAC will trigger the job else it will wait till it gets the file.

2)Or you can introduce a SELCOPY step just after the file check step,that in case the RC is 12 to SET RC=0,but for that you should be using SELCOPY.I generally use SELCOPY to avoid such hassles.

3) If you are telling it is related to job abend then execute a WATCHMSG step for RC=12.If RC=12 the step will execute else it will get flushed.

There can be lots of ideas to avoid this but I am not sure of your code.

regards,
Samik
PeterPimm (Programmer)
21 May 03 10:46
Hi there,try

SET MRCZERO

Regards, PeterPimm.
deveshjogal (Programmer)
22 May 03 12:54
Hi everybody

I tried most of the option, but what Slade mentioned is absolutely true. I cant use //SET MAXCC = 0 directly in JCL it gives me unknown operator error. Also as he mentioned its look like  u cannot set MAXXCC value in other step. When I tried to set the MAXCC inside a step executing IDCAMS it sets for that step only and not for the entire job. The final MAXCC is always the highest RC of all executed steps.
Also failed with SET MRCZERO giving the same unknown op.. error.

The only option I didnt try was using IEFBR14. Webrabbit can you post the code for me ??

For anyones interest, here is my code

//********************************************************
//*    CHECK IF THE FILE IS EMPTY OR NOT                  
//********************************************************
//MR100010 EXEC PGM=IDCAMS                                
//DD1      DD DSN=xyz.MR100010.abcTRAN,DISP=SHR       
//DD2      DD SYSOUT=*                                    
//SYSPRINT DD SYSOUT=*                                    
//SYSIN   DD *                                            
 REPRO -                                                  
 INFILE(DD1) -                                            
 OUTFILE(DD2) SKIP(1) COUNT(0)                            
//********************************************************
//*    FTP PBMS EDUCATION FILE IF NOT EMPTY               
//********************************************************
//MR100020 EXEC PGM=FTP,COND=(4,LT),REGION=2048K,         
//             PARM='133.165.198.356 (TIMEOUT 720 EXIT'    
//SYSPRINT DD SYSOUT=*                                    
//OUTPUT   DD SYSOUT=*                                    
//INPUT    DD *                                           
jfdfjl
fjkdjfd
PUT 'xyz.MR100010.abcTRAN'  /univid_mail/pbmsemp.txt  
QUIT                                                      
/*                                                        
//*_______________________________________________________
//*   ZEKE STEP                                           
//*_______________________________________________________
//STEPCHK  EXEC PGM=ZEKESET                               
//SYSPRINT DD SYSOUT=*                                    
//SYSIN    DD *                                           
  SET ABEND 99 IF HIGHCOND GT 12                          
/*                                                        
//*_______________________________________________________                                             

I guess it may be possible in case of FTP to use some other way to check whether there are records or not. But what I feel more important now is it  possible to set the MAXCC variable or not.


Thanks all

Devesh
dhecht (MIS)
22 May 03 13:04
set maxcc and set lastcc work directly in the jcl without forward slashes
slade (Programmer)
22 May 03 22:51
Hi dhecht,

Could you point me to a manual that discusses this feature. I couldn't find anything in the JCL manuals.

Thanx, Jack.
slade (Programmer)
22 May 03 23:17
Hi Devesh,

HAVE YOU TRIED THIS AS YOUR LAST STEP?
It might work; worth a shot.

//MR100030 EXEC PGM=IDCAMS                                
//SYSPRINT DD SYSOUT=*                                    
//SYSIN   DD *                                            
 IF MAXCC GE 0 THEN -
    SET MAXCC  = 0  -
    SET LASTCC = 0      
/*

Regards, Jack.
deveshjogal (Programmer)
23 May 03 9:33
Hi Jack

Yes, I tried that yesterday. But that changes Rc of that particular step only not the MAXCC of the job.

The only option I didnt try was using IEFBR14 as suggested by webrabbit. Webrabbit can you post the code for me ??

Thanks in advance
Devesh
3gm (Programmer)
23 May 03 10:05
IIRC, you only need the following to execute IEFBR14:

//STEPX EXEC PGM=IEFBR14

The program gets its name because (at least as it was originally designed), it executes one instruction: BR 14 (Branch Register 14, i.e. return to the caller).  I'm guessing it has since been changed and at least sets Register 15 to zero to give the step a return code of zero.  It likely doesn't change MAXCC in any way.  

Glenn
slade (Programmer)
23 May 03 18:55
Ok Devesh,

I think I've go a solution for you. You may not want to use it, but it IS a solution:


1) Take your FTP step (MR100020) and make a job out of it (i.e., slap a JOBCARD on it) and make it a member of your shop's JOBLIB or any PDS, for that matter.

2) Modify your JCL as shown below:

//********************************************************
//*    CHECK IF THE FILE IS EMPTY OR NOT                  
//********************************************************
//MR100010 EXEC PGM=IDCAMS                                
//DD1      DD DSN=xyz.MR100010.abcTRAN,DISP=SHR       
//DD2      DD SYSOUT=*
//ftpDD    DD DSN=xyz.your.shops.joblib(ftpjob),DISP=SHR
//RDRDD    DD SYSOUT=(,INTRDR)  
                     
//SYSPRINT DD SYSOUT=*                                    
//SYSIN   DD *                                            
 REPRO -                                                  
 INFILE(DD1) -                                            
 OUTFILE(DD2) SKIP(1) COUNT(0)                            
 IF MAXCC GT 0 THEN -
    REPRO -                                                 
    INFILE(ftpDD) -                                         
    OUTFILE(RDRDD)                            
    SET MAXCC  = 0  -
    SET LASTCC = 0      
/*

This puts everthing in the IDCAMS step, which allows you to change the RC before the step ends.

BTW, the INTRDR is an internal reader used by JES. When you write JCL to it via a utility or a user written pgm, the JOB or JOBs are automatically submitted to the JES input Q for processing.  
slade (Programmer)
27 May 03 15:57
I followed Devesh's style assuming he knew that the file would always exist, but sometimes be empty. This is a pretty good assumption, since he's the guy who creats the file. But it might be a good idea to plan for your situation, to be on the safe side.

You can change:

INFILE(DD1) -

to:

INDS(xyz.MR100010.abcTRAN) -

in both places. Don't know if you can mix and match INDS/OUTFILE. If not change OUTFILE too. Don't forget to get rid of the associated DD cards in the step. This prevents a JCL error if the I/P dataset doesn't exist.

As I recall, empty (no data w/EOF marker) = RC4, not there or empty w/o EOF marker = RC12. You can run a test to verify.

Regards, Jack.
WMK (Programmer)
2 Jun 03 14:40
In answer to the earlier question requesting the reference for "//SET" - see:

 http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/iea2b631/25.0

I have *not* (personally) used this syntax with "MAXCC" - but it does show you the general "//SET" format.
slade (Programmer)
2 Jun 03 22:18
Hi WMK,

The reference you cited in your post documennts the use of the SET cmd to set (or reset) the value of a symbolic parameter. These start with an ampersand (&), for example &MYACCT and are used to provide variable values to JCL parameters or parts of JCL parameters.

The SET command is also used in IDCAMS cntl cards to set (or reset) a return code issued by IDCAMS as a result of processing one of its many commands. But the MAXCC and LASTCC that it manipulates are confined to the executing step that contains the //SYSIN DD card in which the SET command resides.

Regards, Jack.  

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close