View previous topic :: View next topic
|
Author |
Message |
sureshbabu.jv
New User
Joined: 11 Apr 2006 Posts: 41 Location: Chennai
|
|
|
|
Hello
I declared the OCCURS clause with 0 to 1000 and applied both DEPENDING on SUBSCRIPT item and INDEXED by Index item for that OCCURS clause. I would like to abend the program once suscript/index item reaches 1000 with SOC4. Please suggest me how to code it.
I tried with
ADD 1 to subscript item.
SET idex item upby 1.
If subsript item/Index item >1000
fail the program..
End-if
It's not working out.. Please provide me the logic to meet this requirement.
Thanks,
Venkata |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
There is a subscript range checking option for the compiler (see the COBOL Programming Guide manual through the manuals link at the top of the page for details). This option imposes a performance penalty, so it may not be something you want in a production program. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
why not abend it with a user abend
more effective and clear from any point of view! |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Quote: |
If subsript item/Index item >1000
fail the program..
End-if |
Define an 01 level to LINKAGE (IE: 01 LS-KTR PIC S9(07) COMP-3), do NOT establish addressability to it and within the above IF, ADD 1 to LS-KTR and you should raise a S0C4 Protection Exception.
Other than raising an ABEND after exceeding 1000, what's the real reason you need to do this?
As a failsafe, compile the program using the NOOPT compiler option, which creates a non-optimized load module.
Bill |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
FWIW - well managed systems do not permit generating "System" abends when the code detects an invalid situation.
A "User" abend is generated and if done well, the same User abend means the same thing across an application or an entire operating environment.
A System abend should only happen when there is an unplanned situation. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1049 Location: Richmond, Virginia
|
|
|
|
Minor point - these are actually S0C4, etc. I.e., zero-C-4. Often pronounced oh-C-4 because it looks like that, but be aware that these are hex numbers.
Agreeing with other replies - let the system generate system abends, not nyou. If you force one, how will you know when you really do have one?
Why, BTW, abend? You can perfectly well issue error messages (in various ways) and use the RETURN-CODE to control further processing, both within this job and via your scheduler. |
|
Back to top |
|
|
sureshbabu.jv
New User
Joined: 11 Apr 2006 Posts: 41 Location: Chennai
|
|
|
|
Hello,
Thank you so much for all your responses!!!
I tried with User abend and was able to get it done with U0001 but per client requirement I need to make changes to the program to have SOC1/SOC4 abend once the provider count has been exceed 1000. SO I am trying my level best to meet that requirement.
I can't go to client saying not possible or difficult to get system abend.
I heard if I move bad data to subsript item will get SOC4 or if i move 9(3) to 9(2) item will get SOC4.
Please let me know what exatly bad data,what need to move for getting the system abends.. IS it like otherthan numeric values
Please suggest me.. I have to try it once I back to work on monday..
Thank you!
Suresh |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Apologies, but your client is a fool to insist on this (if this is entirely client-driven) . . .
My clients expect me to point out when they are doing (or have done) something that will cause problems.
Suggest if this nonsense is to be pursed that an S0C7 or SOCB (divide by zero) be generated as they are quite simple to generate. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
You can call an assembler routine to do all your abends parametrized :
ABEND X'0C4',,,SYSTEM
or
ABEND X'0C1',,,SYSTEM
etc. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
too bad that smart solutions are obfuscated by stupid requirements |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1049 Location: Richmond, Virginia
|
|
|
|
What is wrong with a simple "ERROR - TOO MANY WHATCHCALLITS" AND RC=12?
You have the unending burden of educating your users. Good luck. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
You can call an assembler routine to do all your abends parametrized : |
I surely hope this mess of an environment does not allow programmers to write assembler.. .
Quote: |
What is wrong with a simple "ERROR - TOO MANY WHATCHCALLITS" AND RC=12? |
Some witless-one insists on the system abend. . .
I should probably discontinue participation in this topic before i become really blunt/unkind. . .
d |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
time to lock the topic
it really has no place in a professional forum
the ts should read the cobol manuals on how to issue a user abend
and do his job in advising his client about proper solutions! |
|
Back to top |
|
|
|