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 |
If I have a file with 5 record and that file has 2 Key field and I want to read the unique record of the file then how can we achieve it?
What is the difference between iter and do?
When it is desirable to describe files Internally?
how do I play {insert rpg system here}?
How can we receive values from a called procedure in CL?
why subproc not run in dftactgrp?????/plz explain
is this a rpg channel?
How do u design a physical file, when you have 2 Unique fields like for eg in A student file student ID and student examination no both are unique
To check the locks , we use cmd WRKOBJLCK , but how we confirm whether it's objeck lock / member lock. I confused with the Lock type and Status values...Can any body please tell me ...
I want my simple Green screen should refersh every 1 min ,How can I do it..? Please share the logic
Interviewer asked me write down DDS for load all subfile .can anybody write dds
can anybody explain significance of *loval setll with example code????