IDCAMS - HowTo force an Abend if MAXCC GT 0

JES2/3, JCL, utilities.
User avatar
jschreier
New Member
Posts: 1
Joined: Sun Feb 15, 2026 1:52 pm
Austria

IDCAMS - HowTo force an Abend if MAXCC GT 0

Post by jschreier »

Hello @ll,                                                                                                 
is there any possibility to force IDCAMS to get an Abend if MAXXCC GT 0.                                   
The problem is, if IDCAMS gets an RC GT 0, the following BatchJob Step executes also.                      
(In our environment an JCL IF THEN ELSE coding is not a possibility. )                                     
Details:                                                                                                   
Up to zOS Version 3.1 we use a modification of the IDCAMS LISTCRA statement, such as:                      
REPRO INFILE (SYSIT1) OUTFILE (SYSOT1) REPLACE                                                             
IF MAXCC GT 0 THEN LISTCRA INFILE(0)                                                                       
And if the REPRO gets an RC GT 0 this LISTCRA stmt results in an IDCMAS Abend U500, and the BatchJob stops.
Since zOS V3.1 the IDCAMS LISTCRA stmt is no longer supported. (was removed in zOS 3.1)                    
                                                                                                           
IBM itself do not have any solution for us such as                                                         
IF MAXCC GT 0 THEN ABEND xxx    or so on                                                                   
 Any helpful ideas.                                                                                        
Thanks.                                                                                                    
Regards Juergen                                                                                            
Gr Jürgen                                                                                                  
User avatar
zum13
Active Member
Posts: 135
Joined: Thu May 04, 2023 12:58 am

Re: IDCAMS - HowTo force an Abend if MAXCC GT 0

Post by zum13 »

Hello.

The only thing I can think of that might cause an abend termination would be to do something you can't do such as writing to a protected dataset or filling a dataset, but IDCAMS seems to be set up to trap such abends and turn them into CC 12, so that option won't work. The only other alternative would be to have a program that calls IDCAMS and abends if it returns a non-zero condition code.

The IF/THEN/ELSE restriction appears a bit of a strange one. Is this the product of an old JCL verification tool or is it an installation standard? Also, is "COND=" on the EXEC statement forbidden as well? If it isn't, then that would be the way around it.
User avatar
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 855
Joined: Wed Sep 11, 2013 3:57 pm
Greenland

Re: IDCAMS - HowTo force an Abend if MAXCC GT 0

Post by enrico-sorichetti »

write a wrapper to link IDCAMS
and process the return code according to  your organization requirements

if you/your organization have the skills to zap the LISTCRA code

you/your organization should find the task of modifying the included code pretty easy

a quick and dirty wrapper example



Code: Select all

FIXRETC  CSECT
FIXRETC  AMODE 31
FIXRETC  RMODE ANY
         YREGS
         SAVE  (14,12)
         LR    R10,R15
         USING FIXRETC,R10
         LR    R11,R1                  SAVE PARM ADDRESS
         GETMAIN RU,LV=WORKL           GETMAIN WORKAREA
         ST    R13,4(,R1)              ST A(CALLERS S/A) IN MY S/A
         ST    R1,8(,R13)              ST A(MY S/A) IN CALLERS S/A
         LR    R13,R1                  LOAD A(MY S/A)
         USING WORK,R13                ESTABLISH ADDRESSABILITY
         L     R2,0(,R11)              ADDR OF THE PARM
         LH    R3,0(,R2)               PARM LENGTH
         CH    R3,=H'18'               PARM NOT PPPPPPPP,XXXX,YYYY
         BNE   ABEND                   ABEND
         MVC   PGMNAME,2(R2)
         PACK  OLDRC,11(4,R2)
         CVB   R15,OLDRC
         ST    R15,OLDRC
         PACK  NEWRC,16(4,R2)
         CVB   R15,NEWRC
         ST    R15,NEWRC
         LR    R1,R11                  RESTORE R1
         L     R2,0(,R1)               ADDR OF THE PARM
         MVI   1(R2),0                 ZERO PARM LENGTH
         LINK  EPLOC=PGMNAME,SF=(E,LINKL)
         C     R15,OLDRC
         BNE   RETURN
         L     R15,NEWRC
RETURN   DS    0H
         L     R13,4(,R13)             LOAD A(CALLERS S/A)
         ST    R15,16(,R13)
         FREEMAIN RU,LV=WORKL,A=(1)    FREEMAIN WORKAREA
         RETURN (14,12)                RETURN TO CALLER
*
ABEND    ABEND 1001,REASON=(R3)        BAD PARM
         EJECT
         LTORG
WORK     DSECT
SAVE     DS    9D
PGMNAME  DS    CL8                     NAME OF PROGRAM
OLDRC    DS    D
NEWRC    DS    D
LINKL    LINK  EPLOC=PGMNAME,SF=L
         DS    0D
WORKL    EQU   *-WORK
         END   FIXRETC
 
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
Post Reply Previous topicNext topic

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “JCL - Job Control Language.”