Anyone know how I could do a modulo, please in RPG IV?
I tried %2 = 0
but it's not exact!
If you have a solution, I'm interested.
dcl-s slash varchar(20);
dcl-s antiSlash varchar(20);
dcl-s i packed(3:0);
dcl-s j packed(3:0);
dcl-s k packed(3:0);
dcl-s message varchar(20);
dcl-s waitInput char(1);
FOR i = 1 by 1 to 10;
slash += '/';
ENDFOR;
FOR j = 1 by 1 to 10;
antiSlash += '\';
ENDFOR;
FOR k = 1 by 1 to 6;
IF k % 2 = 0;
message = %char(slash);
dsply message ' ' waitInput;
ENDIF;
ENDFOR;
*INLR = *on;
Take a look at the documentation
Tradition Fix-format Free Format Syntax
Division Remainder MVR (Move Remainder) %REM (Return Integer Remainder)
So for your code...
if %rem(k:2) = 0;