crtpgm ... entmod(mylib/fruitdir) bnddir(mylib/fruitdir)
Register Hereor login if you are already a member
Please note that, this is a C program with the standard entry point called main.I would like to pass: entmod(*first)
Let me clarify with an example.The sources are: fruit.c melon.c apple.c grape.cThe main functions is defined in: fruit.cThe program is called fruit.pgm
I have 2 ways to create it successfully, shown below asCASE#1 , and CASE#2 .
===================================CASE#1: passing MODULE list.===================================crtpgm pgm(pgmagjdbg/fruit)detail(*extended)usrprf(*user)option(*dupproc *dupvar)entmod(*first)MODULE( pgmagjobj/melon pgmagjobj/apple pgmagjobj/fruit pgmagjobj/grape )BNDSRVPGM( pgmagjdbg/box )
===================================CASE#2: using bind directory===================================DLTBNDDIR BNDDIR(PGMAGJDBG/fruitdir)CRTBNDDIR BNDDIR(PGMAGJDBG/fruitdir)ADDBNDDIRE BNDDIR(PGMAGJDBG/fruitdir) OBJ((pgmagjobj/melon *MODULE))ADDBNDDIRE BNDDIR(PGMAGJDBG/fruitdir) OBJ((pgmagjobj/apple *MODULE))ADDBNDDIRE BNDDIR(PGMAGJDBG/fruitdir) OBJ((pgmagjobj/fruit *MODULE))ADDBNDDIRE BNDDIR(PGMAGJDBG/fruitdir) OBJ((pgmagjobj/grape *MODULE))DSPBNDDIR BNDDIR(PGMAGJDBG/fruitdir)
crtpgm pgm(pgmagjdbg/fruit)detail(*extended)usrprf(*user)option(*dupproc *dupvar)entmod(*FIRST)MODULE( pgmagjobj/fruit )BNDDIR(pgmagjdbg/fruitdir)BNDSRVPGM( pgmagjdbg/box )
===========================PROBLEM + QUESTION===========================I cannot use CASE#1, because unlike my example, we actually have programs with more than 300 modules, which is more than the max count of modules allowed.
I would like to use CASE#2, which puts the listing of modules in a bind directory, and thus it can exceed 300.However, I still have to specify the MODULE option with themodule that contains the main function.
HOWEVER, here's my QUESTION pertaining CASE#2 ...Since all modules are already listed in the bind directory how can I eliminate the need to specify the MODULE option with the module that contains the main function?
The reason for this, is that the driver that generates the link lines knows all the modules that make up a program, but it does not know which one contains the main function.Currently I need to dynamically display MODULE info for each module looking for _C_pep .
Please note that in CASE#1entmod(*first)MODULE( pgmagjobj/melon pgmagjobj/apple pgmagjobj/fruit pgmagjobj/grape )The first module containing the entry point is found from the list in MODULE.
I am asking if in CASE#2 I could use entmod(*first) without MODULE, but somehow have CRTPGM search the list in the bind directory.
Please note that the actual name of the entry point does not have to be specified to CRTPGM.Quoting the documentation for CRTPGM ..."Program entry procedure module (ENTMOD)Specifies the module name that contains the program entry procedure specification to be used for this program."
We compile our sources with the C++ compiler:CRTCPPMODWhen a source is compiled that contains a functions called "main", the compiler will generate a MODULE with the following attribute:Program entry procedure name: _CXX_PEP__Fv
otherwise, the compiler generates a MODULE with:Program entry procedure name: *NONE
The existence of an entry procedure name in a module is recognized by CRTPGM , based on the value of option ENTMOD() and sometimes option MODULE() as well.
Note that when you create a service program with CRTSRVPGM you have to specify entry point names, but when you create a program with CRTPGM, you only provide the name of the module that contains the program entry procedure, not the name ofthe entry procedure itself.
We also have some programs in which the entry procedure is contained in a module that has a module name different from the program name, so ENTMOD(*PGM) would not work in those cases.
The use of ENTMOD(*FIRST) with MODULE( ... list of modules ... )tells CRTPGM to find the first module from the list of modules in the MODULE option, that has a program entry procedure.
However the list of modules cannot exceed 300, and we have some programs with more that 300 modules. Therefore we use bind directories, in which case the list of modules is specified in the bind directory. My question is whether it is possible to specify a value in ENTMOD() anlogous to *FIRST that will tell CRTPGM to find the first module from the list of modules in the bind directory, not in theMODULE() option.