|
>From: "Peter Dow" <pcdow@yahoo.com> >Date: Thu, 23 Aug 2001 15:30:17 -0700 > >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. Peter, the compiler doesn't allocate memory for input fields in the input buffer. The input specs actually describe "move" operations from the input buffer to program fields. The compiler uses the input spec information to generate definitions for you, if you don't already have explicit definitions. (The memory for the input buffer is already allocated by database.) So it's perfectly normal and reasonable to have a D-spec definition for a field that appears in an input spec. Just like it's normal and reasonable to have the same field in two different input specs, for two different files. Example: D FLD1 S 5P 0 I S 11 15 0 FLD1 FLD1 is zoned(5,0) in the input spec. FLD1 is packed(5,0) on the D spec. The input spec says "move the zoned field in positions 11-15 of the input buffer to FLD1, whereever FLD1 happens to be". This is one of the central features of RPG that makes it different from other languages. (You're not alone in thinking that I-specs are definitions. It's one of the most common misconceptions about RPG. The more common symptom of this misconception is thinking that if a field is zoned in the database, it must also be zoned in RPG.) Barbara Morris
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.