View previous topic :: View next topic
|
Author |
Message |
umeshchandra
New User
Joined: 09 Nov 2022 Posts: 2 Location: India
|
|
|
|
Has anyone came across a tool / logic that can help to identify COBOL logic that can potentially result in errors (S0C4/ 4038) when array is accessed with wrong subscript i.e. either zero or out of range max range. i need to scan around 2000 COBOL modules so need to think of a automation rather than a manual inspection.
Identifying COBOL programs
We are not considering ASM and EZT SRC here
1. Identify working storage copybooks with Array/OCCUR and spot programs which are using those copybooks
2. Identify tables declared directly in DATA Division (Linkage/working storage) of COBOL programs
Following are the most likely scenarios/logic where issue can occur
1. Loops :-
a. Using PERFORM - Identify perform loops used for looping – having UNTIL condition as termination of loop (Max count either hard coded or Variable or max loop termination condition is missing)
b. Loops using GO TO – these loops generally increment the counters inside arithmetically and loops are terminated with IF condition
2. Hardcoded values used as the subscripts for accessing array member
3. Variables used for as subscripts for accessing array member - need to back trace if the Variables populated from loop/ or hardcoded value is populated - if hardcoded value is not within the range of OCCUR clause.
4. Group level moves ( will not result in abends but may truncate data if arrays are not of same size)
Since each module can have different logical scenarios and how subscripts populated, Manual inspection is option we are considering as automating check for each scenarios will be difficult.
We are also exploring possibility to code a separate COBOL module to use source listing with expanded copybooks as input. This can help us to identify the programs that are using array. But again manual inspection will require to identify if logic can result in abend. |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1311 Location: Vilnius, Lithuania
|
|
|
|
Which idiot PHB has come up with this requirement?
Rick Cook, The Wizardry Compiled wrote: |
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. |
And the Universe will continue to win!
Your PHB is looking for a way to rip-off a client for something that will cost them a hell of a lot of money, without any real return! |
|
Back to top |
|
|
umeshchandra
New User
Joined: 09 Nov 2022 Posts: 2 Location: India
|
|
|
|
Unfortunately a production abend triggered the requirements. Recent upgrade to COBOL 6 also discovered many such issues and now its a proactive step to find a way to locate such logic. UAT not always test all boundary condition for all existing logic. Since its age old code of Almost 30-40 years now multiple different standards of coding in each decade.
I know few REXX tool/ COBOL modules which are used for standard checks. But finding a logical bug is all together a different game. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3075 Location: NYC,USA
|
|
|
|
Welcome!
You can not get it done just by looking at the code or automation. You need to understand the logic and business before you make any changes.
Even if you get close to what you intend to do there is no way to assure it won’t abend the skipped ones.
You could add a warning and send it to production support that 80% or 90% of the max table limit reached . This way you can know to change the module soon to avoid an abend. I had similar code written to save future prod abend. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Enterprise COBOL supports the SSRANGE compiler option. Although there is a possibly significant performance impact (up to 18%), it will validate that subscripts are within range while the program is executing. And even an 18% performance impact may be cheaper than manually reviewing 2000 COBOL programs. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
I was fortunate to work in a PL/I environment for many years.
Although the programs needed a way to know the size requirements for dynamic array allocation, that beat guessing/hoping. |
|
Back to top |
|
|
|