Why won't this pass correctly to the function ( SysFileTree)? It works if I hard code it. ooRex

Why won't this pass correctly to the function ( SysFileTree)? It works if I hard code it. ooRex

Post by Mr Coffe » Sun, 30 Sep 2007 02:21:47


Hello everyone.

I have an odd problem the program will run fine if I hard code the
Path but if I accept the path through the command line nothing
happens. Here is the code:

/*this will list all the files in a directory and call my program to
start generating ddl*/

Arg directory outputFile

sQuote = "'"
dQuote = '"'

Path = sQuote||directory ||'*.*'||sQuote
say Path
say outputFile

/*call SySFileTree Path,'files.','FSO'*/

call SysFileTree 'C:\SNA\*.*','files.','FSO'
do i = 1 to files.0
say "Generating .ddl's for " || files.i
call 'DDLGeneratorV2.rexx' files.i SNA2.ddl
/*call 'DDLGeneratorV2.rexx' files.i outputFile*/
end


Okay you can see the parts I commented out are the ones that make the
program stop working correctly.

If for instance I run my program when its set up like this:
Arg directory outputFile

sQuote = "'"
dQuote = '"'

Path = sQuote||directory ||'*.*'||sQuote
say Path
say outputFile

call SySFileTree Path,'files.','FSO'

do i = 1 to files.0
say "Generating .ddl's for " || files.i

call 'DDLGeneratorV2.rexx' files.i outputFile
end


This is what happens:

rexx fileLister.rexx C:\SNA\ test.ddl

The program will output the following:
'C:\SNA\*.*'
test.ddl

but thats it.

I'm passing 'C:\SNA\*.*' to the function SySFileTree but nothing
happens.

But if I hard code it like this:

Arg directory outputFile

sQuote = "'"
dQuote = '"'

Path = sQuote||directory ||'*.*'||sQuote
say Path
say outputFile

call SysFileTree 'C:\SNA\*.*','files.','FSO'
do i = 1 to files.0
say "Generating .ddl's for " || files.i
call 'DDLGeneratorV2.rexx' files.i SNA2.ddl

end

and run this via commandline: rexx fileLister.rexx

it will call my program and run fine.

Any ideas? It shows when I print out the Path its the EXACT as the
hard coded path so I don't see the difference.

Thanks
 
 
 

Why won't this pass correctly to the function ( SysFileTree)? It works if I hard code it. ooRex

Post by Jeremy C B » Sun, 30 Sep 2007 08:32:55


A while ago I answered a question of yours where the root cause of the
problem was that some variable didn't contain what you thought it did, and
suggested use of say statements like

say "thingy is >"thingy"<"

and yet here, where your description of the problem makes it near certain
that the problem is that some var doesn't contain quite what you think,
you're still doing things like:

say thingy

which will not, for example, show you if there are trailing blanks on the
variable concerned.

YOU say you are certain that the two programs are equivalent. I can say
without looking at the code that they won't be. YOU can be sure too, by
altering the non-hardcoded version to have just one test in it. After

Arg directory outputFile

try adding

if outputFile \== "yourexpectedhardcodedvalue" then...

and you'll find it isn't the same. Or perhaps you'd need, after you create
the Path var:


Path = sQuote||directory ||'*.*'||sQuote

if Path \== 'C:\SNA\*.*' then say "path mismatch"


From where I sit, this isn't so much a rexx issue, as you not seeming to
have any idea how to check that your code does what you think it does. Nor,
when there's a problem, do you seem to havce any idea how to diagnose where
the problem might lie. And yet I'm sure you said that while rexx is new to
you you had somne expertise in some other language... Surely you know how
to do fault finding in that? So apply the same principles here.


TBH I think you're trying to run before you can walk. You don't seem to
have got the hang of basic rexx principles.

You sign yourself "IBM Intern"; if that means what I think it might, then
why on earth haven't you read the (TSO) Rexx language manual cover to cover?




--
Jeremy C B Nicoll - my opinions are my own.