gauthamnagpur18 wrote:Ya i really got stuck. I have found out average for all student-ids but there is problem in finding the rank .Actually I don know how to use table concept and Implement bubble sort here .
Deary, deary, me
Do you understand the concept of a working-storage variable? Do understand that you may define many such variables?
Then consider that a COBOL table (or any sort of array implementation in any language) is a number of working-storage variables, all of which have the same name, but which may be differentiated by the usage of an index
or a subscript
(different things in COBOL, although not in most other languages).
Thus, you might write:
01 WS-VARIABLE-1 PIC X(10).
01 WS-VARIABLE-2 PIC X(10).
01 WS-VARIABLE-100 PIC X(10).
But if you had some intelligence and education, you'd understand that you were much better off writing:
01 WS-TABLE OCCURS 100 TIMES INDEXED BY WS-TABLE-INDEX PIC X(10).
Since in the first case, you'd have to process the variables like:
MOVE WS-SOMETHING TO WS-VARIABLE-1.
MOVE WS-SOMETHING TO WS-VARIABLE-2.
MOVE WS-SOMETHING TO WS-VARIABLE-100.
Whereas in the second you could write:
VARYING WS-TABLE-INDEX FROM 1 UNTIL WS-TABLE-INDEX > 100.
MOVE WS-SOMETHING TO WS-TABLE(WS-TABLE-INDEX).
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day