Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need Clarification on Return-Code Register

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Thu May 28, 2009 6:41 pm    Post subject: Need Clarification on Return-Code Register
Reply with quote

Hi,

In my COBOL program, i have to error out the program by populating Return-Code register with value of '1000',
so that i can trigger a mail in JCL with RC = 1000. to achieve the above condition, it's enough to populate return-code register with '1000'? Please clarify.

Thanks,
Murali
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7908
Location: Bellevue, IA

PostPosted: Thu May 28, 2009 6:47 pm    Post subject:
Reply with quote

The manual isn't clear enough? See the manuals link at the top of the page.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu May 28, 2009 6:50 pm    Post subject:
Reply with quote

RETURN-CODE Clear enough??
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu May 28, 2009 7:07 pm    Post subject:
Reply with quote

A "STOP" , or "STOP RUN" afterwards would help.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu May 28, 2009 7:09 pm    Post subject: Reply to: Need Clarification on Return-Code Register
Reply with quote

In as much as COBOL defines this as a "REGISTER" (really a misnomer), the compiler treats it as a signed binary-halfword, which has a maximum signed positive value of +32767.

However, there should not be any problem with a value of +1000.

Regards,
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu May 28, 2009 7:39 pm    Post subject:
Reply with quote

Craq Giegerich wrote:
A "STOP" , or "STOP RUN" afterwards would help.


a GOBACK would suffice, also.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri May 29, 2009 12:57 am    Post subject:
Reply with quote

Hello,

For a bit of entertainment/education, try:
Code:

MOVE 4444 TO RETURN-CODE.
GOBACK.
Back to top
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Mon Jun 22, 2009 12:51 pm    Post subject: Reply to: Need Clarification on Return-Code Register
Reply with quote

I used the Below piece of code in Pgm and

Code:

        MOVE '04'             TO RETURN-CODE         
        MOVE 'Data Err in App-def:'                   
                              TO ERROR-ERR-DESC(1:19)
        PERFORM Z1000-DISP-ERR-INFO                   
           THRU Z1000-EXIT                           
        PERFORM Z9999-EXIT-PROGRAM                   
           THRU Z9999-EXIT                           
.
.
 Z9999-EXIT-PROGRAM.     
     STOP RUN.           
 Z9999-EXIT.             
     EXIT.               



In Jcl

Code:

//*EXECUTION OF PROGRAM
//P243CA02   EXEC PGM=IKJEFT1A,TIME=800
.
.
//      IF   P243CA02.RC<4  THEN                                       
//P243BA02   EXEC PGM=IEBGENER,TIME=800                                 
//*                                                                     
//SYSUT1   DD DSN=R243PB.EPC.P7932.EPC.MAILHEAD.COMMON,                 
//            DISP=SHR                                                 
//         DD DSN=R243PB.EPC.M243CA10.ERRLOG,                           
//            DISP=SHR                                                 
//*        DD DSN=R243PB.EPC.P7932.EPC.MAILTRLR.P243CA1S,               
//*           DISP=SHR                                                 
//*                                                                     
//SYSUT2     DD   SYSOUT=(B,SMTP)                                       
//SYSIN      DD   DUMMY,DCB=BLKSIZE=80                                 
//SYSTSPRT   DD   SYSOUT=*                                             
//SYSPRINT   DD   SYSOUT=*                                             
//SYSOUT     DD   SYSOUT=*                                             
//SYSUDUMP   DD   SYSOUT=*                                             
//      ENDIF                                                           
//      IF   P243CA01.RC=4 THEN                                         
//P243BA03   EXEC PGM=IEBGENER,TIME=800                                 
//*                                                                     
//SYSUT1   DD DSN=R243PB.EPC.P7932.EPC.MAILHEAD.ERROR,                 
//            DISP=SHR                                                 
//         DD DSN=R243PB.EPC.M243CA10.ERRLOG,                           
//            DISP=SHR                                                 
//*                                                                     
//SYSUT2     DD   SYSOUT=(B,SMTP)                                       
//SYSIN      DD   DUMMY,DCB=BLKSIZE=80                                 
//SYSTSPRT   DD   SYSOUT=*                                             
//SYSPRINT   DD   SYSOUT=*                                             
//SYSOUT     DD   SYSOUT=*                                             
//SYSUDUMP   DD   SYSOUT=*                                             
//      ENDIF       




