IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to detect the Job COND used


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
tdfs

New User


Joined: 31 Mar 2015
Posts: 18
Location: Italy

PostPosted: Tue Feb 09, 2016 8:34 pm
Reply with quote

Hi, I have a JCL procedure that can be called by several jobs and I need to detect which is the job COND used. I need to do this because if my JCL procedure is run in a job with job COND=(04,LT) that's fine, otherwise I want to cause an abend.
Can this be done? How?

Thanks a lot, regards!

A
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10765
Location: italy

PostPosted: Tue Feb 09, 2016 8:58 pm
Reply with quote

Quote:
Can this be done?

NO
Back to top
View user's profile Send private message
tdfs

New User


Joined: 31 Mar 2015
Posts: 18
Location: Italy

PostPosted: Tue Feb 09, 2016 9:55 pm
Reply with quote

Uhmm... any other way to make sure the job COND is set to a specif value?
Thanks a lot, regards.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10765
Location: italy

PostPosted: Tue Feb 09, 2016 9:56 pm
Reply with quote

Quote:
any other way to make sure the job COND is set to a specif value?

NO
Back to top
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 443
Location: Denmark

PostPosted: Wed Feb 10, 2016 1:22 am
Reply with quote

Well, I beg to differ, it can be done.

What you need is a callable program which does nothing but abend.
So something like this:
Code:
// IF RC GT 4 THEN
//   EXEC PGM=MYABEND
// ENDIF


Been there, done that. Caveat is of course that you need to be able to write and install such a program. Or use a name like NOTEXIST to force an ABEND806-04 - but that would be nasty and misleading.

Sample from a zOS2.2 system:
Code:
// JCLLIB ORDER=(HLA.SASMSAM1)                               
//*                                                           
//A   EXEC HLASMCLG,PARM.C='TERM',PARM.L='RMODE(24),AMODE(31)'
//C.SYSLIB  DD DISP=SHR,DSN=SYS1.MACLIB                       
//          DD DISP=SHR,DSN=SYS1.MODGEN                       
//          DD DISP=SHR,DSN=HLA.SASMMAC2                     
//C.SYSTERM DD SYSOUT=*                                       
//C.SYSIN   DD *                                             
         Equate                                               
         using MYABEND,R12                                   
MYABEND  Amode 31                                             
MYABEND  Rmode 24                                             
MYABEND  Csect                                               
         bakr  14,0                                           
         Abend 1                                             
         end                                                 
//L.SYSLMOD DD DISP=SHR,DSN=your.linklib(MYABEND)
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8569
Location: Dubuque, Iowa, USA

PostPosted: Wed Feb 10, 2016 1:50 am
Reply with quote

Willy Jensen, causing an abend is easy. What do you recommend for the first part -- determining what the job COND code is up until the TS'a program is executed?
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Feb 10, 2016 1:50 am
Reply with quote

Willy Jensen wrote:
Caveat is of course that you need to be able to write and install such a program. Or use a name like NOTEXIST to force an ABEND806-04 - but that would be nasty and misleading.

Why not a HLL program that invokes CEE3ABD or CEE3AB2?
Back to top
View user's profile Send private message
tdfs

New User


Joined: 31 Mar 2015
Posts: 18
Location: Italy

PostPosted: Wed Feb 10, 2016 2:11 am
Reply with quote

Actually, my problem is that if they run my procedure with job COND 00,NE, whenever a step ends with RC 04 the job stops executing.
In order to force them use job COND 04,LT I would like to make the job abend for any smaller COND.
An alternative idea is to add an IDCAMS step to set MAXCC = 4 as first step so that, if they run the job with 00,NE that would be the only step executed but they should check out the spool in order to understand that some steps are missing. Making the job end in abend would be much easier to spot.
Writing a program that just makes the job abend is very easy and I already have it.
Thanks a lot for all your help!

A
Back to top
View user's profile Send private message
tdfs

New User


Joined: 31 Mar 2015
Posts: 18
Location: Italy

PostPosted: Wed Feb 10, 2016 2:15 am
Reply with quote

I read that it may be done reading JES2 data ares but I have no skills nor enough knowledge on this, and St. Google is not helping.
Thanks again, A.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Wed Feb 10, 2016 2:29 am
Reply with quote

So, you mean somebody else writes the Job cards for Your Job and creates it with COND=(0,NE) without knowing that you actually wanted (4,LT) ??

My suggestion is to use COND=EVEN on the steps you want to run even if Job COND is saying (0,NE).

.
Back to top
View user's profile Send private message
tdfs

New User


Joined: 31 Mar 2015
Posts: 18
Location: Italy

