|
I also do not recommend defining short fields as varying - don't
remember the length, but I'd not make anything 20 or less into a varying
length.
One advantage of varying length variables in RPGLE is that you don't
have to use the %trim built-in function. You do have to know that if you
set a varying length variable to the value of a fixed length variable,
without using the trim on the fixed length one, then the varying one is
set to the length of the fixed one. As an example, say you have a field
CHAR200V defined as 200 A varying - and a field CHAR50F defined as 50 A
fixed.
eval char50f = 'aaaaaaaaaabbbbbbbbbb'
That is 20 characters long, and there are 30 trailing blanks.
eval char200v = char50f
Then char200v will be assigned a length of 50 (first 2 bytes carry the
length). You probably don't want this.
eval char200v = %trim(char50f)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.