Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to detect the Job COND used
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: How to detect the Job COND used
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue Feb 09, 2016 8:58 pm    Post subject: Reply to: How to detect job COND
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue Feb 09, 2016 9:56 pm    Post subject: Reply to: How to detect job COND
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

New User


Joined: 01 Sep 2015
Posts: 96
Location: Switzerland

PostPosted: Wed Feb 10, 2016 1:22 am    Post subject:
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: 7910
Location: Bellevue, IA

PostPosted: Wed Feb 10, 2016 1:50 am    Post subject:
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: 1738
Location: Bloomington, IL

PostPosted: Wed Feb 10, 2016 1:50 am    Post subject:
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    Post subject:
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    Post subject:
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: 331
Location: USA

PostPosted: Wed Feb 10, 2016 2:29 am    Post subject: Reply to: How to detect job COND
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    Post subject: Re: Reply to: How to detect job COND
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    Post subject:
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    Post subject:
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

New User


Joined: 01 Sep 2015
Posts: 96
Location: Switzerland

PostPosted: Wed Feb 10, 2016 10:03 pm    Post subject:
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    Post subject:
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    Post subject:
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 User


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

PostPosted: Thu Feb 11, 2016 1:53 am    Post subject:
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    Post subject:
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    Post subject:
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

New User


Joined: 01 Sep 2015
Posts: 96
Location: Switzerland

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

sorry, I couldn't find any reference to the SCHENV value.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts how to DYNAMICALLY write sort cond to... mohamedmubee COBOL Programming 13 Fri Aug 26, 2016 11:46 pm
No new posts COND parameter vs IF THEN ELSE Alks JCL & VSAM 11 Fri Jun 17, 2016 5:28 pm
No new posts How to detect file creation event? vasanthz All Other Mainframe Topics 5 Fri May 20, 2016 1:33 am
No new posts Include Cond issue vickey_dw DFSORT/ICETOOL 6 Tue Mar 29, 2016 8:51 pm
No new posts Repeating input records for variable ... ksouren007 DFSORT/ICETOOL 1 Fri Jul 31, 2015 4:16 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us