Search code examples
ibm-midrangerpgle

Dsply Opcode to display a concatenated string


I am trying to display few numbers in the format as below:

Num1 = 30
Num2 = 50
Num3 = 40

This I am trying to achieve through something like Dsply 'Num1 = ' + %char(Num1);

But obviously this is not working. Would I have to put the string I want to display into another field first and then use it in the Dsply opcode?


Solution

  • Since Num1 isn't a 'string' variable, it can't be used directly with DSPLY. Try something like:

    Dsply ( 'Num1 = ' + %char( Num1 )); 
    

    You could do it other ways by copying the value into a character variable, but the %CHAR() function is easy and obvious code.