Difference between %Scan and %Check in RPGLE - IBM I / As400

Difference between %Scan and %Check in RPGLE - IBM I / As400

**Free                                                                                                                                  

* Variable Declarations                                                     

                                                                            

       Dcl-S String Varchar(30);                                            

       Dcl-s Position Zoned(4);                                             

                                                                            

       String = 'RPGLE';                                                    

                                                                            

* %SCAN Builtin Function                                                    

                                                                            

* Finding the position on Character 'G' in string using %Scan BIF                                                                    

        Position = %scan('G' : String);                                     

                                                                            

 * Displaying Position on outoput screen                                    

                                                                            

        Dsply Position;                                                     

                                                                            

 * %Check Builtin Function                                                  

                                                                            

 * Finding the position of first non occerance  character using %check BIF  

                                                                            

        Position = %Check('RPG' : String);                                  

                                                                            

 * Displaying Position on outoput screen                                    

                                                                            

        Dsply Position;                                                     

                                                                            

                

  *INLR = *ON;  


Subscribe Tech Sharmit for more videos on IBMi / AS400

Please refer to the below video for the same topic.                 

                



                                                                            

Comments

Popular posts from this blog

Dynamic XMl file creation in IFS using RPGLE Program - IBMI / AS400

Compile Time Data Array in RPGLE - IBM i / AS400

Numeric Data type in RPGLE free format - IBM i / AS400