Help in cobol internal array.....!



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

Help in cobol internal array.....!

Postby mj025 » Wed Jul 23, 2014 12:48 pm

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.
mj025
 
Posts: 11
Joined: Fri Jun 13, 2014 2:29 pm
Has thanked: 3 times
Been thanked: 0 time

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

Postby BillyBoyo » Wed Jul 23, 2014 12:51 pm

Have a look at the Enterprise COBOL Programming Guide.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

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

Postby mj025 » Wed Jul 30, 2014 6:20 pm

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
mj025
 
Posts: 11
Joined: Fri Jun 13, 2014 2:29 pm
Has thanked: 3 times
Been thanked: 0 time

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

Postby Terry Heinze » Wed Jul 30, 2014 8:53 pm

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.
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post