Search code examples
outputibm-midrangerpglerpg

RPGLE changing the output of a field


I have a field called FNAME which contains the first name of an employee. For my output I want to show only the first letter of their name.

For example, if their name is "Frederic" I want it to output "F" for their first name.

How would I manipulate this to get only the first letter? Do I do it with EDTWRD in my PRTF file?


Solution

  • EDTWRD and EDTCDE for that matter only work on numeric fields.

    You'd need to substring the value.

    fname = %subst(fname:1:1);