Page 1 of 1

Abending the program if it satisfies a criteria

PostPosted: Wed Jan 09, 2008 10:35 am
by karthick
Hi All,
Im developing a Cobol Program, such that if a criteria matches i have to abend the program. So that all my files that are created during the process needs to be deleted. But though the criteria matches im getting maxcc = 12 and the files are not getting deleted. i have tried with Disp = (shr) and (old,catlg,delete) in the Jcl. Can some one help me on this please.

karthick.

Re: Reg a

PostPosted: Wed Jan 09, 2008 2:35 pm
by arunprasad.k
karthick,

Here are some of my instructions.

#1 If you want to abend the program use some of the application defined utility to abend the program (check the existing production program) with DISP=(NEW,CATLG,DELETE) to delete the O/P files.

#2 If you want the program to end with return code 12, then add the statement in your COBOL program 'MOVE 12 TO RETURN-CODE' and have a IEFBR14 step with COND parameter and delete the files (using DISP=(OLD,DELETE,DELETE)

Arun.

Re: Abending the program if it satisfies a criteria

PostPosted: Tue Feb 26, 2008 10:05 am
by Anuj Dhawan
karthick wrote: But though the criteria matches im getting maxcc = 12 and the files are not getting deleted. i have tried with Disp = (shr) and (old,catlg,delete) in the Jcl. Can some one help me on this please.
Hi,

Please share Your JCL to get better suggestions.

Re: Abending the program if it satisfies a criteria

PostPosted: Tue Feb 26, 2008 10:50 pm
by dick scherrer
Hello,

You need to change the program to force an abend rather than a "maxcc=12". A maxcc=12 is not an abend.

If your jcl specifies (NEW,CATLG,DELETE), you will get the desired result once you cause the program to actually abend. One way to force an abend is to cause a divide by 0 which will result in an s0cb abend (not a maxcc). As this is most ungraceful, systems usually have an invokable user-abend module that will allow programs to abend with a Unnnn abend code.

Re: Abending the program if it satisfies a criteria

PostPosted: Fri Feb 29, 2008 12:44 pm
by rawatdewan
As per what i got from ur question i can suggest u that

in cobol use
if (condition to be tested)
(set maxcc = 12)
move 12 to returncode.
else
other processing


in jcl (using if else)

check for the maxcc
if it satisfy
delete the files using
disp = (mod,del,del)
otherwise
do other processing.

Re: Abending the program if it satisfies a criteria

PostPosted: Fri Feb 29, 2008 10:36 pm
by dick scherrer
Hello,

As per what i got from ur question i can suggest u that
This suggestion will not provide the solution i believe the TS requested.

The original request was to force an abend when some conditon happens. A User Abend is a much better way to go than setting a return code and testing via additional jcl.

Re: Abending the program if it satisfies a criteria

PostPosted: Sun Mar 02, 2008 7:38 pm
by t3chn0n3rd
There are other abend states such as 8 that maybe usefull

Re: Abending the program if it satisfies a criteria

PostPosted: Sun Mar 02, 2008 9:59 pm
by CICS Guy
t3chn0n3rd wrote:There are other abend states such as 8 that maybe usefull
Jeez, that is a return code, not an 'abend state'......

Re: Abending the program if it satisfies a criteria

PostPosted: Sun Mar 02, 2008 10:42 pm
by dick scherrer
Hello,

There are other abend states such as 8 that maybe usefull
An 8 (or any other non-zero value) may be useful, but it is not an abend.

People need to understand that calling an rc=8 or a maxcc=12 an abend does not make it an abend. Abends have a very specific definition on the mainframe and only true abends should be called an abend. Batch abends will be Unnnn or Sxxx.