PxPlus User Forum

Twitter Twitter Twitter

Author Topic: gosub SOMEWHERE with a$=b$  (Read 1629 times)

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
gosub SOMEWHERE with a$=b$
« on: July 13, 2018, 04:36:26 AM »
I'd like to have a$ implicitly structured like b$ (iol and xfa) when passed to the subroutine.
This would avoid sequences like the following and put more focus on what to do rather than having to deal with the technical background. Perhaps the syntax can be tweaked for this.

local dim workAddr$ : iol(addr1$)
workAddr$ = addr1$
gosub ADDR_2_FILE
workAddr$ = addr2$
gosub ADDR_2_FILE
« Last Edit: July 13, 2018, 04:54:30 AM by Thomas Bock »

James Zukowski

  • Diamond Member
  • *****
  • Posts: 296
    • View Profile
Re: gosub SOMEWHERE with a$=b$
« Reply #1 on: July 13, 2018, 09:37:49 AM »
You can pretty much already do that with a CALL into the current program:

CALL pgn+";routine_name",addrx$
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
Re: gosub SOMEWHERE with a$=b$
« Reply #2 on: July 16, 2018, 01:37:29 AM »
You're right for that simple example. But a call is much slower than a gosub. And in legacy code there is often a need to access much environment data as well. So a gosub is still the first choice.