array help needed
GCC Consulting
gccconsulting at comcast.net
Tue Jan 27 14:02:08 PST 2009
> -----Original Message-----
> From: filepro-list-bounces+gccconsulting=comcast.net at lists.celestial.com
>
[mailto:filepro-list-bounces+gccconsulting=comcast.net at lists.celestial.com]
On
> Behalf Of Walter Vaughan
> Sent: Tuesday, January 27, 2009 4:39 PM
> To: filePro
> Subject: array help needed
>
> We've been using the IMPORT facility to read in a text file that
> has 3 different types of records
>
> I'd really like to change that so we read in something from
> the environment, and I was hoping arrays could be used,
> something along the lines of how the import fields are used.
>
> For example if the input (tildes between fields) is
> "1~~AB~12~A~" (actually nearly a hundred fields),
> Is there some reasonable bit of code that would emulate
> IMPORT stuf (xx) f=~ r=\n
> that would look at stuf(4) and show it as "12" using arrays?
>
> I want to import via @pm fields and get the same functionality
> so we don't have to rewrite a ton of fragile code.
>
> --
> Walter
Try
4.8 STRTOK Returns the location of the first occurrence
of any of the specified characters.
Syntax
n=STRTOK(string,characters[,startpos])
Example:
l=strtok(aa," 1234567890,./[]{}()!@#$%^&*+=-_<>?",l+"1")
Note:
STRTOK is different from the INSTR() function in that it
will return the first occurrence of any of the specified
characters, not a string of characters.
You would need to do this to find the first position of the tilde and then
use a mid statement to get the first element of the array.
Using the current value add "1" to move the start position and then get the
next tilde location and repeat until all the data has been read into the
array.
It may be necessary to read 1 character passed the current tilde location
and test for another tilde to see if that "field' is blank.
Richard Kreiss
GCC Consulting
rkreiss at gccconsulting.net
More information about the Filepro-list
mailing list