my JESMSGLG is

Code:


-J243CA1  P243CA02    04    672    779    .00
-J243CA1  P243BA02 FLUSH      0      0    .00
-J243CA1  P243BA03 FLUSH      0      0    .00


Please let me know why after execution of my program, the Job is not picking up my RC.

Thanks,
Murali
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jun 22, 2009 1:57 pm    Post subject:
Reply with quote

code correctly:

// IF P243CA01.RC=4 THEN
Back to top
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Mon Jun 22, 2009 2:17 pm    Post subject:
Reply with quote

Thanks,

Dick
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Jun 22, 2009 7:35 pm    Post subject:
Reply with quote

Hello,

I still believe something could be learned from this. . . .

Quote:
For a bit of entertainment/education, try:
Code:
MOVE 4444 TO RETURN-CODE.
GOBACK.



Hint: the return code will NOT be 4444. . .
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 785
Location: Chennai, India

PostPosted: Mon Jun 22, 2009 7:49 pm    Post subject:
Reply with quote

Hi Dick,

I got RC as 0348. Wondering... icon_wink.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7908
Location: Bellevue, IA

PostPosted: Mon Jun 22, 2009 7:51 pm    Post subject:
Reply with quote

RC=0348 is expected ....
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 785
Location: Chennai, India

PostPosted: Mon Jun 22, 2009 8:05 pm    Post subject:
Reply with quote

Hi Robert,

Could you please explain it?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7908
Location: Bellevue, IA

PostPosted: Mon Jun 22, 2009 8:34 pm    Post subject:
Reply with quote

A return code is only allowed in the range of 0 to 4095; this limit is mentioned in the JCL Language Reference several times. If a return code greater than 4095 is set, the system reduces it using modulus arithmetic (4096).

4444 - 4096 = 0348, so the return code set in COBOL at 4444 becomes 0348 as far as JES and z/OS are concerned.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue Jun 23, 2009 9:25 am    Post subject: Reply to: Need Clarification on Return-Code Register
Reply with quote

Hi Robert,

Strange but a very good point.

Quote:
If a return code greater than 4095 is set, the system reduces it using modulus arithmetic (4096).


If I move 4096 to the RETURN-CODE register then will 0 get moved to the same after using modulus arithmetic?

If yes, we should be very careful as RETURN-CODE zero is fine.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Jun 23, 2009 9:35 am    Post subject:
Reply with quote

Hello,

Yes, 4096 will cause a return-code zero. . .

Which is why the experiment was suggested. . . . icon_wink.gif
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue Jun 23, 2009 9:50 am    Post subject: Reply to: Need Clarification on Return-Code Register
Reply with quote

Hi Dick,

Quote:
Which is why the experiment was suggested. . . .


Thanks and we welcome all your experiments icon_biggrin.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7908
Location: Bellevue, IA

PostPosted: Tue Jun 23, 2009 5:02 pm    Post subject:
Reply with quote

Aaru: when doing batch FTP with the EXIT parameter, this becomes relevant as FTP errors set the return code as a 5-digit number: 2 digits for the FTP command being executed (16 for GET and 27 for PUT, for example) followed by the 3-digit response code from the server. A common code is 16550, which occurs when you attempt to GET a file that isn't there. The 16550 turns into a 0166 return code for the job step due to modulus arithmetic.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue Jun 23, 2009 5:23 pm    Post subject: Reply to: Need Clarification on Return-Code Register
Reply with quote

Hi Robert,

That was indeed a good information. Will keep this in mind.

Thanks a ton.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts PL/I code tuning/Performance improvement Virendra Shambharkar PL/I & Assembler 4 Mon Dec 05, 2016 11:57 am
No new posts What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am
No new posts IDEAL - Code Retrieval yugendran CA Products 0 Fri Nov 25, 2016 3:27 pm
No new posts DFHWS2LS return value divated CICS 4 Mon Nov 07, 2016 5:44 pm
This topic is locked: you cannot edit posts or make replies. Need to code a Rexx PGM sundaram.naveen CLIST & REXX 18 Thu Oct 06, 2016 6:45 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us