Parse source is not broken.  The information returned is for how the main
program is invoked, it does not tell you how any procedure within the
program was invoked.  If you were making a call to an external program
rather than an internal routine (or to a ::routine), you will see things
change.

Rick



On Mon, Aug 18, 2014 at 5:00 PM, J. Leslie Turriff <jlturr...@mail.com>
wrote:

>         I'm running ooRexx on OpenSuSE 13.1, x86_64.  The version is
>
> > $rexx -v
> > Open Object Rexx Version 4.2.0
> > Build date: Dec 29 2013
> > Addressing Mode: 64
>
>         I wanted to use the invocation method to determine how to route my
> output.
> On the mainframe, parse source tells me that, and the ooRexx Language
> Reference appears to tell me that it will work here as well; but even
> though
> I called my program as a subprogram  via the call command, it
> returned 'COMMAND', so I wrote a little program to test the parse source
> instruction.
>
> > $cat testParseSource
> > #!/usr/bin/rexx
> > /*
> > ╔════════════════════════════════════════════════════════════════╗
> > ║testParseSource:  Test the ooRexx "parse source" instruction.   ║
> > ║                                                                ║
> > ║Usage:                                                          ║
> > ║▶▶─testParseSource┬─────────┬─────────────────────────────────▶◀║
> > ║                  └[─Help┬─┬┘                                   ║
> > ║                         └]┘                                    ║
> > ║where                                                           ║
> > ║  Help                                                          ║
> > ║    causes this information to be displayed.                    ║
> > ╚════════════════════════════════════════════════════════════════╝
> > */
> >   if usage(arg(1)) = 'exit' then
> >     exit 0
> >
> >   trace normal
> > --Give the routines something to do.
> >   cmd.        = ''
> >   cmd.pwd     = '/usr/bin/pwd'
> >   cmd.rxqueue = '|/usr/bin/rxqueue'
> >
> >   parse source . invoke.main .
> >   say 'Mainline:   Invoked via' invoke.main'.'
> >   cmd.pwd,
> >   cmd.rxqueue
> >   parse pull thisDir
> >   say 'Mainline:  ' thisDir
> >   call subprogram
> >   say 'Subprogram: Invoked via' result'.'
> >   say 'Function:   Invoked via' function()'.'
> >   call routine
> >   say 'Routine:    Invoked via' result'.'
> >   say 'Routine:    Invoked via' routine()'.'
> > exit 0
> >
> > subprogram: procedure expose cmd.
> >   trace normal
> >   parse source . invoke .
> >   cmd.pwd,
> >   cmd.rxqueue
> >   parse pull thisDir
> >   say 'Subprogram:' thisDir
> > return invoke
> >
> > function: procedure expose cmd.
> >   trace normal
> >   parse source . invoke .
> >   cmd.pwd,
> >   cmd.rxqueue
> >   parse pull thisDir
> >   say 'Function:  ' thisDir
> > return invoke
> >
> > ::routine routine
> >   expose cmd.
> >   trace normal
> >   cmd.pwd,
> >   cmd.rxqueue
> >   parse pull thisDir
> >   parse source . invoke .
> >   say 'Routine:   ' thisDir
> > return invoke
> >
> > ::routine usage
> >   trace normal
> >   parse arg . '[' options ']' .
> >
> >   do o = 1 to options ~ words
> >     if abbrev('help',word(options,o),1) then
> >       do
> >         do l = 3 by 1
> >           line = sourceline(l)
> >
> >           if line = '*/' then
> >             return 'exit'
> >
> >           parse var line 'E29591'x line 'E29591'x .
> >           say line
> >         end
> >       end
> >   end
> > return 'continue'
>
>         When I run it, I get these results:
>
> > $testParseSource
> > Mainline:   Invoked via COMMAND.
> > Mainline:   /home/leslie/bin/rexx
> > Subprogram: /home/leslie/bin/rexx
> > Subprogram: Invoked via COMMAND.
> > Function:   /home/leslie/bin/rexx
> > Function:   Invoked via COMMAND.
> >     57 *-* expose cmd.
> >     33 *-* call routine
> > REX0099E: Error 99 running /home/leslie/bin/rexx/testParseSource line 57:
> Translation error
> > REX0512E: Error 99.907:  EXPOSE must be the first instruction executed
> after
> a method invocation
>
>         So, either I'm doing something wrong, or parse source is broken.
> Help!
>
> Leslie
> --
>                 A Caution to Everybody
>
>         Consider the Auk;
>         Becoming extinct because he forgot how to fly, and could only walk.
>         Consider man, who may well become extinct
>         Because he forgot how to walk and learned how to fly before he
> thinked.
>
> -- Ogden Nash
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Oorexx-users mailing list
> Oorexx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-users
>
------------------------------------------------------------------------------
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to