What is a qualified data structure? How do we qualify the data structure subfields? Please explain its usage with an example and provide the sample code in fixed-format RPG, free-format RPG, and fully-free RPG.
Sorry, you do not have permission to ask a question, You must login to ask a question.
Sorry, you do not have permission to ask a question.
The data structure can be qualified using the
QUALIFIED
keyword in rpgle. The termQUALIFIED
indicates that data structure subfields are addressed with qualified notation. If theQUALIFIED
keyword is provided for data structureuserDS
with a subfielduserid
, we can access a data structure subfield using the data structure name followed by a period and the subfield name, i.e.userDS.userid
.Syntax of qualified data structure in fixed format RPG.
D userDS DS QUALIFIED
D userid 10P 0
D name 20A
Syntax of qualified data structure in free format RPG (fully free RPG).
**FREE
dcl-ds userDS QUALIFIED;
userid packed(10:0);
name char(20);
end-ds userDS;
Sample RPG program in the fixed format using a qualified data structure
Sample RPG program in the free format using a qualified data structure
Sample RPG program in the fully free format using a qualified data structure