Cobol/COBOL

Advertisement


Question
B1 has PIC 9(02)
I am getting a S0CA Abend while

 Compute B1=
         100 - B1

The Working storage is like
01  A PIC v999
01  B Redefines A
  02 B1 PIC 9(02)
  02 B2 PIC 9(01)

the value of B1 when abend has occoured is 05

Cant understand why thishas occoured please explain and preventive measures, Quick response is deeply Appreciated.

Answer
The S0CA is Decimal Overflow Exception. While the implied data definition would indicate this should not occur, I am not sure what your specific compiler generates for code.  If you define the result larger such as "S95-result PIC S9(5)" and then move S95-result to B1, it should prevent it and will truncate the result data to fit 9(2) data.

Did you verify the contents of B1 in memory dump as being '05'?

David  

Cobol

All Answers


Answers by Expert:


Ask Experts

Volunteer


David Nelson

Expertise

I specialize in IBM z/OS COBOL and MicroFocus OCDS and Server Express non-OOP. Design, coding and performance oriented questions. Also linking to IBM Assembler from COBOL. Because the rules change with version, please state language level, version and platform environment. See CICS for questions about CICS.

Experience

Over 35 years working with COBOL on multiple platforms and OS.

Education/Credentials
Graduate, New York School of Computer Technology.

Past/Present Clients
Major Financial Institutions, State of NC (DHHS), Manufacturing, Financial services, Warehousing, Software developer and others.

©2016 About.com. All rights reserved.