Using ARRAYSORT function 
Author Message
 Using ARRAYSORT function

1. I am trying to write a routine to read a file into an array and then sort the array by a
   section of the records being placed into the array. I am using object REXX to write it
   under OS/2. I have included the program statements at the end of this article.

2. My problem is that I keep getting a Incorrect call to routine error when I try to invoke
   the ARRAYSORT function. If I write a program to perform the same function in classic
   REXX, I do not get an error.

3. Does the ARRAYSORT function work with Object REXX? If not, is there a sort function
   in Object REXX similar to ARRAYSORT? Any help would be appreciated. Thank you.

The program:

        /*Object REXX to read file and place in a table. TABLE2.CMD*/

        call RxFuncAdd 'RexxLibRegister','REXXLIB','RexxLibRegister'
        call RexxLibRegister

        dailyfile = .stream~NEW('f:\data\dl005970.d27')
        dailyfile~OPEN(READ)

        recs = dailyfile~LINES
        say recs

        recarray = dailyfile~MAKEARRAY(line)
        numarray = recarray~ITEMS

        rd = 1
        do rd = 1 to numarray
                a = substr(recarray[rd],473,18)
                say a
          end

        call arraysort recarray,1,rd,473,18,'A','C'

        rd = 1
        do rd = 1 to recarray~ITEMS
                a = substr(recarray[rd],473,18)
                say a
          end
        exit
--



Sat, 18 Dec 2004 15:32:06 GMT  
 Using ARRAYSORT function

says...

Quote:

>    rd = 1
>    do rd = 1 to numarray
>            a = substr(recarray[rd],473,18)
>            say a
>      end

>    call arraysort recarray,1,rd,473,18,'A','C'

I'm not sure but you might need to check the value of rd. It's
probably arraysize + 1.


Sun, 19 Dec 2004 03:10:04 GMT  
 Using ARRAYSORT function
Paul:

Quote:

> 1. I am trying to write a routine to read a file into an array and then sort the array by a
>    section of the records being placed into the array. I am using object REXX to write it
>    under OS/2. I have included the program statements at the end of this article.

You may want to look-up the "sort_util.cmd" in the following package, which not only allows for sorting Object Rexx
arrays, but *any* Object Rexx collection, be it a bag, a directory, a set, a table, a relation, etc.:

    http://wi.wu-wien.ac.at/rgf/rexx/orx08/orx8_99.zip

The documentation with short examples of the above Object Rexx utility classes and utility routines are at:

    http://wi.wu-wien.ac.at/rgf/rexx/orx08/Part1.pdf
    http://wi.wu-wien.ac.at/rgf/rexx/orx08/Part2.pdf

---rony



Sun, 02 Jan 2005 04:42:23 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Using Timer functions in parallel with VISA functions

2. Trouble using variables for function names in function declarations

3. problem defining a function using built in filter function

4. Trouble using variables for function names in function declarations

5. redefining functions using the old function

6. problem using using list with function

7. VC++ calling fortran function and fortran function calling a c++ function

8. Calling functions from functions from functions ...

9. I need help on reading sectors using int 13 function 02h

10. Files used by APL functions

11. using function argument as a full regexp

12. GAWK: Question on using filefuncs.so (creating arrays in extension functions)

 

 
Powered by phpBB® Forum Software