× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



You get the data between the commas returned to you by strtok.
Strtok replaces the delimiter with a hex X'00' so you're right it does "eat"
the delimiters. But it does not eat the data between them.
Perhaps you have both commas and blanks in your delimiter field.


Bob Cozzi
Cozzi Consulting
www.rpgiv.com


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Wayne Achenbaum
Sent: Thursday, June 12, 2003 5:03 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: strtok and consecutive delimiters

The Function eats the delimiters, I must know what data was missing between
the delimiters. A PC is passing me a Comma delimited String on a data queue.
Between each comma is critical data.

Below is a copy of the procedure in a service pgm

$GetString      B                    Export

$GetString      PI          2048a   varying
 String@                    2048a   Varying Const Options(*Varsize)
 Delimiters@                  10a   Varying Const Options(*Varsize)
 - - - - - - - -
 Local Variables
 - - - - - - - -
Token@          s               *
Stringout       s           2048a   Varying
- - - - - - - - - - -
 Load Character Array
- - - - - - - - - - -
                  If        String@ = *blank
                  Eval      Token@ = StrTok(*Null : delimiters@)
                  Else
                  Eval      Token@ = StrTok(string@ : delimiters@)
                  Endif

                  If        Token@  = *Null
                  Eval      Stringout= *blank
                  Else
                  Eval      Stringout = %Str(Token@)
                  Endif

                  Return    Stringout

$GetString      E
---- Original Message ----- 
From: "Booth Martin" <Booth@xxxxxxxxxxxx>
To: <rpg400-l@xxxxxxxxxxxx>
Sent: Thursday, June 12, 2003 3:42 PM
Subject: Re: strtok and consecutive delimiters


> Please explain a tad more.  Are you writing or reading the file?  Why
isn't
> it working?  What is failing?  (several delimiters in a row should work
just
> fine, so I am wondering what's gone awry?)
>
>
>
> ---------------------------------------------------------
> Booth Martin   http://www.MartinVT.com
> Booth@xxxxxxxxxxxx
> ---------------------------------------------------------
>
> -------Original Message-------
>
> From: RPG programming on the AS400 / iSeries
> Date: Thursday, June 12, 2003 9:36:22 AM
> To: RPG400-L@xxxxxxxxxxxx
> Subject: strtok and consecutive delimiters
>
> Hello all, I have a procedure in a service pgm that uses the strtok
> function. I am trying to figure out how to handle consecutive delimiters.
I
> attended a session with Jon Paris that had a handout the Power of
> Prototyping. In the session we talked about using the function. I remember
> him saying with slight modification the code could handle consecutive
> delimiters. Does anyone know how handle the multiple delimiter issue??
> Thanks in advance.
>
> Wayne Achenbaum
> Slomin's Inc.
>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>

_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.