Ü  SCAN (Scan String)

·         It is used to search the string (given in factor-1)  in factor-2. If it find any matching string in factor-2 , then the leftmost position is placed in result field.

Factor 1

Op-code

Factor 2

Result Field

Resulting Indicators

       HI                            LO                      EQ

Search string

SCAN (E)

Source string to be searched: starting position

Leftmost position of match found

 

Error

 

 

Example

 


Columns . . . :    6  80                  Browse                              AMINEM/QRPGLESRC
SEU==>                                                                                OP_SCAN
FMT D  DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++++
*************** Beginning of data ****************************************************
0001.00 D searchstring    S             30A   inz ('Search string')                     130110
0002.00 D substring       S             30A   inz (*blanks)                             130110
0003.00 D pos             S              5U 0                                           130110
0004.00 D len             S              5U 0                                           130130
0005.00                                                                                 130110
0006.00 C                   EVAL      len=%len (searchstring)                           130130
0007.00 C     ' '           SCAN      searchstring  pos                                 130130
0008.00 C                   EVAL      substring= %subst (searchstring:1:pos)            130130
0009.00 C     substring     DSPLY                                                       130130
0010.00 C                   EVAL      substring= %subst(searchstring:pos+1:len-pos)     130130
0011.00 C     substring     DSPLY                                                       130130
0012.00 C                   SETON                                        LR             130110
****************** End of data *************************************?******************


OUTPUT

DSPLY  Search 

DSPLY  string 

 











User Comments:



Subscribe

.  


Copyright © www.go4as400.com, 2013-2023. Copyright notice   Terms of services   Privacy policy