Hi guys. Im struggling to understand what the LEN keyword does on a data structure and more importantly -- why I would ever use it?
I'm looking over http://www.omniuser.org/downloads/om...PGFreeForm.pdf these slides (slide number 31)
I looked in the rpgle reference manual and all it says is "The LEN keyword is used to define the length in characters of a Data Structure or character, UCS-2 or graphic definition"
So does that mean this data structure is supposed to be 7 bytes long? (Assuming a character is 1 byte). However in this example there is a subfield that is packed(12). It seems like the subfield isn't going to fit properly (I say that variables will lose 5 bytes of data). If that is true was this intended to truncate data?
Why would I want to use LEN Keyword on a Data Structure when you can automatically declare subfields and let the compiler generate the byte-length needed for the ds?
Thanks for any insight or help you can provide.
I'm looking over http://www.omniuser.org/downloads/om...PGFreeForm.pdf these slides (slide number 31)
PHP Code:
//Only character keys supported for program- described
//For other types, use a data structure
dcl-f generic disk(2000) keyed(*CHAR:7);
dcl-ds key len(7) qualified;
item_num packed(12);
end-ds;
key.item_num = 14;
chain key generic;
So does that mean this data structure is supposed to be 7 bytes long? (Assuming a character is 1 byte). However in this example there is a subfield that is packed(12). It seems like the subfield isn't going to fit properly (I say that variables will lose 5 bytes of data). If that is true was this intended to truncate data?
Why would I want to use LEN Keyword on a Data Structure when you can automatically declare subfields and let the compiler generate the byte-length needed for the ds?
Thanks for any insight or help you can provide.
Comment