Page 1 of 2

Return code 4000

PostPosted: Mon Mar 28, 2011 11:31 pm
by Tim
I'm trying to write a short program that will set a completion code of 4000 (0xFA0). Will this do it? (Plagiarized from http://en.wikipedia.org/wiki/IEFBR14). Thanks!

JRC4000 START
        USING JRC4000,15
        B     GO
        DC    AL1(L'ID)
ID      DC    C'JRC4000'
        DS    0H
GO      L     R15,=x'FA0'
        BR    14
        END   JRC4000

Re: Return code 4000

PostPosted: Mon Mar 28, 2011 11:33 pm
by NicC
one way to find out real quick

Re: Return code 4000

PostPosted: Mon Mar 28, 2011 11:36 pm
by Tim
Not for me there isn't.

Re: Return code 4000

PostPosted: Mon Mar 28, 2011 11:41 pm
by NicC
Ah - forgot you are not an MVS person/programmer. I am not the worlds greatest assembler programmer so I would have to assemble/link/execute to see if it really works. However, some bright spark will be along before I could do all that.

Re: Return code 4000

PostPosted: Tue Mar 29, 2011 12:14 am
by BillyBoyo
In glorbrik this would be something like the word "return" and the value you want to return.

Re: Return code 4000

PostPosted: Tue Mar 29, 2011 12:27 am
by Tim
Touche! :)

Although, I should point out I simply plagiarized it from wikipedia.

Re: Return code 4000

PostPosted: Tue Mar 29, 2011 12:31 am
by Tim
In fact, my question is really much simpler. Will this line of code place 4000 into register 15?

GO L R15,=x'FA0'

And, just out of curiosity, is this equivalent?

GO L R15,=4000

Re: Return code 4000

PostPosted: Tue Mar 29, 2011 12:39 am
by steve-myers
If you're not sure of something, try it! Here's my take, though it has not been tested.
RC4000   RSECT
         LA    15,4000
         BR    14
         END   RC4000

Other people made good suggestions, my example is the requirement reduced to the absolute minimum. I used RSECT rather than CSECT for two reasons.
  • RSECT implies that the CSECT is read only, and the Assembler applies the same tests as specifying RENT.
  • The read only attribute is carried into the load module. No verification is done, but it's there.
The read only attribute is used when linking the z/OS nucleus. The nucleus loader (which is part of the IPL procedure) uses it, but I no longer recall how it's used. Not that any of us are going to relink the nucleus. It's been 30 years, probably longer, since I've done it.

Re: Return code 4000

PostPosted: Tue Mar 29, 2011 12:55 am
by BillyBoyo
In the 5th post of the original thread you saw an example of setting the return code/condition code/reason code whatever we call it. Can't say I've ever seen 4000 come out of IDCAMS, but worth a try to check, could save you writing, assembling, linking, plus all your testing/release procedures.

Re: Return code 4000

PostPosted: Tue Mar 29, 2011 1:15 am
by Tim
I never did understand what was going on with IDCAMS. I looked it up and found it is used to generate and modify datasets, but figured maybe this was some trivial use of the program. Then there was the part about "obviously this can't be done as instream, but hopefully you get the gist", and as I'm sure you now realize, I didn't come close to getting the gist. But it seemed like the end result was to return a completion code of 0, which as I now understand things, wouldn't have helped since the job completion code was still going to be the highest value from any step in the job.

My "program" is really just the IEFBR14 utility with one instruction changed to store 4000 instead of 0 in register 15, and I don't even know if I got that right.