Abends generated by data handling



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Abends generated by data handling

Postby jeroc » Tue Jun 02, 2009 8:36 pm

Hi,

I'm looking for situations that can lead to abends related to data handling in Cobol programs. A division by zero is going to generate a S0CB and a bad conversion to COMP-3 variables can generate a S0C7... Do you know recurrent cases (movements, redefinition, comparison...) that can generate such abends?

Regards
jeroc
 
Posts: 22
Joined: Tue Sep 18, 2007 2:11 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Abends generated by data handling

Postby dick scherrer » Tue Jun 02, 2009 11:48 pm

Hello,

Do you know recurrent cases (movements, redefinition, comparison...) that can generate such abends?
Any abend you ever see is a recurrence. Every coding error can lead to an abend (which is far more preferable to the code simply producing incorrect results :) ).

Unfortunately, there is almost no end to the variety of ways bad code that can generate an abend.

Do you have something more specific you are interested in?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Abends generated by data handling

Postby jeroc » Wed Jun 03, 2009 2:36 pm

Hello Dick,

I agree with you that it is better to have an abend rather than incorrect results. However, I would like to detect potential problems in code. Do you think that following operations can lead to an Abend?
1) PIC 9(4) --> PIC S9(4) COMP-3
2) PIC 9(n) --> PIC S9(m) COMP-3 when n > m
3)
01 MY-GROUP.
05 MY-DATA-1 PIC XX.
05 MY-DATA-2 PIC S9(4) COMP-3.
...
MOVE "AAA123" TO MY-GROUP.
MOVE "AA123" TO MY-GROUP.
MOVE "AA 123" TO MY-GROUP.
4)
01 MY-VAR-1 PIC X(4) VALUE SPACES.
01 MY-VAR-2 PIC S9(4) COMP-3.
...
IF MY-VAR-1 < MY-VAR-2

Regards
jeroc
 
Posts: 22
Joined: Tue Sep 18, 2007 2:11 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Abends generated by data handling

Postby dick scherrer » Thu Jun 04, 2009 1:28 am

Hello,

As written, all of those can cause problems.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Abends generated by data handling

Postby jeroc » Mon Jun 08, 2009 2:00 pm

Hello Dick,

Ok. I am going to take into account this type of problems.

Thanks.
jeroc
 
Posts: 22
Joined: Tue Sep 18, 2007 2:11 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Abends generated by data handling

Postby dick scherrer » Tue Jun 09, 2009 3:22 am

Hello,

I'm not sure what you want as "output" from your task, but the list of potential problems mentioned above is only a small part of "things that can go wrong" due to data being mis-handled.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Abends generated by data handling

Postby jeroc » Wed Jun 10, 2009 2:17 pm

Hello Dick,

In fact, I would like to check Cobol programs in order to identify risky practices than can lead to problems in production. The goal is to improve the code quality of applications.

I totally agree with you that there are a large list of such problems and that it is difficult to identify all of them but I think that there could be 2-3 cases that occur frequently. It could be interesting to start with them.

Imagine, you receive source code from another team and you are not sure that data handling has been correctly done. According to your experience, which cases would you look for at first time?
jeroc
 
Posts: 22
Joined: Tue Sep 18, 2007 2:11 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Abends generated by data handling

Postby dick scherrer » Thu Jun 11, 2009 6:57 am

Hello,

but I think that there could be 2-3 cases that occur frequently
Only when code is written by people who do not know how to code properly. Some qualified senior should be review code written by people who do not have proper skill.

When code is designed/written properly, none of the things posted above happen.

Imagine, you receive source code from another team and you are not sure that data handling has been correctly done.
Any time code is to be turned over, proof of proper testing must also be turned over. If this is a change to some program, regression testing is also necessary (need to demonstrate that not only does the new code work, but the unchanged code also continues to work properly). If the code is properly tested, any of these problems should be caught and corrected before the code moves on to anyone else.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post