The IBM i likes full strings.  If the field is 10 characters you better pass it 10 characters.  This becomes especially true when you get past 32 characters.  This is because of how memory is allocated, and parameters being passed by reference.  This is very different from PHP development.  You can get the full explanation from this amazing article:

I had this issue with a CL program that I was passing a parameter that was greater than 32 characters to a PASE program.  It  was getting garbage onto the end.  To avoid this  you trim your variables and concatenate a null string that’s bigger than the size of the variable to make sure every part of the variable is padded with a value you set.  Example code: