I decided to tackle the task of converting a COBOL pgm to RPG IV (Free format). I am trying to break unstrung variable into strung variables. For example: 'Susan E Gantner MD' is being returned as 'Susan E Gantner'. I just want 'Susan'.
Code:
BegSr UnstringPrvdr;
len = %LEN(%trimr fullname));
start = 1;
For i = 1 to len;
If %Subst(Fullname:i:1) = ' ' or %Subst(Fullname:i:1) = '';
Firstname = %subst(Fullname:1:i);
start = i + 1;
Endif;
Endfor;
EndSr;