IBMiAccess




Results 1 to 8 of 8

Thread: CALLB: Creating a bound program.

  1. #1
    Analyst Programmer Prototype's Avatar
    Join Date
    Nov 2009
    Location
    London, UK
    Age
    30
    Posts
    100
    Rep Power
    467

    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. # 666
    Circuit advertisement
    Join Date
    Aug 1965
    Location
    Yakutsk, Russia
    Age
    21
    Posts
    1,000,000
     

  3. #2
    Moderator littlepd's Avatar
    Join Date
    Mar 2005
    Location
    Lewisville, TX
    Age
    50
    Posts
    1,111
    Rep Power
    3354

    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."

  4. #3
    Moderator littlepd's Avatar
    Join Date
    Mar 2005
    Location
    Lewisville, TX
    Age
    50
    Posts
    1,111
    Rep Power
    3354

    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."

  5. #4
    Moderator littlepd's Avatar
    Join Date
    Mar 2005
    Location
    Lewisville, TX
    Age
    50
    Posts
    1,111
    Rep Power
    3354

    Re: CALLB: Creating a bound program.

    Quote Originally Posted by Prototype View Post
    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."

  6. #5
    Programmer Mercury's Avatar
    Join Date
    Feb 2007
    Location
    Paris, France
    Posts
    1,831
    Rep Power
    5430

    Re: CALLB: Creating a bound program.

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

  7. #6
    Analyst Programmer Prototype's Avatar
    Join Date
    Nov 2009
    Location
    London, UK
    Age
    30
    Posts
    100
    Rep Power
    467

    Re: CALLB: Creating a bound program.

    Quote 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.

  8. #7
    Programmer Mercury's Avatar
    Join Date
    Feb 2007
    Location
    Paris, France
    Posts
    1,831
    Rep Power
    5430

    Re: CALLB: Creating a bound program.

    Quote Originally Posted by prototype
    Hey but I wouldn't mind you telling me why CallP is secure and better!
    Quote 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 22nd, 2010 at 09:46 AM.
    Philippe

  9. #8
    Analyst Programmer Prototype's Avatar
    Join Date
    Nov 2009
    Location
    London, UK
    Age
    30
    Posts
    100
    Rep Power
    467

    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.

  10. # 666
    Circuit advertisement
    Join Date
    Aug 1965
    Location
    Yakutsk, Russia
    Age
    21
    Posts
    1,000,000
     

Facebook Comments


Similar Threads

  1. Creating a job
    By bhanu1225 in forum Iseries System administration
    Replies: 3
    Last Post: March 24th, 2010, 10:13 AM
  2. Creating a new version of a service program
    By bryce4president in forum RPG/RPGLE
    Replies: 4
    Last Post: December 19th, 2008, 08:09 AM
  3. Bound Modules Question
    By soup_dog in forum ANY THING GOES
    Replies: 2
    Last Post: March 2nd, 2007, 10:47 AM
  4. Callb
    By dexum in forum RPG/RPGLE
    Replies: 8
    Last Post: September 28th, 2006, 09:52 AM
  5. Replies: 11
    Last Post: August 8th, 2006, 12:12 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •