ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

procedures and /Copy

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

  • procedures and /Copy

    /Copy for PI and PR statements

    Hi all. I need some expert advice on procedures. From what I have read we have to have a PI statment in a (sub)procedure and a PR statement with the same parms in the calling program (Main procedure?) I have also seen suggestions to use /Copy to replicate these in the code.
    My question is this: If I create a member to be used by the /Copy that only has the parameters listed, no PI or PR line in it. Then can I code just a PR line in the main procedure followed by /Copy to get the parms in there and in the subprocedure just code a PI line followed by the /Copy?
    I would like to do this so if the parms should change for any reason I can just change them in the copy member and recompile anything using them instead of having to go into each procedure and change them. I am new to procedures so it is all still a little fuzzy to me but this seems to make sense from a maintenance standpoint.

  • #2
    angel

    Can you take a look at this. I think this is what you want.

    Let me know



    Jimmy

    Comment


    • #3
      Close, but ...

      Thanks, I had read that post and it is close to what I am asking but...
      In the copybook you are using you have included the PR statement. I was wondering why I couldn't leave that line out and just define my parms in there. Then in the procedure code where you have your /copy statement I would insert a line with PR on it then the /copy. Also where you start the procedure code you retype the parameters with the PI line. I would like to just have the PI line there and another /copy that would include the parms. The thing is, I don't like the idea of typing the same parms 2 different places on the PR line and the PI line. Since we know these have to match up I would like to avoid typing errors etc. by specifying them once (in the code I would use for copy book) and then use /copy to put them wherever I need them in the procedures. There may be a good reason for not doing it this way but I don't have enough experience with procedures to know why.

      Comment


      • #4
        I know of no reason why you cant

        I know of no reason why you couldnt do that!!!


        Take care
        Jimmy

        Comment

        Working...
        X