I am trying to convert variable values from zoned decimal format to character but in doing so, I need the code to convert them as per IBM standards, In old RPG codes most developers have used opcode MOVEL and MLLZO but what are the substitute command for partially free format RPG.
*For example, the result of below code will be var2 = 1234N
D var1 s 10s 2 inz(-123.45)
D var2 s 10
/Free
C MOVEL var1 var2
dsply var2;
*Inlr = *on;
/End-free
When MOVEL moves a numeric value to a character field, the character field basically gets the zoned-decimal value of the numeric value.
%EDITC with the X edit code does this.
var2 = %editc (var1 : 'X');
But for each case where you want to convert a numeric value like -123.45 to a character like '1234N', it's a good idea to consider exactly why your code needs that kind of value. Perhaps you need to look at how the result of the MOVEL is being used. Instead of just converting the MOVEL to free-form, you might want to combine several statements into a procedure that accomplishes the entire business goal of the code containing the MOVEL statement.