Examples showing how to convert to different data types in RPG (RPG source saved as Ruby code to add syntax highlighting).
H option(*nodebugio)
D @charA S 8 inz('12345')
D @charB S 10 inz('12/02/2004')
D @charC S 8 inz('12/03/04')
D @dateA S d inz(d'2004-12-04')
D @numA S 6 0 inz(041205)
D @numB S 7 0 inz(1041206)
D @numC S 8 0 inz(20041207)
D @numD S 6 0 inz(120804)
D @numE S 8 0 inz(12092004)
d @charDate S 10
/free
// NUMERIC TO CHARACTER
@charA = %char(@int_1); // 01 to '1'
*inlr = *on;
/end-free