Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return Code Register

Status
Not open for further replies.

TJ2

Programmer
Oct 31, 2002
5
US
In my MVS Cobol program, the value in the Return Code register after a Write to a VSAM file = 16448. This is causing this step in my JCL to end with a RC=12. Since the VSAM status code = 00, the record is written to the file but the job does not abend so, I do not have any other details regarding this problem.
Also, if the field has a Pic S9(4) definition, how can it contain 5 digits?
Any help on finding details regarding this return code of 16448 would be appreciated.
Thank You.
 
Well, for what it's worth, 16448 in binary is X'4040' which is EBCDIC spaces. (S9(4) COMP fits in one halfword; a halfword can contain 2^16 - 1 or 65535. Check the TRUNC option to see how your compiler is set to handle this situation.)

You said the RETURN-CODE special register contains 16448. Are you moving anything (spaces?) to RETURN-CODE? Call a subroutine that might be doing so?

Good luck.

Glenn
Brainbench MVP for COBOL II
 
Thanks for responding. I am not calling any other programs or moving anything to return-code.
 
Hmmm, you use the term RETURN CODE twice. The 12 is obviously the program return code; is the other one actually a file status? Usually, one does not interrogate the program return code in a COBOL program. The program moves 12 to Return-code?

Stephen J Spiro
Wizard Systems
 
Do I understand correctly? The program is running successfully in all regards EXCEPT that the return code is not set to zero? If so, why don't you MOVE ZERO TO RETURN-CODE just before you STOP RUN?

Glenn
 
Moving 0 to Return code in this manner would prevent future problems from being caught/identified.
 
What problems would you catch? As I understand it, the value of the RETURN-CODE special register is placed in Register 15 at the time of STOP RUN. The program's RETURN-CODE special register is updated with the contents of R15 if you call a subprogram. If you're not calling any other routines, there's no one else to set the RETURN-CODE special register but you. You get to decide when/how it gets set.

So . . ., if you have determined that an error occurred that needs to set RETURN-CODE, do so and then STOP RUN. (In many shops, a special routine is called when you want to force a USER ABEND due to a program-detected problem rather than rely simply on checking condition codes in the JCL.)

Is there something I have missed here?

Glenn
 
Move ZERO to Return Code BEFORE attempting any calls or IOs.
 
Glenn,
Thanks. I do have the routine to force user abends at the appropriate places but, I guess I really just wanted to understand why my job was completing with RC=12 when it wasn't abending during execution. This return code seemed to be causing the problem and I wanted to understand why before I made the decision to reset it to zero.
TJ2
 
One possibility is that you've got an array out of bounds or a reference modification that's hitting the TGT (Task Global Table) where COBOL keeps the RETURN-CODE special register. Have you compiled and run with SSRANGE turned on to do bounds checking?

Glenn
 
TJ2,

Are you CALLing any subroutines? It might be a good idea to provide your pgm code since the problem could be caused by inadvertant actions taken anywhere in the pgm.

Regards, Jack.
 
TJ2,
When you are referring to the return code, do you actually mean the Special Register RETURN-CODE? If so, how do you know it has got a value of 16448? What are you using to determine this is the value? As Glenn pointed out earlier in this thread, 16448 is the equivalent of a field defined as COMP, that has spaces in it. I suspect that you may well be chasing red herrings, or maybe your diagnostic tools are not helping.

I'm going to guess your return code 12 problem is not to do with having spaces in a RETURN-CODE register, but lies elsewhere.

Look forward to your thoughts.

Marc
 
I'm not calling any subroutines.
The job ends with a RC=12 with all of the following values in the special register return code:
16611, 16448, 16581, 16599, 16624, 19264
I am moving the special register value to a field defined in working storage as follows:
01 RETURN-CD PIC S9(7) COMP-3.
 
All of those return code values are the binary equivalent of some textual information. I'd take long odds that you're overwriting storage somewhere/somehow. Again, have you run with SSRANGE turned on?

Glenn
 
TJ2,

Your best bet is to post your code and let us look at it. Someone might spot something.

If you send it, click on "Preview Post" and read "Editing Tips" there to learn how to encapsulate your code using the "code /code" tags. This will maintain the original format of the code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top