Built In Functions in RPGLE
When IBM introduced RPG IV around 1994, as they say, most of the RPG III opcodes were converted into built in functions. The built in functions therefore perform some specific action as any opcode would do. Since the built in functions are provided by the system itself, all the error handling etc is done by the system itself and you are given just the errors.
When we learn RPGLE procedures, we will see that the built in functions are very much similar to procedures. Some important built in functions are given below. We specify the arguments of built in functions separated by a colon. The general syntax of using a built syntax is as given below
Eval W@Dec = %Dec('102':5:0)
Some important built in functions are given in the list below.
| RPGIV Built-in fucntion | Action Performed |
|---|---|
| %Dec | Converts a valid character value into a numeric value of specified size. |
| %Char | Converts a numeric value into a character value. |
| %Date | Create a date in the specified format. Return the current date if no parameter specified. |
| %LookUp | Returns the position of a value in an array. If the search value is not found in the lookup array, 0 is returned. |
| %XLate | Replaces characters of a string with predefined characters. Used mainly for case conversion of letters (From Capital to Small etc.) |
| %XFoot | Returns the sum of all the array elements of an array |

