Announcement

Collapse
No announcement yet.

Procedure Pointers

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

  • Procedure Pointers

    I was just wondering if theres a way to call a procedure being referenced by a procedure pointer. Basically the free-format version of the below code

    Code:
    D Procedure1         PR
    D Proc1                  S                          *          PROCPTR  INZ(%Paddr(Procedure1))
    C
    C                            CALLB                Proc1
    C                            EVAL                  *INLR = *ON
    C
    C
    P Procedure1         B
    D Procedure1         PI
    C
    C        'TEST'           DSPLY 
    P Procedure1         E
    Last edited by vikramx; June 20, 2008, 12:06 PM.

  • #2
    Re: Procedure Pointers

    None of the free-format or RPG pros have any idea about this?

    Comment


    • #3
      Re: Procedure Pointers

      i haven't really done anything with procedure pointers...but CALLB is deprecated and really shouldn't be used anymore. CALLP is the best way to go. not quite sure about using procedure pointers to an internal procedure, i thought procedure pointers were only used for external (service program) procedures? but anyway maybe someone here has used them before...if i get a chance i'll see if i can play around with it some.
      I'm not anti-social, I just don't like people -Tommy Holden

      Comment


      • #4
        Re: Procedure Pointers

        here's a link to an example i googled PROCPTR
        http://home.xtra.co.nz/hosts/eggyolk...activator.html
        I'm not anti-social, I just don't like people -Tommy Holden

        Comment


        • #5
          Re: Procedure Pointers

          I checked the link but it doesnt seem to answer my question. Let me explain with an example

          Ex: Say i have a procedure GetNumbers and i have mapped it to a procedure pointer variable ProcPtr1. Now if i execute CALLB ProcPtr1 then the procedure GetNumbers will be executed since thats the procedure ProcPtr1 points to. Now since CALLB isnt allowed in free-form i was wondering if theres another way to use the ProcPtr1 procedure pointer variable in free-from.

          In short, i need an equivalent of CALLB in free-form or a way to access procedure pointers using CALLP.

          Comment


          • #6
            Re: Procedure Pointers

            CALLP should work. CALLP is the free-format replacement for CALL and CALLB.
            I'm not anti-social, I just don't like people -Tommy Holden

            Comment


            • #7
              Re: Procedure Pointers

              ok here's a link to an article from ITJungle regarding pointers and proc pointers that should help.
              http://www.itjungle.com/mpo/mpo031303-story04.html
              seems that your prototype must be based on the pointer rather than setting a pointer to the address of the proc...but that's just at a cursory glance at the article.
              I'm not anti-social, I just don't like people -Tommy Holden

              Comment


              • #8
                Re: Procedure Pointers

                here's a good one! http://www.astradyne-uk.com/manuals/gd002102.pdf
                of course anything by Jon Paris and the gang has gotta be good
                I'm not anti-social, I just don't like people -Tommy Holden

                Comment


                • #9
                  Re: Procedure Pointers

                  Thanks a lot Tom, i';ll try these methods out and see if it works in my case.

                  Comment


                  • #10
                    Re: Procedure Pointers

                    I tried the ITJungle link and found what i was looking for. The PDF file by Jon Paris and gang didnt quite explain what i wanted. Anyways thanks a lot Tom

                    Comment

                    Working...
                    X