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 |
How to print output from openquery in as400 ?
Program to read marks of 10 students for 4 subjects and compute and display total marks and status of each student in rpg
How to update only a field of a PF in an RPG program. I don't want to update the record, only one field.
Q1.How we can copy the data of file one session to another session? Q2.how we can execute a loop infinitely in AS/400 coding? Q3.In ALDON tool,multitask is posible on a perticular object by the user?
3 members in a databasefile .how to read records from all the members?????????
Can somebody tell me that, Is it possible to read all the member of PF without OVRDBF?
what is post opcode do
A particular job executing on the iS is not behaving as expected and is operating in an environment in which it can be debugged. What commands would you use to debug and observe the program?
Hi, Can anybody give me real sinario for SFLRCDNBR?with example?
what do you mean by SESSION/DEVOCE ERROR?
How Chain operation copies the record's data to the input buffer for the program?
wat is scan and check ? give me real time scenarios where we used these keywords in ur projects?