PGM() with Labels

Started by James Zukowski, April 02, 2021, 06:42:31 PM

Previous topic - Next topic

James Zukowski

It seems like the pgm() function only allows a line NUMBER for a statement reference, not a LABEL.
It also seems like it's the only operation in PxPlus (besides AUTO) that requires a line number and will not permit a label.
Does anyone know if this will ever change? Or does anyone knows a simple way to retrieve a line based on the label, rather than the number, without actually scanning through the program (which I can do but prefer not)?

Thanks in advance!

Stay safe out there!
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services

Loren Doornek

Use LNO() to get the line number.

10 LABEL:
20 PRINT LNO(LABEL)

RUN
10

James Zukowski

Good to know. But if we want it from another program in the stack, that's still a problem.

Thanks!
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services

Mike King

You might like to know we added an option to allow a string value to be passed to the LNO function in PxPlus 2021 due this May.

For example:

X$="LABEL"
Goto lno(x$)


Mike King
President - BBSysco Consulting - http://www.bbsysco.com
eMail: mike.king@bbsysco.com

James Zukowski

Also sounds good.

What I'm trying to do is define a (global) function that is passed an IOLIST pointer, and does it's thing based on that. Passing a line number works OK, since pgm() works with those. But a label reference doesn't. The obvious workaround is to use lno(Label) as the parameter, rather than "Label".

If things change, that would be wonderful.  ;D

Thanks, all!
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services