Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

3-dimensionnal table

Status
Not open for further replies.

claudeb

Programmer
Nov 23, 2000
140
CA
hi,
I have a program that reads policy coverages. I would like to store the coverage amount, coverage percentage and the coverage plan (cvg-amt, cvg-%,cvg-plan);
( PIC S9(07)V99, PIC S9(07)V99, PIC X(06) )
For this a 3-dimensionnal table would be appropriate.
01 Table
05 Table-Amount occurs 20 times
10 Table% occurs 20 times
20 Table-Plan occurs 14 times.

how do I specifies the pics ?
I don't know how to make my moves.

thought
perform varying K 1 by 1
until K > nb-of-coverages
move cvg-amt (k) to Table (?,?,?)
move cvg-percent (k) to Table (?,?,?)
if cvg-plan='AA'
move cvg-plan(k) to Table (?,?,1)
else
if cvg-plan='AB'
move cvg-plan(k) to Table (?,?,2)
……….etc until Table (?,?,14)
end perform.
i would like to have
Table(amount1,percent1,plan1)
Table(amount2,percent2,plan2)... for each coverage read
the number of coverages varies from one policy to the next, and a coverage has only one plan.
Thanks a lot
 
Hi Claude,

I think you have it backwards; the only thing that varies is the # of coverages in a policy. The stuff you're interested in for each coverage is constant: amt, %, plan.

So you really have a one dimensional table:
Code:
        01  cvg-tbl.
            05  cvg-info occurs nn times.
                10  cvg-plan       pic  x(006). 
                10  cvg-amt        pic s9(007)v99. 
                10  cvg-plan       pic s9(007)v99.

Where nn is the max # of coverages expected for any plan.

Be sure that your logic checks for table overflow and quit and/or issue an appropriate msg.
Be sure to clear the table for each policy if you don't count the # of coverages you're putting in the table.

I think the moves are easier now, so you should see your way thru it. If not, you know where I live.

You didn't say what you'll do with the table data once you accumulate it.

Regards, Jack.
 
Hi Slade,
Since you asked
A policy has many coverages. I am interested in few attributs only.
CVG1 CVG2 CVG3 CVG4 CVG5 CVG6 CVG7
‘AA’ ‘AB’ ‘U2’ 'U1’ ‘U3 ‘AC’ ‘AF’
amt amt amt amt amt amt amt
% % % % % % %

I need to write the coverages that have a U in their plan, but for the first U-coverage, I have to write all the information I have in the other coverages (not U). The final output should look like:

U2 ‘AA’amt % 'AB’amt % ‘AC’ amt % ‘AF’ amt %
U1 nothing nothing nothing nothing
U3 nothing nothing nothing nothing

Il seems to me that I need at least a 2 dimensionnal table
thanks
 
what i need is,
Table(J, amount (J) , % (J), Plan (J) )
for every coverage.
it took me a long time to formulate that !
claudeb
 
well
this worked.
the rest is up to me
thanks again
01 WS-TABLE.
03 TABLE-ROW OCCURS 20 TIMES.
05 TAB-CVG PIC 9(2).
05 TAB-AMT PIC S9(9)V99 COMP-3.
05 TAB-PCT PIC S9(8)V9(3) COMP-3.
05 TAB-PLAN PIC X(06).
 
Hi Claude,

You're getting me dizzy. First you say you need a 2 dimentional table, then show me a one dt, that looks a lot like the one I suggested. Anyway...

You might try this:

Sort your i/p (or modify the existing sort) by policy and coverage (as many chars as needed to get your Ax's to the top and the Un's to the bottom of each policy. That done read the policy recs and put the Ax info into the table for each. When you read the 1st U rec move the covg code to the o/p rec & move the entire table to the o/p rec.

Read the remaining U recs moving the covg code and spaces to the o/p rec until you hit a policy break. Don't forget to reinit the table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top