|
I'm confused about something I stumbled on this morning with array definitions. I want to pass an array to a procedure and I define the procedure as follows: Prototype-- D pushmode pr n D entry like(mode) const D stack like(mode) dim(MAXMODE) D top like(modetop) D Procedure interface-- P pushmode b D pushmode pi n D entry like(mode) const D stack like(mode) dim(MAXMODE) D top like(modetop) D MAXMODE is a constant defined before the procedure prototypes in the source file. It looks like this: D MAXMODE C const(50) The compile fails with various errors relating to the procedure definition centering around the use of MAXMODE. My favorite is: *RNF3764 30 027300 Definition of parameter (A(10)) not same as definition of parameter in prototype (A(10) DIM(50)). It looks like the compiler sees the named constant in the prototype, but not in the actual procedure definition. The program compiles fine if I dimension the array in the procedure definition using a numeric literal. (I didn't try using something other than 50, though.) Is this the way it ought to work? Is a named constant less global than a variable, or does this have to do with the behavior of the DIM keyword in a procedure definition versus a D spec in a MAIN program? +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.