Page 1 of 1

Abends generated by data handling

PostPosted: Tue Jun 02, 2009 8:36 pm
by jeroc
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

Re: Abends generated by data handling

PostPosted: Tue Jun 02, 2009 11:48 pm
by dick scherrer
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?

Re: Abends generated by data handling

PostPosted: Wed Jun 03, 2009 2:36 pm
by jeroc
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

Re: Abends generated by data handling

PostPosted: Thu Jun 04, 2009 1:28 am
by dick scherrer
Hello,

As written, all of those can cause problems.

Re: Abends generated by data handling

PostPosted: Mon Jun 08, 2009 2:00 pm
by jeroc
Hello Dick,

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

Thanks.

Re: Abends generated by data handling

PostPosted: Tue Jun 09, 2009 3:22 am
by dick scherrer
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.

Re: Abends generated by data handling

PostPosted: Wed Jun 10, 2009 2:17 pm
by jeroc
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?

Re: Abends generated by data handling

PostPosted: Thu Jun 11, 2009 6:57 am
by dick scherrer
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.