Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REX file is not getting the parameter

Status
Not open for further replies.

Marconi182

Programmer
Jun 8, 2020
7
0
0
CA
I am trying to pass the following parameter from the Batch file to a Rex. File. The problem is that GetYN.REX is not getting the parameter. I have tested it on another computer with the same Object Rexx version and it works, but on my work's computer, it doesn't. I saw this forum, that I guy supposed had the same problem but it was in 2006. Any idea how to fix it?
Batch file
@echo off

@echo Batch file

SET Dir = \Rexx_Code

@echo Test is executing
Pause
C:
CD %Dir%

start C:GetYN.rex "Cleanup Directory?'<Y|N>'"

GOTO CLEANUP%ERRORLEVEL%
GetYN.rex
parse arg '"' Prompt '"'

Pause

do forever
Call CharOut, Prompt
pull Answer
select
when Answer = 'Y' | Answer = 'y' then exit 1
when Answer = 'N' | Answer = 'n' then exit 0
otherwise
nop
end
end
 
Try this to see what is the output of Prompt-variable
Code:
--parse arg '"' Prompt '"'
parse arg Prompt
say Prompt
 
Same thing. It doesn't pass the String "Cleanup Directory?'<Y|N>'" parameter when invoking the Rexx file.
 
and parsing simple word works ? E.g. like:
GetYN.rex Cleanup
 
No. Not parsing even a simple word. The weird this is It works in one of my laptops normally but when I try to run it into my work laptop, it doesn't. Both have the same Object Rexx installed.
 
Try the simplest script directly on command line, without calling it from batch file.

E.g. write a script like this:

try_parse_arg.rexx
Code:
parse arg p
say p

and then type on command prompt
Code:
rexx try_parse_arg.rexx hello

Will you then get
Code:
hello
or not ?

 
Yes, running from the CMD it works. Another information, a couple of years ago this script was running without any error. After migration to Windows 10, it started to happen
 
OK, and now, when you try directly on command line
Code:
GetYN.rex "Cleanup Directory?'<Y|N>'"
does it work or not ?

when I try your script with
Code:
parse arg '"' Prompt '"'
it doesn't work, but when I replace it with
Code:
parse arg Prompt
then it works (but I'm on Linux now)

 
It still doesn't work. But you gave me an idea,

I have tried to add 'Rexx' before calling the Rex file from the batch like this:

Code:
Rexx C:GetYN.rex "Cleanup Directory?'<Y|N>'"

Now it works!

Thank you so much!!
 
Then the problem was very different from what we thought: on your pc, the file type *.rex is not automatically associated with the ooREXX interpreter.
 
Yeah, and I can have more problems with the rest of the code. Would you know how to set *.rex files to be automatically associated with the ooREXX interpreter?
 
AFAIK, the file association *.rex will be set automatically during the installation of ooREXX or the installer gives you a choice if you want to do it or not. But you can do that manually too: in Windows 10 search for Default Apps and then Choose default apps by file type
I personally would rather reinstall ooREXX - IMO it's the simplest way
 
I see... Thank you so much. I really appreciate it. You have been helped a lot.

Have a good one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top