Reputation: 91
I have this weird problem while reading a file in an RPGLE program.
fmosdp00 if e k disk prefix(xx:2)
SetLL ('HF':'30':'032':'SK':'0095320':'002':0:0001) mosdp00a;
Reade ('HF':'30':'032':'SK':'0095320':'002':0) mosdp00a;
*Inlr = *On;
The above SETLL and READE does not seem to set field values of MOSDP00 file as required.
When I run this program in Debug mode and do an EVAL XXMORD (field of MOSDP00) post the READE, it is blank.
But If i add some operation using any of these fields, for instance, DSPLY XXMORD, then the program seems to set this field value.
Can somebody help to understand this.
Upvotes: 0
Views: 406
Reputation: 11473
The RPG compiler optimizes out variables that are not used. So in debug, if you try to view the value off a variable that is only implicitly defined by the record format, but not used in the program, you will not see a value. It is not an issue with prefixes. When you added the DSPLY XXMORD
operation, you added a usage of the field, and this prevented the compiler from optimizing it out. This allows you to see the field in Debug. If you try another field on the record format that is not being used, it will again show blank in debug.
Upvotes: 7