PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: Peter.Higgins on February 10, 2020, 10:15:19 AM

Title: Composite string questions
Post by: Peter.Higgins on February 10, 2020, 10:15:19 AM

Is the documentation up-to-date re sub-scripting with composite strings?
Is there a convenient way to determine if a variable has been dimmed as a composite string?
Title: Re: Composite string questions
Post by: Mike King on February 10, 2020, 11:41:25 AM
An easy way to determine if a string is real or a composite is to ask for its IOLIST using the IOL function as in

X$ = IOL(string$, ERR=Non_Composite)

As for your question about documentation, we are curious what you are looking for and/or trying to accomplish.
Title: Re: Composite string questions
Post by: Peter.Higgins on February 10, 2020, 02:36:16 PM
Mike,

I am adding new programs onto some old code that writes string record followed by numeric arrays.
The calls and objects usually get the entire string record portion even when only one field is used.
New work is designed to be more maintainable by use of record IO and composite string variables.
These generally have to be integrated with the existing calls. 

Passing composite strings into lightly modified sub calls/objects would be helpful if this is an actual supported feature. My testing indicates this maybe possible, but the documentation says otherwise.



Title: Re: Composite string questions
Post by: Thomas Bock on February 11, 2020, 05:53:22 AM
Peter

I'm not sure what you mean.
As long as you use call-by-reference the iolist will be accessible inside a called module:

Code: [Select]
begin
dim structure$ : iolist product$, version$
structure.product$ = "PxPlus"
structure.version$ = "16.2"
call pgn + ";ENTRYPOINT", structure$
end
ENTRYPOINT:
enter composite$
print composite.product$
print composite.version$
exit
Title: Re: Composite string questions
Post by: Mike King on February 11, 2020, 10:24:06 AM
Peter

I did a quick look at the CALL directive in the documentation and didn't see any reference to composite strings.

You mentioned "My testing indicates this maybe possible, but the documentation says otherwise.", can you let us know where in the documentation it states otherwise so we can adjust it as needed to avoid any confusion going forward?
Title: Re: Composite string questions
Post by: Peter.Higgins on February 14, 2020, 01:58:53 PM
Mike,
Where the manual is unclear if composite strings support substrings.
Manual.pvxplus.com
DIM > Format 2> Define Composite String
Composite Strings vs. BBx® Templates

The system does not currently support subscripting with composite strings.

Perhaps this applies not to substrings but to arrays??