ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Trying to make a call from linkage section.

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

  • Trying to make a call from linkage section.

    I always call a subprogram using a 01 level CWXP119-LINKAGE in WS. ie. CALL 'CWXP119' USING CWXP119-LINKAGE. This always works. Because of this application, I want to call a subprogram directly from the calling program LINKAGE SECTION ie. :

    PROGRAM ID. CWXP115.

    LINKAGE SECTION.
    01 LINKAGE-AREA.
    05 SOMETHING PIC X(9000).

    *** call the subprogram. This is what I want to do.

    CALL 'CWXP119' USING LINKAGE-AREA.

    *** this gets me to the subprogram CWXP119, it executes however when I hit the GOBACK and/or EXIT PROGRAM at the end of subprogram CWXP119, the last page of the program is displayed in debug and it gives me an addressing error. I think this method should work. Can someone give me a thumbs up or down? Or, if you have a solution please let me know. Thank you.

  • #2
    Re: Trying to make a call from linkage section.

    Your code looks fine. Can you be more specific about the addressing error? Message ID? Text?

    Comment


    • #3
      Re: Trying to make a call from linkage section.

      Originally posted by mytruck_82
      I always call a subprogram using a 01 level CWXP119-LINKAGE in WS. ie. CALL 'CWXP119' USING CWXP119-LINKAGE. This always works. Because of this application, I want to call a subprogram directly from the calling program LINKAGE SECTION ie. :

      PROGRAM ID. CWXP115.

      LINKAGE SECTION.
      01 LINKAGE-AREA.
      05 SOMETHING PIC X(9000).

      *** call the subprogram. This is what I want to do.

      CALL 'CWXP119' USING LINKAGE-AREA.

      *** this gets me to the subprogram CWXP119, it executes however when I hit the GOBACK and/or EXIT PROGRAM at the end of subprogram CWXP119, the last page of the program is displayed in debug and it gives me an addressing error. I think this method should work. Can someone give me a thumbs up or down? Or, if you have a solution please let me know. Thank you.

      Comment


      • #4
        Re: Trying to make a call from linkage section.

        Thanks Ted. I appreciate your reply. I have the issue figured out but since it was yesterday I can't remember the details. Most likely my problem evolved from mismatched linkage. It seems like you should be able to make a call from the 01 level in the linkage section as opposed to a definition in WS. Again thank you. Gary

        Comment


        • #5
          Re: Trying to make a call from linkage section.

          How do you get addressability to the Linkage Section item? Assumedly via Procedure Division Using ... but you don't show that code so I can't tell. If you don't have that then the field has no address and will cause a fault when you try to use the field in the called routine.

          Comment

          Working...
          X