Page 1 of 1

Help in cobol internal array.....!

PostPosted: Wed Jul 23, 2014 12:48 pm
by mj025
Hi,
I have a cobol array in the following way
9700 010114 010214 10 C
9701 010114 010214 10 C
9702 010214 010214 30 E
9703 010314 010314 30 E
9704 010214 010214 30 E
9705 010114 010214 10 C


so, i have to sum up amount of 9700,9701,9705 and 9702,9704 i.e 10+10+10 = 30 , 30+30 = 60
how can i achieve this using a cobol program need help in array handling.
Thank you.

Re: Help in cobol internal array.....!

PostPosted: Wed Jul 23, 2014 12:51 pm
by BillyBoyo
Have a look at the Enterprise COBOL Programming Guide.

Re: Help in cobol internal array.....!

PostPosted: Wed Jul 30, 2014 6:20 pm
by mj025
Hi,
According to ur suggestion i have gone through the Enterprise COBOL Programming Guide.
now, i can get the repeated arrays i.e.
9700 010114 010214 10 C
9701 010114 010214 10 C
9702 010214 010214 30 E
9704 010214 010214 30 E
9705 010114 010214 10 C

but can't sum up the pay values according to the requirement.CAn u help me through this the utput i need is,
i have to sum up amount of 9700,9701,9705 and 9702,9704 i.e 10+10+10 = 30 , 30+30 = 60

Re: Help in cobol internal array.....!

PostPosted: Wed Jul 30, 2014 8:53 pm
by Terry Heinze
Please use Code tags:
9700 010114 010214 10 C
9701 010114 010214 10 C
9702 010214 010214 30 E
9703 010314 010314 30 E
9704 010214 010214 30 E
9705 010114 010214 10 C

You have a 2 dimension table (array). 6 rows, indexed or subscripted by ROW-IDX for example, and 5 columns indexed by COL-IDX. ROW-IDX occurs 6 times and within that, COL-IDX occurs 5 times. You want to accumulate the table entries located at (ROW-IDX 1 COL-IDX 4), (ROW-IDX 2 COL-IDX 4), and (ROW-IDX 6 COL-IDX 4) to get a value of 30. Something similar for the 2 values at (ROW-IDX 3 COL-IDX 4) and (ROW-IDX 5 COL-IDX 4). The coding is up to you.