ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

CALLB: Creating a bound program.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • CALLB: Creating a bound program.

    I have one RPGLE program and one CLLE program. Inside RPGLE program a CallB is issued for CLLE program.

    How do I compile a program that will have two modules for above programs and will execute them, without needing the *MODULE objects of above programs. (I just need one program no *modules)

    I know this can be done, but don't know how. This is the first time I work with ILE code, any help is appreciated.

    In past I have done some coding with CallP and for that I used to make modules and call them up by declaring them in program using CRTPGM. But this way required *Module objects to be present in order to execute.

    Many Thanks
    *...1....+....2....+....3....+....4....+....5....+ ....6....+....7.......+....8.......+....9.......+. ...10.......+....11...
    C*There are only 10 type of people in this world, those who understand binary and those who don't.

  • #2
    Re: CALLB: Creating a bound program.

    You have to create the modules first. But once you've bound them together into a program, the modules can be deleted.

    Here's one way to do it.
    1. CRTCLMOD
    2. CRTRPGMOD
    3. CRTPGM PGM(PGMNAME) MODULE(CLMODNAME RPGMODNAME)
    4. DLTMOD CLMODNAME
    5. DLTMOD RPGMODNAME
    "Time passes, but sometimes it beats the <crap> out of you as it goes."

    Comment


    • #3
      Re: CALLB: Creating a bound program.

      Another way to do it is to create the CL Module, then add it to a binding directory. Add the binding directory name to the H-specs of your RPG program. Then compile your RPG program.

      1. CRTCLMOD
      2. ADDBNDDIRE (if it's not already there: you only have to add it once)
      3. Ad H-spec BNDDIR keyword (if it's not already there: you only have to add it once)
      4. CRTBNDRPG
      5. DLTMOD CLMODNAME
      "Time passes, but sometimes it beats the <crap> out of you as it goes."

      Comment


      • #4
        Re: CALLB: Creating a bound program.

        Originally posted by Prototype
        How do I compile a program that will have two modules for above programs and will execute them, without needing the *MODULE objects of above programs. (I just need one program no *modules) In past I have done some coding with CallP and for that I used to make modules and call them up by declaring them in program using CRTPGM. But this way required *Module objects to be present in order to execute.
        I'm curious, though, why do you care whether or not you have modules? Is it the actual creation of the modules you are trying to avoid? Or do you just dislike having them around after the program is created?
        "Time passes, but sometimes it beats the <crap> out of you as it goes."

        Comment


        • #5
          Re: CALLB: Creating a bound program.

          Why do you use CALLB instead of CALLP which is much better and more secure ?
          Philippe

          Comment


          • #6
            Re: CALLB: Creating a bound program.

            Originally posted by littlepd View Post
            I'm curious, though, why do you care whether or not you have modules? Is it the actual creation of the modules you are trying to avoid? Or do you just dislike having them around after the program is created?
            That's how program existed in Prod and I had to replicate that. I already did it the way you explained and was getting a "reference pointer error'. But I repeated the steps, recompiled everything and it worked.

            Did a bit of reading and seems like what I wanted to achieve is called static binding of modules and what I wanted to avoid is dynamic binding.
            I have no grudge against Modules

            I guess this also answers Mercury's question. It's not what what I should be doing, but it's just the requirements. If it was up to me, I would change the whole program .

            Hey but I wouldn't mind you telling me why CallP is secure and better!

            Thanks for all your help.
            *...1....+....2....+....3....+....4....+....5....+ ....6....+....7.......+....8.......+....9.......+. ...10.......+....11...
            C*There are only 10 type of people in this world, those who understand binary and those who don't.

            Comment


            • #7
              Re: CALLB: Creating a bound program.

              Originally posted by prototype
              Hey but I wouldn't mind you telling me why CallP is secure and better!
              Originally posted by me from "Who Knew You Could Do That with RPG IV?
              A Sorcerer’s Guide to System Access and More"
              The prototyped calls (CALLP or a function call) are just as efficient as CALL and CALLB and offer the advantages of prototyping and parameter passing by value. Neither CALL nor CALLB can accept a return value from a procedure.
              The prototyped call provides a much better interface and offers the benefits of parameter checking and a number of other advantages. Prototypes can do much more for you than simply defining the parameters to subprocedures. By using some of the optional keywords for prototypes, you can have the compiler check the number and type of parameters in your calling program and procedures. It can even accommodate small types of mismatches, such as passing an integer when the callee expects a value with decimal places.
              See more at http://www.redbooks.ibm.com/redbooks/pdfs/sg245402.pdf
              Last edited by Mercury; July 22, 2010, 08:46 AM.
              Philippe

              Comment


              • #8
                Re: CALLB: Creating a bound program.

                Thanks for taking time and sharing information. I will surely give this redbook a read.
                *...1....+....2....+....3....+....4....+....5....+ ....6....+....7.......+....8.......+....9.......+. ...10.......+....11...
                C*There are only 10 type of people in this world, those who understand binary and those who don't.

                Comment

                Working...
                X