/Copy member issue

Theo Kouwenhoven
Theo Kouwenhoven used Ask the Experts™
on
Hi Experts,

In a RPG program I use /COPY with qualified names and unqualified names.
e.g.
/Copy MyFile1.rpgleinc
/Copy MyFile2.rpgleinc
/Copy /Standard/Version9/Rel5/gplcalc.rpgleinc

Using the CRTRPGMOD parameter INCDIR('/Home/user/myPrograms/includes'), it will find the right include-files and the module is created without errors.
When I try to create a program from the module I get the following error:

Message-ID . . . . . . :   CPD5D02      
                                                                             
Message . . . . :   Definition not found for symbol   'getSubSetCustomer'                        

Cause . . . . . :   No definition was found for reference                    
  getSubSetCustomer in *MODULE object MyProg2 in library MYLIB.
  The definition either does not exist or is not of the same data or procedure
  type as the reference.                                                      
Recovery  . . . :   Try the Create Program (CRTPGM) command again, supplying  
  an object that contains a definition for symbol  getSubSetCustomer


Without the INCDIR() and full qualified names, the program is working.

Because of copy/move and maintenance, I prefer to use the unqualified name for most of the include files, is that possible?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
VP Technology / Senior Consultant
Commented:
/COPY rules are complicated, and documented here:

https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/rzasc/copyifspath.htm

Most likely the compiler is finding a source file with the right name in a directory that you don't expect.  Look at the listing, it shows where it found the file.

When you search for a relative path (no leading slash) this is the search order:

Current directory
INCDIR command parm
RPGINCDIR environment variable paths
The source directory of the main source
Plus iN qsys: *LIBL/qrpglesrc.[FILENAME]

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial