%TRIMR Built-In Functions in rpgle

%TRIMR function is used to trim trailing spaces of a string.

It can also be used to trim characters other than blanks. We can mention those characters to be trimmed in parameter 2.

Format of %TRIMR funtion is %TRIMR(Source String : characters to trim)


Example -%TRIMR Built-In Functions in rpgle




 Columns . . . :    6  80                                              AMIT/QRPGSRC
 SEU==>                                                                     TESTRPG
 FMT *   *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8
        *************** Beginning of data *****************************************
0001.00 D InputChar       S             30A   INZ(' $***005.25***000  ')
0002.00 D TrimChar        S             30A
0003.00
0004.00 C* Without 2nd parameter, %Trimr only trims blank spaces on the left
0005.00 C                   Eval      TrimChar =%Trimr(InputChar)
0006.00 C     TrimChar      DSPLY
0007.00 C
0008.00 C* Use 2nd parameter to trim 0 and blanks on the left
0009.00 C                   Eval      TrimChar =%Trimr(InputChar:'0 ')
0010.00 C     TrimChar      DSPLY
0011.00 C
0012.00 C* Use 2nd parameter to trim 0, blank and * on the left
0013.00 C                   Eval      TrimChar =%Trimr(InputChar:'0 *')
0014.00 C     TrimChar      DSPLY
0015.00 C
0016.00 C                   Seton                                        LR
        ****************** End of data *********************************************

/END-FREE


Output

DSPLY   $***005.25***000
DSPLY   $***005.25***   
DSPLY   $***005.25











User Comments:



Subscribe

.  


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