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 |
1.WHAT IS WRONG WITH THE CODE BELOW? C CUSTNO CHAIN CUSTMAST IF %ERROR can any body find the wrong please? 2.What builtin function will you use to achieve the following functionality? C QTY IFLT *ZERO C QTY MULT-1 QTY ENDIF
is this a rpg channel?
steps involved in debugging and types of debugging modes?
Let?s consider a variable X of length 20. Move value ?ABC? to it.How to determine how many characters does X have?
What is the purpose of Panel Groups?
Hi guys, anybody know How RPG/400 code can be converted to RPG IV code with a single command?
i)What is the command to lock a file in a program ii)2. Can you get a level check error in a CL program
in which journalling which attributes are necessary??/
what is the necessary command needed before OPNQRYF and why?
how can you display specific subfile page on the screen in unequal subfile?
check existence of one record without using chain or read?
How do I link an existing logical file to it's Physical File without recompiling?