Set Return code higher than 4095



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Set Return code higher than 4095

Postby pranav283 » Thu Dec 17, 2015 6:45 pm

Hi,
I have a COBOL-DB2 program where I am setting the value of RETURN-CODE register as 4200 (greater than 4095).
Thus, I expect the job to abend with RC-104 (4200-4095). Instead, the job is abending with a RC-12 only.

However, the return code register still contains the value of 4200 as I checked by routing its value in an error file and opening the file in a proper format considering the fact that RETURN-CODE has an implicit definition of S9(4) USAGE BINARY.
Also, there is no information in the CEEDUMP, SYSUDUMP and even SYSABEND so that I could at least figure out if in case moving a value greater than 4095 would make the job abend with RC-12 in my language environment:
z/OS - V1.13.
COBOL - OS/390.

Let me know in case someone needs further details.

Thanks,
Pranav
pranav283
 
Posts: 47
Joined: Sat Aug 30, 2014 3:52 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Set Return code higher than 4095

Postby Akatsukami » Thu Dec 17, 2015 7:17 pm

  1. You are not describing an abend, but a normal ending with a non-zero return code; this need not indicate an error.
  2. You cannot set a return code (or, indeed, an abend code), outside the range of 0-4095. Period.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Set Return code higher than 4095

Postby pranav283 » Thu Dec 17, 2015 8:10 pm

Akatsukami,

1.You are not describing an abend, but a normal ending with a non-zero return code; this need not indicate an error.
- What do you mean by this ? And yes, while moving a value of 99 to the return-code register, my job does abend withe rc of 99.

2.You cannot set a return code (or, indeed, an abend code), outside the range of 0-4095. Period.
- Yeah, I will correct my statement. I am not setting it, rather moving 4200 to it. However, I believe the return-code register can contain a value more than 4095. I checked it. Pay a visit to this link - http://ibmmainframes.com/about40962.html.

Please help me out with this. I guess assembly language will only set the registers. But I want to understand what exactly happens while passing the return-code to the job.

Thanks,
Pranav
pranav283
 
Posts: 47
Joined: Sat Aug 30, 2014 3:52 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Set Return code higher than 4095

Postby Robert Sample » Thu Dec 17, 2015 8:43 pm

However, I believe the return-code register can contain a value more than 4095.
What you believe is not important. The fact is, the return code is limited to 12 bits and hence values in the range 0 to 4095 are all you are allowed to use. And "COBOL OS/390" is not a version of COBOL that has ever run on the mainframe -- COBOL for MVS & VM, for example, is a version that did run on the mainframe.
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: Set Return code higher than 4095

Postby Akatsukami » Thu Dec 17, 2015 8:43 pm

pranav283 wrote:Akatsukami,

1.You are not describing an abend, but a normal ending with a non-zero return code; this need not indicate an error.
- What do you mean by this ? And yes, while moving a value of 99 to the return-code register, my job does abend withe rc of 99.

Again: your terminology is incorrect. Setting a return code does not cause the program to abend. Use the dispositive processing of a data set by JCL to see this.

AFAIK, there is no way through COBOL alone to cause a program to abend, although a COBOL program can easily call the LE services CEE3ABD and CEE3AB2 to terminate a program with an actual abend.

2.You cannot set a return code (or, indeed, an abend code), outside the range of 0-4095. Period.
- Yeah, I will correct my statement. I am not setting it, rather moving 4200 to it. However, I believe the return-code register can contain a value more than 4095. I checked it. Pay a visit to this link - http://ibmmainframes.com/about40962.html.

