Products Downloads


French version


 

 

ADELIA

VADELIA

SADELIA

WADELIA

MADELIA

(I/B)

(I/B) (C/S)

(B) (S)

(I/B) (C/S)

(I) (C/S)

 

Section for use

All

 

Syntax

SORT_D Array

 

Description

This instruction sorts the elements of an array Array in descending order.

It can only be executed upon an array without an index number.

This must be a one-dimensional array.

 

Warning: This instruction cannot be used at the same time as the instruction SORT on the same array and in the same program when RPG language is generated.

 

Example

* Routine to print items by DESCRIPTION in alphabetic descending order

* ARR_ITEMS has 99 elements

*

ARR_ITEMS = *BLANK

IN = 0

READ ITEMS

DO_WHILE ITEMS EXISTS

IN = IN + 1

ARR_ITEMS(IN) = ITEM_DESC

READ ITEMS

REDO

*

SORT_D ARR_ITEMS

*

IN = 0

DO_WHILE IN < 99

IN = IN + 1

ZZ_ITEM_DESC = ARR_ITEMS(IN)

PRINT ITEM_FORMAT

REDO

 

Result might look like:

TROUSERS

TIE

SWEATER

SHOE

SHIRT

HAT

COAT

 

↑ Top of page


  • Aucune étiquette