DTRHELP.HLB  —  Functions  FN$STR_TOKEN
       Searches a string for the next token delimited by user-specified
       delimiters.

       When the function is called for the first time for a given
       string the init_flag must be 1 and the first token delimited
       by characters in delimiters is returned. In the following calls
       to get the other tokens in the same string, the init_flag must be
       0. The string argument is now ignored because an internal copy is
       now used. The delimiters string may be different from that used
       in the first call. When no more tokens exist, an empty string is
       returned.

1  –  Input

       This function takes three parameters as input, separated by
       commas:

       o  The string expression to be searched.

       o  The delimiters of the token.

       o  The initial flag for a given string: 1 for the first call and
          0 for the following calls to the same string.

2  –  Output

       The token within the delimiters.

3  –  Example

       The following example shows you how to split a sentence into
       lines (the separators are spaces, commas, or dots).

       DTR> SHOW D1
       DOMAIN D1 USING R1 ON LOG_NAM ;

       DTR> FN$CREATE_LOG("LOG_NAM","FN_STR_TOKEN_01.DAT");
       DTR> READY D1 ;
       DTR> DECLARE TOKEN PIC X(80) .;
       DTR> FOR D1
       CON>         BEGIN
       CON>         TOKEN = FN$STR_TOKEN(F," ,.", 1) ;
       CON>         WHILE TOKEN NOT EQ " "
       CON>                 BEGIN
       CON>                 PRINT TOKEN ;
       CON>                 TOKEN = FN$STR_TOKEN(F," ,.", 0);
       CON>                 END ;
       CON>         END ;

                                            TOKEN

       DEC
       DATATRIEVE
       for
       OpenVMS
       AXP
       systems
       is
       a
       query
       report
       and
       data
       management
       tool
       for
       the
       OpenVMS
       Operating
       System

       DTR>
Close Help