PxPlus User Forum

Twitter Twitter Twitter

Author Topic: PGM() with Labels  (Read 1203 times)

James Zukowski

  • Diamond Member
  • *****
  • Posts: 297
    • View Profile
PGM() with Labels
« on: April 02, 2021, 06:42:31 PM »
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

  • Gold Member
  • ****
  • Posts: 85
    • View Profile
Re: PGM() with Labels
« Reply #1 on: April 02, 2021, 07:38:03 PM »
Use LNO() to get the line number.

10 LABEL:
20 PRINT LNO(LABEL)

RUN
10

James Zukowski

  • Diamond Member
  • *****
  • Posts: 297
    • View Profile
Re: PGM() with Labels
« Reply #2 on: April 02, 2021, 07:49:48 PM »
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

  • Diamond Member
  • *****
  • Posts: 3811
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: PGM() with Labels
« Reply #3 on: April 03, 2021, 09:30:32 AM »
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
eMail: mike.king@bbsysco.com

James Zukowski

  • Diamond Member
  • *****
  • Posts: 297
    • View Profile
Re: PGM() with Labels
« Reply #4 on: April 05, 2021, 11:19:36 AM »
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