%FOUND Built-In Functions in rpgle

·         The format of this built in function is:

%FOUND{(file_name)}

·         %FOUND returns '1' if the recent operation finds a relevant/matching record; yet it is not necessary that there will be exact match.

·         If the match is not found then it returns '0'.

·         The operations that set %FOUND are:

·         File operations:

o    CHAIN (Random Retrieval from a File)

o    SETGT (Set Greater Than)

o    SETLL (Set Lower Limit)

·         String operations:

o    CHECK (Check Characters)

o    CHECKR (Check Reverse)

o    SCAN (Scan String)

                  Note:

Built-in function %SCAN does not change the value of %FOUND.

·         Search operations:

o    LOOKUP (Look Up a Table or Array Element)

Example –%found built-in function in rpgle


0140.00 C     S_PNUM        SETLL     REC5                                     
0141.00 C                   IF        %EQUAL()                                 
0142.00 C                   DOU       %EOF(ACCSUBPF)                           
0143.00 C                   READE     REC5                                     
0144.00 C                   IF        %FOUND()                                 
0145.00 C                   EVAL      RRN1=RRN1+1                              
0146.00 C                   EVAL      A_ORG=ORG                                
0147.00 C                   EVAL      A_ACCNO=ACC                              
0148.00 C                   EVAL      A_CCY=CCY                                
0149.00 C                   EVAL      A_ACCMNG=ACCMNGR                         
0150.00 C                   EVAL      A_CNTRY=COUNTRY                          
0151.00 C                   WRITE     ACC_SFL                 
0152.00 C                   ENDIF                                              
0153.00 C                   ENDDO                                              
0154.00 C                   ENDIF                                              
0173.00 C     K_PNUM        CHAIN(E)  REC2                                     
0174.00 C                   IF        %FOUND()                                 
0175.00 C                   EVAL      PADDR=S_PADDR                             
0176.00 C                   UPDATE    REC2                                     
0177.00 C                   ENDIF     

 











User Comments:



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