myITforum and Windows IT Pro Forums
Forum Themes:
Welcome !

 *srvpgm P1 needs to bind with P2, but P2 also needs to bind to P1. Chicken/egg problem.

Author Message
xrunner

  • Total Posts : 8
  • Scores: 0
  • Reward points : 1510
  • Joined: 4/6/2017
  • Status: offline
*srvpgm P1 needs to bind with P2, but P2 also needs to bind to P1. Chicken/egg problem. Thursday, April 06, 2017 5:46 PM (permalink)
0

I've tried writing this post a couple of times because I'm attempting to ask the question without getting buried in details. If I'm not making any sense, please ask for clarification.
*******************
Intro:
I'm a seasoned i5 developer, but my employers have never encouraged *srvpgm coding. I've read Scott's articles, presentations from Barbara Morris and presentations from Susan Ganter, but as soon as I stepped out to real life I'm running into questions.

Initially I created my modules and then created the *srvpgms by statically binding the modules.

Problem:
I'm wanting to take the next step and use *bnddir instead of binding modules.

I have several procedures in module M1 and several more in module M2. I have my prototype copybooks for each and am using them to create the modules. The modules create fine.

When I try to create *srvpgm P1 the system complains that the *srvpgms from the *bnddir aren't found and that definitions aren't found for symbols. That makes sense since the dependent *srvpgm doesn't exit.

My question is more a best practice question.

Is it better to have multiple levels of service programs? Do I need to create P1 with no references to P2, P2 with no references to P1 and then new P1.2 and P2.2 programs that use procedures across 'classes'? I was hoping to have one program per 'class'.

 
#1
    zombiehorde

    • Total Posts : 3
    • Scores: 0
    • Reward points : 570
    • Joined: 2/28/2017
    • Status: offline
    Re:*srvpgm P1 needs to bind with P2, but P2 also needs to bind to P1. Chicken/egg problem. Thursday, April 06, 2017 6:00 PM (permalink)
    0
    Service programs are supposed to be support procedures for full programs.  I use them to provide singular functions for specific tasks to be performed.  Like specific date type conversions and generic calls to system apis that return information needed, that kind of thing.  They shouldn't be a circular reference between them.  You can have one service program need another as part of the binding, but you can't have the service programs reference each other.  
     
    Binding directories are just like makefiles for C programs as they just provide a list of service programs and/or modules needed to build the complete program.  I've started using them myself and they make building programs a lot easier than invoking crtpgm on each module including the modules needed.  You can reference the binding directory in the ctl-opt spec.
     
    #2
      Barbara Morris

      • Total Posts : 2
      • Scores: 0
      • Reward points : 2070
      • Joined: 4/7/2017
      • Status: offline
      Re:*srvpgm P1 needs to bind with P2, but P2 also needs to bind to P1. Chicken/egg problem. Friday, April 07, 2017 5:34 PM (permalink)
      0
      To have two service programs referring to each other, you have to first build one of them with OPTION(*UNRSLVREF) so that it doesn't matter if it can't find all the procedures it needs. Then build the second one normally, then rebuild the first one with OPTION(*RSLVREF) this time.
       
      #3
        xrunner

        • Total Posts : 8
        • Scores: 0
        • Reward points : 1510
        • Joined: 4/6/2017
        • Status: offline
        Re:*srvpgm P1 needs to bind with P2, but P2 also needs to bind to P1. Chicken/egg problem. Monday, April 10, 2017 10:24 AM (permalink)
        0
        zombiehorde


        They shouldn't be a circular reference between them. 


        It would be nice if the requirement didn't exist, but I need to build a procedure that hides the details from the implementation. Thanks for your response.
         
        #4
          xrunner

          • Total Posts : 8
          • Scores: 0
          • Reward points : 1510
          • Joined: 4/6/2017
          • Status: offline
          Re:*srvpgm P1 needs to bind with P2, but P2 also needs to bind to P1. Chicken/egg problem. Monday, April 10, 2017 10:27 AM (permalink)
          0
          I thought I'd read this somewhere but didn't remember the details. Thanks, Barbara.
           
          #5
            Online Bookmarks Sharing: Share/Bookmark

            Jump to:

            Current active users

            There are 0 members and 1 guests.

            Icon Legend and Permission

            • New Messages
            • No New Messages
            • Hot Topic w/ New Messages
            • Hot Topic w/o New Messages
            • Locked w/ New Messages
            • Locked w/o New Messages
            • Read Message
            • Post New Thread
            • Reply to message
            • Post New Poll
            • Submit Vote
            • Post reward post
            • Delete my own posts
            • Delete my own threads
            • Rate post

            2000-2017 ASPPlayground.NET Forum Version 3.9