How to sort an array in descending in RPG
Answers were Sorted based on User's Feedback
Answer / tahir
sorta is an array opcode to do the sorting ..
of records can used in all array type like-
1.run time
2.compile time
3.pre run time
and example of it can be.....
we use ipe specification for creating an array,there is a
parameter in ipe spec. SEQUENCE ENTRY ____________
write___A(ascending)
D(decending)
E arr1 1 4 2 0 arr2 3
C z-add 1 x 20
C do 12
C sortaarr1
C arr1,x dsply arr2,x
C add 1 x
C enddo
C seton lr
**
12dec
01jan
04apr
09sep
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / surya siram
While declaring the array in the rpgle program, use the key word "DESCEND" and then use the bif SORTA (Sort array) to sort the array in descending order.
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / ravi kumar
DARR1 S 3S 0 DIM(5) DESCEND
C
C EVAL Arr1(1) = 100
C EVAL Arr1(2) = 500
C EVAL Arr1(3) = 300
C EVAL Arr1(4) = 400
C EVAL Arr1(5) = 250
C sorta arr1
C ARR1(1) DSPLY
C ARR1(2) DSPLY
C ARR1(3) DSPLY
C ARR1(4) DSPLY
C ARR1(5) DSPLY
C SETON lR
OUTPUT:
500
400
300
250
100
| Is This Answer Correct ? | 1 Yes | 1 No |
am 2010 passed out . can any one tell me which course is good to put 2+fake .guide me
Need a sql query: retrive all duplicate records in table
How would display prime numbers using CL program?
how do I do concatenation in rpg iv, like I do in cl?
what is file information data structure?
RPG/400 faqs?
difference betwen keywords and opcodes
The RP program is displaying records 11 times .But there are 10 records in a pf.(ie last record is displayed twice).How to display records only 10 times?
list down and describe the sub systems vailable
1) How to define keyed file in CL pgm. 2) How can i read particular records in CL pgm from database file.
Need a sql query: retrieve all duplicate records in table?
Difference between creating a report using Printer file and WRKQRY(Query Report) ?