Anonymous user
Sort a list of object identifiers: Difference between revisions
Sort a list of object identifiers (view source)
Revision as of 20:19, 25 February 2017
, 7 years ago→{{header|REXX}}: used OUT template, simplified program, elided the use of finding the maximum width number in the OID.
(→{{header|REXX}}: used OUT template, simplified program, elided the use of finding the maximum width number in the OID.) |
|||
Line 442:
This REXX version supports the new and old format (supports a leading decimal point).
<lang rexx>/*REXX program performs a sort of OID (Object IDentifiers ◄── used in Network data).*/
#=words($) /*#: the number of OIDs in the $ list.*/
do i=1 for #;
end /*i*/
L=length(#) /*length of the number of words in
call show 'before sort ───► ' /*display the @ array before sorting.*/
say copies('░', 79) /*display fence, separate before &after*/
call norma
call show ' after sort ───► ' /*display the @ array after sorting. */
exit /*stick a fork in it, we're all done. */
Line 469 ⟶ 462:
do j=1 for m; _=j+1; if @.j>@._ then parse value @.j @._ 0 with @._ @.j ok
end /*j*/ /* [↑] swap two out─of─order elements.*/
end /*m*/; return /* [↑] use a simple bubble sort. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
norma: arg LZ;
if LZ then y=y right(_,30,0);
end /*k*/
@.j = translate(
end
return
/*──────────────────────────────────────────────────────────────────────────────────────*/
show: do
<pre>
OID number 1 before sort ───► 1.3.6.1.4.1.11.2.17.19.3.4.0.10
|