ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

passing parms in COBOL

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

  • passing parms in COBOL

    hello all...

    I just started a new job...switched from exclusively programming in RPGLE to COBOL (not even COBOL ILE but COBOL OPM only). The code is very well structured so, for the most part, is easy to follow. However, it's been a number of years since i programmed in COBOL. I'm trying to pass a parameter that is user entered on a screen to another program and i'd like to populate that same variable on the new screen. Is there a way to do this in COBOL??? I know how to do it in RPG but for some reason, I cannot seem to make it work in COBOL. I do not want to force the user to reenter data on screen. Any help you can provide will be appreciated.

  • #2
    Re: passing parms in COBOL

    This sounds like a job for SUPER-Terry!!!
    I'm not anti-social, I just don't like people -Tommy Holden

    Comment


    • #3
      Re: passing parms in COBOL

      @tomholden

      ROTFLMAO

      @caren

      Assuming that a standard COBOL program A is calling another COBOL program B, this would work:

      Add a Linkage Section to Program B (just before the Procedure Division):
      Code:
      Linkage Section.                             
                                                   
      01  My-Parameter                 pic  x(12).
      Then add a USING statement to Program B's Procedure Division header like this:
      Code:
      procedure division                           
                          using  My-Parameter.
      Finally, in Program A, make the call to Program B as follows:
      Code:
                          call 'ProgramB' using PgmA-Param
      Note that Program A's parameter (PgmA-Parm) and My-Parameter must be the same size -and- type of variable in both programs.

      Once Program B has control it can then place it in the display file...

      Terry

      Comment


      • #4
        Re: passing parms in COBOL

        thanks for the response Terry...

        it took me a while this morning but i did indeed do just that and found it worked as i said initially, it's been a while since i coded in COBOL so I'm sure i'll have additional (stupid) questions until i get back in the swing of it...lol

        again...thanks to all for your assistance

        Comment

        Working...
        X