With CRTPGM, can ENTMOD(*FIRST) search a BNDDIR?

45 pts.
Tags:
AS/400
CRTPGM
Can one make CRTPGM find the module with the entry point from a bind directory instead of from the list of modules? I'm thinking of something like: crtpgm ... entmod(mylib/fruitdir) bnddir(mylib/fruitdir)
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 6  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ajaliff
    Please note that my goal is to add all the needed modules to the bind directory and have CRTPGM find the first module that contains the entry point from the bind directory.
    45 pointsBadges:
    report
  • TheRealRaven
    How are you expecting it to know what entry point it should be looking for?
    35,650 pointsBadges:
    report
  • ajaliff

    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.c
    The main functions is defined in: fruit.c
    The program is called fruit.pgm

    I have 2 ways to create it successfully, shown below as
    CASE#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 )

    45 pointsBadges:
    report
  • ajaliff

    ===========================
    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 the
    module 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#1
    entmod(*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.

    45 pointsBadges:
    report
  • TheRealRaven
    In your examples, you could specify ENTMOD(*PGM) MODULE(*PGM). Since the *MODULE is named the same as the program, there's no need for anything more when you use BNDDIR().

    But it won't work the way you're asking. You say "The first module containing the entry point...", but nowhere are you giving the name of an entry point. Entry points aren't necessarily named "main" and a "main" isn't assumed to be the entry point. (Most entry points are not named "main".)
    35,650 pointsBadges:
    report
  • ajaliff

    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:
    CRTCPPMOD
    When 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 of
    the 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 the
    MODULE() option.

    45 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: