EVAL is used in RPGIV code to assign values to a variable. It can be used both for concatenating characters and to do numerical calculations. Example RPGIV Fixed Format
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
D Message 52A D FirstName 128A D LastName 128A D Total 5P 0 * * Character Concatenation C Eval FirstName = 'John' C Eval LastName = 'Smith' C Eval Message = %Trim(FirstName) + ' ' + %Trim(LastName) C Message Dsply * * The text "John Smith" will be shown on the screen * * Numerical Calculation C Eval Total = 123 * 3 C Eval Message = %Char(Total) C Message Dsply * * The text "126" will be shown on the screen |