|
Peter wrote: >Hi Patrick, > >I'll try<G>: > >The compiler sees PDLB02 in the data structure first, and allocates memory >for it there. > >Then it sees PDLB02 in the input specs and wants to allocate memory for it >within the input buffer, but it can't have a unique field name pointing to >two different memory locations. No, coding an input field allocates storage for the variable only if there is no other definition of the variable. You can easily specify a particular variable as an input field and also define it with a D-Spec. The D-Spec definition specifies explicitly how the variable is the be stored internally within the program. If there is no explicit definition of the variable, the information on the Input-Field spec is used to implicitly define the variable. For example, numeric variables implicitly get defined as packed (regardless of the external attributes of the numeric field). > >I believe with V5R1 you are able to use the data structure name (which your >example doesn't have) as a qualifier to the field name, so you could indeed >have the duplicate name. But you'd have to be aware that the value in one >would not automatically be copied to the other. Indeed! This is perhaps the most important enhancement to RPG in V5R1, and will likely be expanded on in future releases. Code keyword QUALIFIED on the DS spec, and subfields within the data structure are referred to using the DSNAME.SUBFNAME syntax. This is an important enhancement - so important that I believe that programming standards in RPG shops should be updated to require all data structures to be qualified if possible. Cheers! Hans Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.