Rexx for OS2 with PARSE ARG and forward slashes 
Author Message
 Rexx for OS2 with PARSE ARG and forward slashes

Hello,

I am trying to parse a command line argument in REXX.
It contains forward slashes (a URL) and REXX only seem to
accept characters up to the slashes. My test program
looks like this:

/*                                                             */
/*     ARGTEST.CMD                                      */
/*                                                             */
/*     Rexx Script to test ARG                         */
/*                                                             */

PARSE ARG TheArg
say "The Command Line Argument is : "TheArg

/*      end of rexx script                               */

This is what happens when I run the script file at the OS2 command line with various command line arguments

[C:\cmd]argtest http://www.*-*-*.com/

[C:\cmd]argtest http://
The Command Line Argument is : http:

[C:\cmd]argtest http:////
The Command Line Argument is : http:

As you can see in the first case I don't get anything. In the next two cases I cannot get anything past the "//".
Am I having an Escape Sequence problem ?
Is there another way to get command line arguments ?

This is probably a simple problem but I am quite new
to REXX. I have been looking at examples and using the
on line help but I cannot seem to find anything related
to my problem. Any help would be appreciated :-)

Thanks in advance
Mike Bova



Fri, 31 Oct 1997 03:00:00 GMT  
 Rexx for OS2 with PARSE ARG and forward slashes

: /*                                                             */
: /*     ARGTEST.CMD                                      */
: /*                                                             */
: /*     Rexx Script to test ARG                         */
: /*                                                             */

: PARSE ARG TheArg
: say "The Command Line Argument is : "TheArg

: /*      end of rexx script                               */

: [C:\cmd]argtest http://theaddress.that.i.want/ToGoTo.html

: [C:\cmd]argtest http://
: The Command Line Argument is : http:

: [C:\cmd]argtest http:////
: The Command Line Argument is : http:

It seems that the problem is related with the two consecutive slashes.
My personal feeling is that the problem is not Rexx related but is more or
less connected with the command line handling : when your arg is
http://anything then the command file is not called at all (if only the
argument was omitted, you would have got The command Line Argument is :
followed by nothing (or THEARG is the variable was not initialized).

If your input string contains only individual slashes, then it is taken
as is byt the command file.

The only suggestion I can make is to enter http:/etc and add some logic
to convert the :/ sequence in :// before using the argument.(I've tried
to insert the argument into quotes but with no more success than before)

BTW I would like to know why // is able to logically inhibit the command
line only when a REXX script is used (erase testarg.cmd // gives you an
error message hence the command erase is effectively called or at least
a command line parser is activated).

This is only observable when the // is followed by something and when a
REXX script is invoked.

Sorry to have been of so little help
Jean-Pierre Cabani/e



Mon, 03 Nov 1997 03:00:00 GMT  
 Rexx for OS2 with PARSE ARG and forward slashes
It's a documented feature of OS/2 REXX that // followed by anything is
taken to be an option for the interpreter. The only option that the
interpreter actually recognizes is //t, which means to compile the program
(into internal form, not a true compile) but not execute it.

I think this was a mistake on IBM's part, but there it is in black and
white in the manual.
Alan Ackerman, 510-675-4358,



Mon, 03 Nov 1997 03:00:00 GMT  
 Rexx for OS2 with PARSE ARG and forward slashes
: It's a documented feature of OS/2 REXX that // followed by anything is
: taken to be an option for the interpreter. The only option that the
: interpreter actually recognizes is //t, which means to compile the program
: (into internal form, not a true compile) but not execute it.

: I think this was a mistake on IBM's part, but there it is in black and
: white in the manual.
: Alan Ackerman, 510-675-4358,

Another think I didn't know because I didn't read it. Thanks Alan you
demonstrated me once more that even if I know one Rexx implmentation,
i have still to read the books for another OS.

Jean-Pierre Cabani/e



Fri, 07 Nov 1997 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Arg, parse arg, command line, and ?

2. Rexx for OS2 with PARSE

3. NT REXX assistance for OS2/VM REXX man

4. GAWK: A couple of (related) suggestions re: arg parsing

5. Newbie ARG (or PARSE) question

6. Parse Arg with '//' (OS/2)

7. Parse Arg with '//'

8. Unusual difference in parse arg on NT

9. Possible Parse Arg problem

10. Possible 'Parse Arg' problem

11. Parse arg in NetRexx

12. Arg-parsing routines?

 

 
Powered by phpBB® Forum Software