×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

REX file is not getting the parameter

REX file is not getting the parameter

REX file is not getting the parameter

(OP)
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. https://sourceforge.net/p/regina-rexx/discussion/8... 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

RE: REX file is not getting the parameter

Try this to see what is the output of Prompt-variable

CODE

--parse arg '"' Prompt '"'
parse arg Prompt
say Prompt 

RE: REX file is not getting the parameter

(OP)
Same thing. It doesn't pass the String "Cleanup Directory?'<Y|N>'" parameter when invoking the Rexx file.

RE: REX file is not getting the parameter

and parsing simple word works ? E.g. like:
GetYN.rex Cleanup

RE: REX file is not getting the parameter

(OP)
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.

RE: REX file is not getting the parameter

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 ?

RE: REX file is not getting the parameter

(OP)
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

RE: REX file is not getting the parameter

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)

RE: REX file is not getting the parameter

(OP)
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

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

Now it works!

Thank you so much!!

RE: REX file is not getting the parameter

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.

RE: REX file is not getting the parameter

(OP)
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?

RE: REX file is not getting the parameter

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

RE: REX file is not getting the parameter

(OP)
I see... Thank you so much. I really appreciate it. You have been helped a lot.

Have a good one.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close