Setting return code of Co:Z Launch job step

General discussion of the Co:Z Toolkit
Post Reply
sctebnt
Posts: 30
Joined: Mon Nov 02, 2009 10:47 pm

Setting return code of Co:Z Launch job step

Post by sctebnt »

How can I have complete control over the return code of the job step running Co:Z Launcher?

Based on what the script is doing I need to set the job step return code to values like: 0, 1, 4, 8, 16, 100, etc...

I also need to be able to set the status of the job step to USER abend codes, such as U2000.

How can this be done when running Co:Z Launcher?

Thanks,

Scott Bennett
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

The exit code from the remote program (shell script) will become the step return code.

There is no mechanism for causing a user abend, but you could have a conditional step that followed and abended based on the return code of the Co:Z Launcher step.
sctebnt
Posts: 30
Joined: Mon Nov 02, 2009 10:47 pm

Post by sctebnt »

I need to have the job step running coz generate the abend code.

Is there a recommended way to execute coz launcher from within a wrapper type program.

For example, could I code something that will preform some pre coz logic such as derive server user name and server name, then execute coz launcher and follow up with post processing logic that could derive the appropriate job step RC/Abend code and if needed abend the job step?

I am open to any language suggestions and code samples.

Thanks,
Scott
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

Scott,

Sure, it is possible to have a program written in almost any language that would invoke the COZLNCH load module and then execute it and get the return code back and then do something. But wouldn't a conditional step (COND= or IF..) in the JCL that invokes an ABEND program accomplish the same thing?
sctebnt
Posts: 30
Joined: Mon Nov 02, 2009 10:47 pm

Post by sctebnt »

Yes, having COND|IF will accomplish almost the same thing. I need to incorporate the use of coz into existing jobs with existing schedules. Because the jobs are existing I also must ensure the job step RC processing is not affected, current STEP1 of the job is monitored by scheduling for a specific RC or ABEND code and after replacing STEP1 with coz, STEP1 must still be the step with the specific RC or ABEND code.

To ensure the current JCL around the step being replaced by coz executes as expected and the schedule monitors also continue to work as expected I would like to have a single job step replacement with the coz launcher and all my pre/post coz logic exist within the same single job step.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

I see.

One way might be to invoke a REXX EXEC from a batch TSO jobstep (adding the DDs that you need for batch TSO, and leaving the rest that COZLNCH uses), and then have the REXX exec us "ADDRESS LINKMVS" to invoke COZLNCH.

The problem with this is that IKJEFT1A will trap user abends and abend with completion code 04C. None of the various batch TSO programs (IKJEFTxx) seem to allow you to abend with your own code. Does it matter to your scheduler which abend code you get?
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

I've never tried it, but "IRXJCL" might be an alternative. I'll play around with it to see if I can come up with something.
sctebnt
Posts: 30
Joined: Mon Nov 02, 2009 10:47 pm

Post by sctebnt »

I like the possibility of using the REXX approach.

The specific value of the ABEND code is important to our processes, if needed we could code up an assembler module to generate the approporate abend code. And call the assembler module when needed.

Do you happen to have examples of calling coz from rexx using ADDRESS LINKMVS?
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

Unfortunately, IRXJCL won't work either. I was able to invoke COZLNCH from REXX just fine, but then when I called a utility program from REXX that did an ABEND, I just get:

IRX0251E User abend code 4093, reason code 00000144.
IRX0255E Abend in host command COZABEND or address environment routine LINKMVS

And then it sets the REXX RC to 4093.

So, it seems to me that an Assembler, C, or COBOL program will be required.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

Here's an example Assembler routine that you can use as a front-end to COZLNCH which will issue an ABEND if the return code is > 0.

You should be able to tweak to issue the ABENDs that you want, assemble and link with RENT,AMODE=31 and put into the STEPLIB (or COZ.LOADLIB) and change COZPROC to use PGM=CALLCOZ.

Code: Select all

CALLCOZ  TITLE  'Front End to COZLNCH'
     SYSSTATE ARCHLVL=2
CALLCOZ  RSECT
CALLCOZ  AMODE 31
CALLCOZ  RMODE ANY
     J     BEGIN
     DC    AL1(27)
     DC    CL9'CALLCOZ'
     DC    CL9'&SYSDATE'
     DC    CL9'&SYSTIME'
BEGIN DS  0H
     BAKR  R14,0
     LR    R12,R15
     USING CALLCOZ,R12
     LR    R5,R1      Save our parmlist
     USING WORKAREA,R13
     STORAGE OBTAIN,LENGTH=WORKLEN
     LR    R13,R1
     XC    WORKAREA(WORKLEN),WORKAREA
*
     LR    R1,R5      Restore original parmlist
     LINK EP=COZLNCH
     LR    R5,R15     Save return code
*
     STORAGE RELEASE,ADDR=(R13),LENGTH=WORKLEN
     LTR   R5,R5      Check return code
     BE    EXIT
*
     WTO   'CALLCOZ - ISSUING ABEND due to RC>0',ROUTCDE=11,DESC=6
     ABEND 1024,REASON=12  U1024/R12
*
EXIT DS    0H
     LR    R15,R5
     PR
     LTORG ,
WORKAREA DSECT
SAVEAREA DS  18F
WORKLEN  EQU *-WORKAREA
     YREGS ,
     END
Post Reply