3-D Table



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

3-D Table

Postby anshuldas » Thu Jul 02, 2009 9:11 pm

Hello,
i have 3-D array whose is declaration is like this
Table 1
01 PIP-TABLE-COUNTS.
03 PIP-INC-EXC OCCURS 2 TIMES.
05 PIP-CO OCCURS 3 TIMES.
10 PIP-ZIPCODE OCCURS 2000 TIMES.
15 P-ZIP PIC X(5).
15 P-MEO PIC S9(7) COMP-3.
15 P-MEO-PER PIC S9(3)V99 COMP-3.
15 P-250-DED PIC S9(7) COMP-3.

This table is used for populating values of meo,meo-per in a output file on basis of inc,co & zipcode from a input file. Now currently processing is done of values which we get from file itself,i.e dymanic itself.

I want to do some change regarding zip values,i.e i want it hard code zip in this table & want to write output file irrespective of value of zip which i get from input file.

For example if static zip table looks like this
Table 2
01 ZIP-TABLE.
05 ZIP-CODE-TABLE.
15 FILLER PIC X(5) VALUE '07001'.
15 FILLER PIC X(5) VALUE '07002'.
15 FILLER PIC X(5) VALUE '07003'.
15 FILLER PIC X(5) VALUE '07004'.
15 FILLER PIC X(5) VALUE '07005'.
05 ZIP-TBL REDEFINES ZIP-CODE-TABLE OCCURS 5 TIMES.
15 TBL-ZIP-CODE PIC XXXXX.

Now i want table 1 to have zip hard coded as in table 2. i tried doing it
01 PIP-TABLE-COUNTS.
03 PIP-INC-EXC OCCURS 2 TIMES.
05 PIP-CO OCCURS 3 TIMES.
10 ZIP-TABLE.
15 FILLER PIC X(5) VALUE '07001'.
15 FILLER PIC X(5) VALUE '07002'.
15 FILLER PIC X(5) VALUE '07003'.
15 FILLER PIC X(5) VALUE '07004'.
15 FILLER PIC X(5) VALUE '07005'.
10 ZIP-TBL REDEFINES ZIP-TABLE OCCURS 5 TIMES.
15 TBL-ZIP-CODE PIC XXXXX.
20 P-ZIP PIC X(5).
20 P-MEO PIC S9(7) COMP-3.
20 P-MEO-PER PIC S9(3)V99 COMP-3.
20 P-250-DED PIC S9(7) COMP-3.

But it is not working, i am getting SC07 abend,the zip subscript is going much beyond it limit, i.e it should go beyond 5, but while Xpiditing i found that it value to be 1048. Please help.
Thanks in advance.
anshuldas
 
Posts: 2
Joined: Sun Jun 21, 2009 7:32 pm
Has thanked: 0 time
Been thanked: 0 time

Re: 3-D Table

Postby dick scherrer » Thu Jul 02, 2009 11:30 pm

Hello and welcome to the forum,

You are probably trying to use the numeric fields when they have not been initialized to some valid numeric value. The redefines in the code for zip-table will probably not even compile as posted due to the level 20 entries.

When you are trying to use the table, how did the value 1048 get into the subscript? This is completely under control of the code so it should be rather straight forward to determine. . .
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: 3-D Table

Postby BChat » Sat Jul 04, 2009 5:15 pm

Hi
The ZIP-TABLE is total 25 bytes where as the redefined ZIP-TBL is way bigger. As dick pointed out, I am wandering how it compiled.

Most likely your VALUE '07002' spilled into first occurrence of P-MEO causing the SOC7. Try putting another filler of size 11 bytes (size of P-MEO + P-MEO-PER + P-250-DED) after each of your 5 fillers. Or even better split then like PICs of P-MEO, P-MEO-PER, P-250-DED and assign ZEROS to them

Thanks,
Bidhan
BChat
 
Posts: 19
Joined: Thu Jun 11, 2009 8:20 pm
Has thanked: 0 time
Been thanked: 0 time

Re: 3-D Table

Postby anshuldas » Sat Jul 04, 2009 11:09 pm

Thanks a lot for help Dick & Bidhan! i will try to look into this issue again when i get back to office.
anshuldas
 
Posts: 2
Joined: Sun Jun 21, 2009 7:32 pm
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post