Bob,
Looking at the compile listing, The field in
question is defined as 9s 0 everywhere until the global field references
section when it shows as P(9,0).
Has anyone seen this before?
Working as designed, provided the field is not also defined in a DS
somewhere.
Numeric fields from externally described files will be in packed format in
the program storage whether zoned or packed in the DDS, unless you use a
DS. The field gets converted to/from packed format as part of the field
movement from the record buffer.
The reason for this is because, as I understand it, (at least in the CISC
days) it optimized the usage of the field during execution eg, when you
performed calculations with it. Although the CPU had instructions for adding
packed to zoned or vice versa, it was more efficient to always use a single
type. On the 38/400 this was packed. On the 34/36, the exact opposite was
true and all calculations were done on zoned fields, even if defined as
packed in the record layout.
In fact, this leads to hoops you have to jump through when calling between
RPG II and RPG/400 or ILE programs and passing numerics via PLIST/PARM.
I don't know if the RISC machines are more efficient using packed, but IBM
can't just change the compiler behavior now since would impact existing
programs if they got recompiled.
Doug
As an Amazon Associate we earn from qualifying purchases.