Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Addition of elements in multi dimensional table.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
vishalpatel

New User


Joined: 13 Dec 2006
Posts: 4
Location: Baroda

PostPosted: Wed Jan 10, 2007 3:10 pm    Post subject: Addition of elements in multi dimensional table.
Reply with quote

hi,
can any body tell me, how can i do said operation?

Data-division.
Working-storage section.
01 records.
02 student occurs 3 times indexed by i.
03 name pic x(8).
03 roll-no. pic 99.
03 marks pic 999 occurs 2 times indexed by j.
03 total pic 9999.
i want to do addition of
marks(i j) for particular i, and want to move this addition in total(i).
for example
i want to do addition of marks(1) and marks(2) of student 1 and to move this result in total of student1.

i had already done this operation using this syntax but having syntax error.
add marks(i j) to total(i).
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Jan 10, 2007 3:21 pm    Post subject:
Reply with quote

HI there,

Code:
PERFORM VARYING I FROM 1 BY 1 UNTIL I> 3

    PERFORM VARYING J FROM 1 BY 1 UNTIL J> 2

      ADD marks(I, J) TO TOTAL(I)
    END-PERFORM
 END-PERFORM.


Hope it should work.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Wed Jan 10, 2007 3:24 pm    Post subject: Re: Addition of elements in multi dimensional table.
Reply with quote

vishalpatel wrote:
hi,
can any body tell me, how can i do said operation?

Code:
Data-division.
Working-storage section.
01 records.
   02 student occurs 3 times indexed by i.
      03 name pic x(8).
      03 roll-no. pic 99.
      03  marks pic 999 occurs 2 times indexed by j.
      03 total pic  9999.
i want to do addition of
marks(i j) for particular i, and want to move this addition in total(i).
for example
i want to do addition of marks(1) and marks(2) of student 1 and to move this result in total of student1.

i had already done this operation using this syntax but having syntax error.
add marks(i j) to total(i).
What exactaly is the syntax error?
If you want both 1 and 2 added, Add marks (i 1) marks (i 2) to total (i) should work....
Back to top
View user's profile Send private message
vishalpatel

New User


Joined: 13 Dec 2006
Posts: 4
Location: Baroda

PostPosted: Wed Jan 10, 2007 3:26 pm    Post subject: thanx a lot.
Reply with quote

hello,

thanx a lot for ur co-operation.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Adding a userid to SMTP Security table Yolanda Harvey JCL & VSAM 1 Sun Aug 13, 2017 6:16 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts unload data from table with lob columns farhad_evan DB2 1 Sat Apr 22, 2017 1:32 pm
No new posts Group elements using ICETOOL Learncoholic DFSORT/ICETOOL 2 Fri Apr 14, 2017 11:01 am
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us