PostPosted: Wed Feb 10, 2016 2:31 am
Reply with quote

RahulG31 wrote:
So, you mean somebody else writes the Job cards for Your Job and creates it with COND=(0,NE) without knowing that you actually wanted (4,LT) ??
--> Sad but true icon_sad.gif

RahulG31 wrote:
My suggestion is to use COND=EVEN on the steps you want to run even if Job COND is saying (0,NE).
--> As far as I know it works only in case of abend. I did a few tests but maybe I did something wrong.

Thanks a lot!
Back to top
View user's profile Send private message
tdfs

New User


Joined: 31 Mar 2015
Posts: 18
Location: Italy

PostPosted: Wed Feb 10, 2016 6:54 pm
Reply with quote

How about reading the COND from JES2 data areas?

Thanks!

A
Back to top
View user's profile Send private message
tdfs

New User


Joined: 31 Mar 2015
Posts: 18
Location: Italy

PostPosted: Wed Feb 10, 2016 8:01 pm
Reply with quote

According to IBM (http://www-01.ibm.com/support/knowledgecenter/SSLTBW_2.2.0/com.ibm.zos.v2r2.hasd100/hasd100390.htm), condition code is stored here:
998 (3E6) BITSTRING 2 JCTJTCC(0) CONDITION CODE

Unfortunately I don't know how how to read this with a progam icon_smile.gif
Back to top
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 443
Location: Denmark

PostPosted: Wed Feb 10, 2016 10:03 pm
Reply with quote

Sorry, seems I misunderstood the question.
This assembler program will abend if the jobcc is not 0:

Code:
         Equate                                           
         using GETJOBCC,R12                               
GETJOBCC Amode 31                                         
GETJOBCC Rmode 24                                         
GETJOBCC Csect                                           
         bakr  14,0                                       
         lr    r12,r15                                   
         sam31                                           
         la    r13,save1                                 
                                                         
         L     r4,16                     -> CVT           
         L     r4,0(,r4)                 -> TCBWORDS     
         L     r4,4(,r4)                 -> CURRENT TCB   
         l     r4,TCBJSTCB-TCB(,r4)      -> jobstep tcb   
         l     r4,TCBJSCB-TCB(,r4)       -> JSCB         
         sr    r5,r5                                     
         icm   r5,7,JSCBJCTA-IEZJSCB(r4) -> JCT           
         la    r5,16(,r5)                found by testing
         using INJMJCT,r5                                 
         clc   JCTCCODE(2),=x'0000'                       
         je    ok                                         
         abend 1                                         
         drop  r5                                         
ok       sr    r15,r15                                   
         pr    ,                                         
save1    ds    18f                                       
         ltorg                                           
                                                         
         Dsect                                           
         IEFAJCTB                                         
         IEZJSCB                                         
         IKJTCB                                           
         End
Back to top
View user's profile Send private message
tdfs

New User


Joined: 31 Mar 2015
Posts: 18
Location: Italy

PostPosted: Wed Feb 10, 2016 10:42 pm
Reply with quote

Awesome! I just tested it and it works perfectly!
Now I just need to add the COND operator, in order to accept only "LT".

Thank you soooooo much!

A
Back to top
View user's profile Send private message
tdfs

New User


Joined: 31 Mar 2015
Posts: 18
Location: Italy

PostPosted: Wed Feb 10, 2016 11:50 pm
Reply with quote

It should be this:
CLC JCTCCODE(1),=X'D3E3'

I'm testing... I'm not so good in ASM icon_smile.gif
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 882
Location: The Universe

PostPosted: Thu Feb 11, 2016 1:53 am
Reply with quote

Mr. Jensen's code may (no guarantees here) get you to the z/OS JCT (mapping macro is IEFAJCTB), not the JES2 JCT, which I think is what is really wanted.

There is a JCTCCODE field in IEFAJCTB, but only in the PL/S structure, not in the Assembler DSECT.

By the way,

CLC JCTCCODE(1),=X'D3E3'

will only test the first byte of X'D3E3'. You really should specify =C'LT', not some mysterious hex codes.
Back to top
View user's profile Send private message
tdfs

New User


Joined: 31 Mar 2015
Posts: 18
Location: Italy

PostPosted: Thu Feb 11, 2016 12:29 pm
Reply with quote

Thanks Steve icon_smile.gif
I'm a very beginner in Assembler but luckily I've a colleague who can deal with it (and teach me something). I was just script kidding, just for not having to wait for my colleague.

I think the program has all desired features now and I have to thank you all! Special thanks to Willy Jensen for z/OS JCT mapping!

A
Back to top
View user's profile Send private message
tdfs

New User


Joined: 31 Mar 2015
Posts: 18
Location: Italy

PostPosted: Sun Feb 14, 2016 2:07 pm
Reply with quote

Hi, I've a new feature I'd like to implement in the same program. I'd like to make sure that first char of jobname is the same as the first char of the job SCHENV.
I managed to read the jobname (JCTJNAME) but I could not find the SHENV. It should be stored in variable JCTSCHEN but I think it stays in an other area not mapped in the program. Any idea?
Willy Jensen can you to the miracle again? icon_biggrin.gif

Thanks you guys, thank you all!
Back to top
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 443
Location: Denmark

PostPosted: Sun Feb 14, 2016 6:19 pm
Reply with quote

sorry, I couldn't find any reference to the SCHENV value.
Back to top
View user's profile Send private message
tdfs

New User


Joined: 31 Mar 2015
Posts: 18
Location: Italy

PostPosted: Sun Feb 14, 2016 7:10 pm
Reply with quote

Oh, thank you anyway WJ!

Maybe I've found an alternative: instead of reading the SCHENV, I can pass DB2 name (that is SCHENV depending) as a parameter to the program and check it. I think this should fit my needs.
Time to go testing! icon_biggrin.gif
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2476
Location: Netherlands, Amstelveen

PostPosted: Sun Feb 14, 2016 9:58 pm
Reply with quote

Quote:
sorry, I couldn't find any reference to the SCHENV value.


It's a WLM parameter. You will have to read the WLM manuals, because it's a bit long to explain.

WLM exits and JES2 use this parameter, and also the completion code information.

So i'm not sure what the TS is trying to accomplish. Writing a TWS/WLM exit?
With in his own words no knowledge of control blocks, exits and assembler?

Quote:
but luckily I've a colleague who can deal with it


So why is that person not asking those questions?
Back to top
View user's profile Send private message
tdfs

New User


Joined: 31 Mar 2015
Posts: 18
Location: Italy

PostPosted: Sun Feb 14, 2016 10:15 pm
Reply with quote

PeterHolland, I'm just writing a program to make sure that my JCL procedure is used in the right way (correct job COND and a SCHENV matching the environment).
I have to do this because other users will make use of my JCL procedure, writing their own JCL jobs but they always try to ignore my guidelines. You know, it's an hard life icon_smile.gif
If I manage to force the job to abend if job COND and SCHENV are wrong, I can force them to use the right parameters. This is why I'm investigating how to do it and I'm almost done.
With respect to my colleague, I can't ask him to work on this task, he is deployed to an other project so I try to collect all information and ask him the less that I can.
Tomorrow I'll test my last idea, I'm confident it will work just fine.

A
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10765
Location: italy

PostPosted: Sun Feb 14, 2016 11:21 pm
Reply with quote

Quote:
I can't ask him to work on this task, he is deployed to an other project so I try to collect all information and ask him the less that I can.


why not...
You are unloading on people that reply on their own time and free of charge problems related to the dynamics of Your organization
icon_evil.gif
Back to top
View user's profile Send private message
tdfs

New User


Joined: 31 Mar 2015
Posts: 18
Location: Italy

PostPosted: Mon Feb 15, 2016 12:12 am
Reply with quote

enrico-sorichetti wrote:
Quote:
I can't ask him to work on this task, he is deployed to an other project so I try to collect all information and ask him the less that I can.


why not...
You are unloading on people that reply on their own time and free of charge problems related to the dynamics of Your organization
icon_evil.gif


Enrico, the scenario is completely different from what you are trying to draw and I'm pretty sure you know it.
I want to figure out how to achieve a result on my own but I don't have enough skills and knowledge. The solution is googleing and asking to experts. My colleague just knows assembler, it does not mean he can find any kind of solution. I asked him how to do it the work an the answer was he does not know how to go from CVT to JSE2 mapping areas. I spent come time googleing and I have found the mapping. Then WJ provided the answer and I went back to my colleague. We replaced a few macros, I did a few changes and the program got to light.
Here, I'm just asking for help, nobody is forced to answer me, nobody if forced to spent time for me or even read the thread. It's awkward I have to write a reply like this!
Please, save some of your spare time and ignore the thread for now on. Thanks for your time.

A
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts include cond ascii constant DFSORT/ICETOOL 4
No new posts Cond parameter JCL & VSAM 10
No new posts JCL COND CODE check JCL & VSAM 5
No new posts Detect break in the sequence DFSORT/ICETOOL 6
No new posts query to fetch record which has only ... DB2 12
Search our Forums:

Back to Top