tips:revmedia:v1i9a12

VERBatim - V121

Published ByDateVersionKnowledge LevelKeywords
Sprezzatura Ltd01 MAR 19901.15+EXPERTV121, V120, SORT, INVERT

The base sort processor. It is passed the array to sort along with the length of the elements in the array. NOTE all array elements must be the same length for this routine to work. It is the responsibility of the programmer to ensure that data is correctly justified to provide an alpha/numeric sort. Descending sorts are provided by INVERTing the data to be sorted before calling V121 then INVERTing it back upon return.

As an array element is passed, the array delimiter is unnecessary. If an array delimiter is used it should be counted as a data character when passing element length, and a trailing delimiter should be included.

  A = "ZZ" :@FM: "AAA" :@FM: "AAB" :@FM
  * Ascending left justified sort
  SORT.A = A "L#3"
  CALL V121(SORT.A,4)
  CALL MSG(SORT.A, "", "", "")
  
  * Descending left justified sort
  SORT.A = A "L#3"
  SORT.A = INVERT(SORT.A)
  CALL V121(SORT.A,4)
  SORT.A = INVERT(SORT.A)
  CALL MSG(SORT.A, "", "", "")
  
  A = 1 :@FM: 99 :@FM: 23 :@FM
  * Ascending right justified sort
  SORT.A = A "R#2"
  CALL V121(SORT.A,3)
  CALL MSG(SORT.A, "", "", "")
  
  * Descending right justified sort
  SORT.A = A "R#2"
  SORT.A = INVERT(SORT.A)
  CALL V121(SORT.A,3)
  SORT.A = INVERT(SORT.A)
  CALL MSG(SORT.A, "", "", "")
  
  * Incorporating V120, note use of fixed length (5 char) string with two
  * portions of data @FM delimited
  A = "ZZ" :@FM: "01AA" :@FM: "02"
  * Ascending left justified sort
  CALL V121(A,5)
  CALL V120(A,5)
  CALL MSG(A, "", "", "")

(Volume 1, Issue 9, Pages 5,6)

  • tips/revmedia/v1i9a12.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1