Cannot use ooRexx utilities

Help
2009-04-13
2012-08-14
  • Neil Murphy

    Neil Murphy - 2009-04-13

    most notably SysFileTree.
    What do I do?

    Script:
    / oorexx /
    parse arg arg1 trail
    / according to wrox arg()= returns 0 or 1 when used on comman line args /
    n = arg()
    say "number of arg =" n
    say "arg sub 1=" arg(1)
    say "arg1=" arg1
    say "trail=" trail
    rexxutil SysFileTree("e:/" itm)
    say "itm.0=" itm.0
    say "itm.1=" itm.1
    parse version language level date month year
    say 'Lang:' language ' Lvl:' level ' Date:' date ' Mon:' month ' Yr:' year

    Output:
    F:\Utilities>rexx toy01.rex e:
    number of arg = 1
    arg sub 1= e:
    arg1= e:
    trail=
    'SYSFILETREE' is not recognized as an internal or external command,
    operable program or batch file.
    itm.0= ITM.0
    itm.1= ITM.1
    Lang: REXX-ooRexx_3.2.0(MT) Lvl: 6.02 Date: 30 Mon: Oct Yr: 2007

    F:\Utilities>rexx toy01.rex e:
    number of arg = 1
    arg sub 1= e:
    arg1= e:
    trail=
    9 - rtrncde = SysFileTree("e:/" itm)
    Error 40 running F:\Utilities\toy01.rex line 9: Incorrect call to routine
    Error 40.1: External routine "SYSFILETREE" failed

    F:\Utilities>rexx toy01.rex e:
    number of arg = 1
    arg sub 1= e:
    arg1= e:
    trail=
    9 - call SysFileTree("e:/" itm)
    Error 40 running F:\Utilities\toy01.rex line 9: Incorrect call to routine
    Error 40.1: External routine "SYSFILETREE" failed

    F:\Utilities>rexx toy01.rex e:
    number of arg = 1
    arg sub 1= e:
    arg1= e:
    trail=
    9 - rexxutil SysFileTree("e:/" itm)
    Error 40 running F:\Utilities\toy01.rex line 9: Incorrect call to routine
    Error 40.1: External routine "SYSFILETREE" failed

    F:\Utilities>

     
    • Rick McGuire

      Rick McGuire - 2009-04-13

      The arguments to SysFileTree need to separated by commas. You're trying to call it with just a single argument.

       
      • Neil Murphy

        Neil Murphy - 2009-04-14

        Worked! Thanks!

        Documentation:
        Chapter 8. Rexx Utilities (RexxUtil)
        RexxUtil is a Dynamic Link Library (DLL) package for Windows and *nix platforms; the package
        contains external Rexx functions. These functions:
        • Manipulate operating system files and directories
        • Manipulate Windows classes and objects
        • Perform text screen input and output
        All of the RexxUtil functions are registered by the ooRexx interpreter on startup so there is no need to
        register the functions either individually or via the SysLoadFuncs function.
        8.1. List of Rexx Utility Functions

        There is no mention of needing to call these utilities. One example would work wonders.

        In other books there is mention of needing to use RxFuncAdd to register the utility.

        Script:
        / oorexx /
        parse arg arg1 trail
        parse version language level date month year
        say 'Lang:' language ' Lvl:' level
        say 'Date:' date ' Mon:' month ' Yr:' year
        / call RxFuncAdd ('SysFileTree' 'd:/oorexx/rexxutil' 'SysFileTree') /
        call SysFileTree 'e:/', 'fle', 'B'
        say "fle.0=" fle.0
        say "fle.1=" fle.1

        Output:

        F:\Utilities>rexx toy02.rex z y x
        Lang: REXX-ooRexx_3.2.0(MT) Lvl: 6.02
        Date: 30 Mon: Oct Yr: 2007
        fle.0= 8
        fle.1= 5/04/03 12:20p 0 -D--- e:/IE6 Cache

        F:\Utilities>

         
    • Nobody/Anonymous

      Read the instructions.

      From the Windows Objrexx help file for SYSFILETREE.....

      *<< Sample Code and Output Example.>>*/

      / Code /

      call SysFileTree 'c:\win*.', 'file', 'B'
      do i=1 to file.0
      say file.i
      end

      / Actual Output /

      5:24:95 4:59p 0 -D--- C:\WINDOWS

      A simple exec that I use on my system:

      / REMOVE_EXT removes a given extension from all files in a directory when they don't already have one.
      If the directory name isn't specified, it uses the current directory.
      /
      parse arg oldext indir

      if OLDext="" then
      do
      Say "REMOVE_EXT oldext [directory_path]"
      Say " CURRENT_DIRECTORY"
      EXIT 8
      end

      if indir="" then
      indir= DIRECTORY() / Default to current directory /
      src=SysFileTree(indir||"*.*","flist.","FO")
      if src>0 then
      do
      Say "Insufficient memory to generate file list"
      exit 8
      end

      if flist.0=0 then
      do
      Say "No files found in "indir
      exit 8
      end

      do fnum=1 to flist.0
      fspec=flist.fnum
      fname=FILESPEC("N",fspec)
      if pos(".",fname)=0 then iterate / NO extension, skip /
      newfname=NOEXT(fname,OLDEXT)
      if newfname="" then iterate
      'RENAME "'fname'" "'newfname'"'
      end
      exit 0

      NOEXT: PROCEDURE
      parse arg fname,oldext

      t=lastpos(".",fname)
      e=substr(fname,t+1)
      if TRANSLATE(oldext)\=TRANSLATE(e) then return ""
      outfn=SUBSTR(fname,1,t-1)
      return outfn

       
    • Neil Murphy

      Neil Murphy - 2009-04-13

      Didn't work.
      Script:
      / oorexx /
      parse arg arg1 trail
      parse version language level date month year
      say 'Lang:' language ' Lvl:' level
      say 'Date:' date ' Mon:' month ' Yr:' year
      call SysFileTree 'e:/' 'fle' 'B'
      say "fle.0=" fle.0
      say "fle.1=" fle.1

      Output:
      F:\Utilities>rexx toy02.rex e:
      Lang: REXX-ooRexx_3.2.0(MT) Lvl: 6.02
      Date: 30 Mon: Oct Yr: 2007
      7 - call SysFileTree 'e:/' 'fle' 'B'
      Error 40 running F:\Utilities\toy02.rex line 7: Incorrect call to routine
      Error 40.1: External routine "SYSFILETREE" failed

      F:\Utilities>

      Instructions?
      I checked the reference manual and it said nothing about a "call" the other books I have mention "RxFuncAdd" which is not in the ooRexx Ref.

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks