When did this change?



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

When did this change?

Postby Number1Ump » Tue Dec 13, 2011 1:33 am

I dealt with an S0C7 situation this weekend. There were some counters defined in working storage:

003556 01  CTL-COUNTERS    COMP-3.                                     
003557     03  CTL1-CTRS.                                             
003558         05  CTL1-AMT-CTRS.                                     
003559             07  CTL1-DR-AMT     PIC S9(13)V99 OCCURS 100 TIMES.
003560             07  CTL1-CR-AMT     PIC S9(13)V99 OCCURS 100 TIMES.
003561         05  CTL1-NO-CTRS.                                       
003562             07  CTL1-DR-NO      PIC S9(5)     OCCURS 100 TIMES.
003563             07  CTL1-CR-NO      PIC S9(5)     OCCURS 100 TIMES.
003564     03  CTL2-CTRS.                                             
003700         05  CTL2-AMT-CTRS.                                     
003800             07  CTL2-DR-AMT     PIC S9(13)V99 OCCURS 100 TIMES.
003850             07  CTL2-CR-AMT     PIC S9(13)V99 OCCURS 100 TIMES.
004000         05  CTL2-NO-CTRS.                                       
004100             07  CTL2-DR-NO      PIC S9(5)     OCCURS 100 TIMES.
004150             07  CTL2-CR-NO      PIC S9(5)     OCCURS 100 TIMES.
004300     03  CTL3-CTRS.                                             
004400         05  CTL3-AMT-CTRS.                                     
004500             07  CTL3-DR-AMT     PIC S9(13)V99 OCCURS 100 TIMES.
004550             07  CTL3-CR-AMT     PIC S9(13)V99 OCCURS 100 TIMES.
004700         05  CTL3-NO-CTRS.                                       
004800             07  CTL3-DR-NO      PIC S9(5)     OCCURS 100 TIMES.
004850             07  CTL3-CR-NO      PIC S9(5)     OCCURS 100 TIMES.


Of course, the program abended because the one of these fields did not have valid C-3 data. But there is an initialization paragraph to set these all to 0 at the beginning of the program. But it would loop through 105 times, and update occurance 101 through 105 even though the table is defined occurs 100 times. The abend did not occur when initializing the fields to 0. It happened later when trying to use these fields.

Here's my question for the audience - Maybe I'm wrong, I remember a day when if you were trying to reference an occurance of a COBOL table greater than the number of occurrences defined, you would get an 0C7 or other abend code. If so, when and why did this change? I saw another instance a couple of weeks ago where a subscript got set to 0 and the that worked as well. Just curious.

Thanks,
Douglas
Number1Ump
 
Posts: 6
Joined: Thu Dec 01, 2011 9:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: When did this change?

 

Re: When did this change?

Postby BillyBoyo » Tue Dec 13, 2011 1:47 am

I think you are thinking of the compiler option SSRANGE, which generates code to check that any subscript/index/reference modification does not access data outside the data defined.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: When did this change?

Postby Number1Ump » Tue Dec 13, 2011 1:49 am

Thank you so much.
Number1Ump
 
Posts: 6
Joined: Thu Dec 01, 2011 9:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: When did this change?

Postby BillyBoyo » Tue Dec 13, 2011 4:47 am

No problem, glad it helped.

There is a topic here about initialising tables: http://www.ibmmainframeforum.com/ibm-cobol/topic6278.html#p26798
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post