View previous topic :: View next topic
|
Author |
Message |
vishalpatel
New User
Joined: 13 Dec 2006 Posts: 4 Location: Baroda
|
|
|
|
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 |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
vishalpatel
New User
Joined: 13 Dec 2006 Posts: 4 Location: Baroda
|
|
|
|
hello,
thanx a lot for ur co-operation. |
|
Back to top |
|
|
|