open-insight/LSL2/STPROC/ARRAY_SORT.txt
Infineon\StieberD 7762b129af pre cutover push
2024-09-04 20:33:41 -07:00

36 lines
763 B
Plaintext

compile subroutine array_sort( Array, SortOrder, Justification )
begin condition
pre:
post:
end condition
declare function fieldcount
declare subroutine v119
$insert logical
NumFields = fieldcount( Array, @fm )
NumValues = fieldcount( Array<1>, @vm )
TmpSort = ''
for k = 1 to NumValues
Tvar = ''
for j = 1 TO NumFields
Tvar := Array<J,K>:@vm
next j
Tvar[-1,1] = ''
TmpSort<K> = Tvar
next k
convert @fm to @rm in TmpSort
convert @vm to @fm in TmpSort
TmpSort := @rm
v119('S', '', SortOrder, Justification, TmpSort, '')
convert @fm to @vm in TmpSort
convert @rm to @fm in TmpSort
TmpSort[-1,1] = ''
for j = 1 to NumValues
for k = 1 to NumFields
Array<k,j> = TmpSort<j,k>
next k
next j