Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Finding the current line number

175 views
Skip to first unread message

Swifty

unread,
Mar 9, 2011, 5:46:33 AM3/9/11
to
I have a subroutine library with hundreds of ::Routine statements.

Inside each of these routines is the identical subroutine:

Sigl: Return sigl

... this satisfies the need to know the current line number; the
sigl() function tells you.

Is there a way of doing this without having that "sigl()" function
defined in every ::Routine ?

I had a similar requirement, which was to get the name of the file
being executed. This one was much easier:

::Routine efn
Parse source . . efn
Return efn

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk

Rick McGuire

unread,
Mar 9, 2011, 7:48:12 AM3/9/11
to
On 3/9/2011 5:46 AM, Swifty wrote:
> I have a subroutine library with hundreds of ::Routine statements.
>
> Inside each of these routines is the identical subroutine:
>
> Sigl: Return sigl
>
> ... this satisfies the need to know the current line number; the
> sigl() function tells you.
>
> Is there a way of doing this without having that "sigl()" function
> defined in every ::Routine ?
>
> I had a similar requirement, which was to get the name of the file
> being executed. This one was much easier:
>
> ::Routine efn
> Parse source . . efn
> Return efn
>
The .line environment variable contains the current line number.

Rick

Swifty

unread,
Mar 9, 2011, 8:20:07 AM3/9/11
to
On Wed, 09 Mar 2011 07:48:12 -0500, Rick McGuire
<objec...@gmail.com> wrote:

>The .line environment variable contains the current line number.

Spectacular! I'll just have to wait until I'm sure that we won't be
going back to the system with IBM Object Rexx.

Thanks!

GerardS

unread,
Mar 14, 2011, 6:54:11 PM3/14/11
to

Well, one way (which may not exactly tell you what you wanted):

signal ....;....

and then SIGL will tell you the line that signal was on.
Of course, if this is done inside a DO loop, that destroys the
usefulness of it (those aren't elipses).

I use another version for the NOVALUE and SYNTAX labels:

novalue: xsigl=sigl; /*say something about novalue...*/


XSIGL now has the statement number that caused the NOVALUE
condition to be raised. I have to do this as my NOVALUE &
SYNTAX get triggered and call other subroutines to issue a
generic and informative message(s).


As for the PARSE SOURCE, it really doesn't give you the name of
the file being executed, but instead, gives you the command used to
invoke the REXX program. Some operating systems allow the use of
aliases, and VM/CMS in particular allows you to load any file and ya
can call it (some) a REXX program (with any name).

_____________________________________________ Gerard Schildberger

LesK

unread,
Mar 14, 2011, 9:34:38 PM3/14/11
to
CMS does return the fn ft fm tokens *plus* the invoking command (8 chars,
perhaps mixed case, or ?) and the initial command environment. An EXEC that is
EXECLOADed would certainly confuse things. I used to do that to provide a little
more protection against fiddling with production code.

Windows gives the complete path of the running code.

--

Les (Change Arabic to Roman to email me)

0 new messages