Page 1 of 1
IDCAMS - HowTo force an Abend if MAXCC GT 0
Posted: Sun Feb 15, 2026 3:05 pm
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
Re: IDCAMS - HowTo force an Abend if MAXCC GT 0
Posted: Mon Feb 16, 2026 2:18 am
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.
Re: IDCAMS - HowTo force an Abend if MAXCC GT 0
Posted: Wed Mar 11, 2026 6:36 pm
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
Re: IDCAMS - HowTo force an Abend if MAXCC GT 0
Posted: Wed Jun 24, 2026 5:12 pm
by BearGFR
Easy peasy, as long as you don't care about what the specific abend code is. Do this with 2 JCL steps: the first being IDCAMS, the second attempting to execute any non-existing program inside an // IF // ENDIF construct that will run only if the previous IDCAMS step completed with a step return code greater than zero.
Example:
//IDCAMS EXEC PGM=IDCAMS
.
(required jcl)
.
//SYSIN DD *
(something that results in MAXCC GT 0
,
//TEST IF (IDCAMS.RC > 0) THEN
//* Attempt to execute a program name that does not exist - generates an S806 abend
//ABEND EXEC PGM=BAILOUT
// ENDIF