PxPlus User Forum

Twitter Twitter Twitter

Author Topic: pass composite string to an extended command  (Read 982 times)

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
pass composite string to an extended command
« on: December 22, 2021, 09:47:34 AM »
I'm looking for a way to pass one or more composite string(s) to an extended command.
Something like:
-}dim rec$:iol(1)
-}read record (1,key="abc")rec$
-}extCmd rec$

Mike King

  • Diamond Member
  • *****
  • Posts: 3811
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: pass composite string to an extended command
« Reply #1 on: December 22, 2021, 10:24:07 AM »
You should be able to use a ENTER directive without any parameters to change the internal CALL to your extended command into a PERFORM then use another ENTER to get to name of the variable:

Something like this:

-:list
0010 ENTER
0020 LOCAL _val$
0030 ENTER _val$
0040 LET _val$=STP(_val$,2) ! Remove any leading/trailing spaces
0050 PRINT _val$,"=",EVS("STR("+_val$+")")
-:save
C:\pvxsrc\_cmd\abc
->mike$="I am here"
->abc mike$
mike$=I am here

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

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
Re: pass composite string to an extended command
« Reply #2 on: December 23, 2021, 02:18:02 AM »
Mike,

Two ENTERs? Nice! I never thought of that.
Here is what I use finally:
Code: [Select]
ENTER
LOCAL param$,cmd$,var$
ENTER param$
LET param$=STP(param$,2)
LET cmd$="dim var$:iol("+param$+")"
EXECUTE cmd$
LET var$=VIS(param$)
PRINT LST(IOL(var$))
PRINT SUB(var$,SEP,"~")
END

Mike King

  • Diamond Member
  • *****
  • Posts: 3811
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: pass composite string to an extended command
« Reply #3 on: December 23, 2021, 08:37:19 AM »
Yes, an ENTER with no parameters included at the start of a called program effectively converts the CALL into a PERFORM.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com