But, as Mr. Sample points out in that thread, the value will be interpreted modulo 4096. This is because the high nybble is not interpreted as part of the value, but as flags (which are set by the machine code, so you cannot manipulate them by using a return code greater than 4095.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Set Return code higher than 4095

Postby BillyBoyo » Thu Dec 17, 2015 10:06 pm

A non-zero RC/CC is not an abend.

The RETURN-CODE special-register can indeed have a value outside the range 0-4095, but if so, it will be reported by JES as though it were within that range. If you look at the hex value of the decimal value you are setting, pretend the left-most nybble is zero, and convert that value to decimal, you get your 12.

The COBOL special-register can accurately contain values beyond 4095. JES cares not one jot about that, so it is no use for attempting see an RC/CC greater than 4095. You can make use of a higher value within your COBOL program.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Set Return code higher than 4095

Postby UserName » Thu Dec 17, 2015 10:37 pm

If you are moving 4200 to RETURN-CODE then you should get RC=0104 (considering it's a normal end).

If you are moving correctly but not getting RC as 0104 then something else must be interfering.
UserName
 
Posts: 3
Joined: Thu Dec 17, 2015 10:30 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Set Return code higher than 4095

Postby BillyBoyo » Thu Dec 17, 2015 11:50 pm

You're right, UserName.

I didn't notice the DB2 bit.

pranav283, can you show your JCL? Also, are there any messages in the output from your job?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Set Return code higher than 4095

Postby UserName » Fri Dec 18, 2015 3:43 am

What utility are you using to run the cobol-db2 program?

I believe your program is issuing an abend before you could set the return code and you are using IKJEFT01 to get RC=12.
UserName
 
Posts: 3
Joined: Thu Dec 17, 2015 10:30 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Set Return code higher than 4095

Postby pranav283 » Fri Dec 18, 2015 12:22 pm

Hi @usrname, @BilliBoyo, I am using IKJEFT01 to execute the program.
No. the program is issung the abend only when I want it to.
I am deliberately making the program abend when there is not even a single row fetched in the cursor. Hence, SQLCODE 100.
So, using a IF structure, if SQLCODE is 100 and the cursor-counter is zero, I am treating this as an abend by moving 4200 to return-code immediately followed by a STOP RUN.

@BilliBoyo

This is my step:

//R010     EXEC PGM=IKJEFT01
//STEPLIB  INCLUDE MEMBER=SLIBDUMM
//         INCLUDE MEMBER=SLIBDEV1
//         INCLUDE MEMBER=SLDBTDB2
//FILEO1   DD DSN=TSOPKUL.GMRFTCSD.R010,DISP=(,CATLG,),
//         DCB=(LRECL=50,RECFM=FB),
//         SPACE=(TRK,(10,20),RLSE),
//         UNIT=SYSDA,
//         STORCLAS=PERM
//FILEE1   DD DSN=TSOPKUL.ERRFILE.R010,DISP=(,CATLG,),
//         DCB=(LRECL=48,RECFM=FB),
//         SPACE=(TRK,(10,20),RLSE),
//         UNIT=SYSDA,
//         STORCLAS=PERM
//*        AVGREC=K
//SYSOUT   DD SYSOUT=*
//CEEDUMP  DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSUDUMP DD DSN=TSOPKUL.GMRFTCSD.R010.SYSUDUMP,DISP=(,CATLG,),
//            DCB=(RECFM=VB,BLKSIZE=800),
//            SPACE=(TRK,(90,90),RLSE),
//            UNIT=SYSDA,
//            STORCLAS=PERM
//SYSABEND DD DSN=TSOPKUL.GMRFTCSD.R010.SYSABEND,DISP=(,CATLG,),
//            DCB=(RECFM=VB,BLKSIZE=800),
//            SPACE=(TRK,(90,90),RLSE),
//            UNIT=SYSDA,
//            STORCLAS=PERM
//SYSTSIN  DD *
      DSN SYSTEM(TDB2)
      RUN PROGRAM(CDFETCSP) PLAN(CDFETCSP)
      END


This is the SYSOUT O/P:
SQLCODE: 0000000100
WS-CURS01-PTR: 000000000
NO ROWS FOUND FOR
DB2 ABEND


This is the error file that was loaded with the value of the return-code passed: TSOPKUL.ERRFILE.R010
FILEE1-STATIC-REC     FILEE1-RETURN-CODE  FILLER
C(20) (1-20)          B(4) (21-22)        C(26) (23-48)
--------------------  ------------------  --------------------------
********************************* TOP OF DATA **********************
RETURN-CODE:          4200                ..........................
pranav283
 
Posts: 47
Joined: Sat Aug 30, 2014 3:52 pm
Has thanked: 2 times
Been thanked: 0 time

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post