I disagree with Jon, I use only one set of compiler directives, if the copybook name is "RCS0000" and thus the name of the service program is RCS0000 in my environment, the compiler directives would look like:
/If Not Defined(RCS0000)
/Define RCS0000
/Else
/Eof
/EndIf
If this copybook has been copied into the module before by the compiler it will hit the /Eof directive and stop reading/copying the copybook. This prevents you from having 10s or 100s of compiler directives.
The other point is ALL data structures in a copy book should be Qualified and Templates. Pre 6.1 I would do this:
MyDs_t DS Qualified
Based(templateBase)
templateBase would be created by the compiler and would never be used in the code, the compiler will probably eventually throw it away because it is not used, but at worst you would only have 16 bytes of unused storage.
When we went to 6.1 I found all the "Based(templateBase)" strings in copybooks and replace them with "Template".
Duane Christen
--
Duane Christen
Senior Software Engineer
(319) 790-7162
Duane.Christen@xxxxxxxxxx
Visit PAETEC.COM
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jon Paris
Sent: Wednesday, September 23, 2009 12:16 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Problem with non QUALIFIED DS
First option - including DS definitions in a proto member s not a terribly good idea unless you are going to incorporate compiler directives. So you could add:
/If not defined (MyDS)
D MyDS E DS extname( myfile)
/Define (MyDS)
/EndIf
Sysntax may not be right but you'll get the picture. Include this in all protos that include the MyDS definition. This ensures you will only get it copied once. You could also replace the definition of MyDS with a /COPY of the MyDS details.
Second option - Use the PREFIX keyword on the MyDS definition to give each copy a unique name.
It all depends on whether you want/need multiple copies of MyDS.
Jon Paris
www.Partner400.com
www.SystemiDeveloper.com
On 23-Sep-09, at 1:00 PM, rpg400-l-request@xxxxxxxxxxxx wrote:
I've just added a prototype via a copybook in my module and it won't
compile because it now has several fields defined more than once.
I discover that I now have 2 prototypes copied in, each one with a
data structure parameter declared like so :
D Parm likeds (myds)
D MyDS E DS extname( myfile)
...
Any thoughts on this? I'm not looking forward to taking time out to
correct this, test it, etc. Maybe there's a work around?
As an Amazon Associate we earn from qualifying purchases.