ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Receive parameters

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

  • Receive parameters

    PLEASE ANYBODY GUIDE ME HOW TO RECEIVE PARAMETERS IN COBOL...LIKE * ENTRY IN RPG....

  • #2
    Re: Receive parameters

    use the LINKAGE SECTION (linkage = parameters)

    define the parameters like so:
    Code:
    LINKAGE SECTION.          
    01  LINKAGE-DATA.         
        05  PLA-DEALER-STORE-CODES.                   
            10  PLA-DEALER-CD          PIC XXX.       
            10  PLA-STORE-CD           PIC XX.        
        05  PLA-FUNCTION-NAME          PIC X(10).
    the *entry equivalent:
    Code:
    PROCEDURE DIVISION USING LINKAGE-DATA.
    I'm not anti-social, I just don't like people -Tommy Holden

    Comment


    • #3
      Re: Receive parameters

      Hi Tomholden

      thanks.......but in my program they are used parameters .but i cannot find the parameters value i.e

      01 LINKAGE-AREA.
      02 POLICY-LINKAGE.
      03 POLICY-RECORD.
      COPY DDS-ALL-FORMATS OF DWXP110.

      COPY CWXPLINK OF QCOPYSRC.

      LINKAGE SECTION.

      COPY CWXP150LK OF QCOPYSRC.
      03 AGYTYP PIC X.


      here they are using linkage area and linkage section.? is there any way to find the parameters length ? like %parms in rpgle......

      Comment


      • #4
        Re: Receive parameters

        Originally posted by rajapandian View Post
        Hi Tomholden

        thanks.......but in my program they are used parameters .but i cannot find the parameters value i.e

        01 LINKAGE-AREA.
        02 POLICY-LINKAGE.
        03 POLICY-RECORD.
        COPY DDS-ALL-FORMATS OF DWXP110.

        COPY CWXPLINK OF QCOPYSRC.

        LINKAGE SECTION.

        COPY CWXP150LK OF QCOPYSRC.
        03 AGYTYP PIC X.


        here they are using linkage area and linkage section.? is there any way to find the parameters length ? like %parms in rpgle......
        Ignore the 01 LINKAGE-AREA for now. The parms are all going to be defined within the COPY source CWXP150LK. Each parm should have an 01 level definition within that source.

        No there is no equivalent in COBOL to RPG's %PARMS but that does not prevent you from using the CEEDOD API (http://publib.boulder.ibm.com/infoce...pis/CEEDOD.htm) to obtain equivalent information.


        JonP

        Comment


        • #5
          Re: Receive parameters

          Thanks....tom

          one more thing....i had a call from cobol to rpg..iam going to write in that rpg program. From cobol program we have to send parameters ....

          Now i want to know
          1, how the call in cobol program look like?
          2.how wil you get the parameters in rpg program? Using *entry plist?

          Comment


          • #6
            Re: Receive parameters

            Originally posted by rajapandian View Post
            Thanks....tom

            1, how the call in cobol program look like?
            2.how wil you get the parameters in rpg program? Using *entry plist?
            CALL 'RPGPGMNAME' USING Parm1, Parmm2, etc.

            This assumes normal parm passing by reference and that it is a PGM call not a procedure. Not wishing to be rude but this is explained very clearly in the manual.

            Receive parms exacly the same way as you would if being called from RPG. Personally I stopped using *Entry Plist about 12+ years ago - I use a procedure interface (PI) but certainly a PList would work.


            JonP

            Comment


            • #7
              Re: Receive parameters

              Sorry guys

              am new to cobol program...............

              I am calling rpgle program from cobol program(opm)

              in cobol program we declared the parameters under the linkage area.it has nearly 500 fields

              but i need only 4 fields parameters for calling that rpgle program

              what should i do now?

              I called with the four parameters,am getting pointer error?

              Comment


              • #8
                Re: Receive parameters

                You are getting yourself crossed up between the requirements for COBOL being _called_ from RPG and COBOL _calling_ RPG.

                Linkage is _only_ for defining parameters that are being passed TO the program (i.e. an RPG *ENTRY PLIST or PI parm)

                When calling an RPG program (or indeed another COBOL program) the parms you pass can be anywhere in the COBOL program (Working Storage, File Section, Linkage) you can only pass parameters from Linkage if they were passed on a call to that COBOL program.

                Assume R1 and R4 are RPG, C2 and C3 are COBOL. If R1 calls C2 calls C3 calls R4 then (using CALL/PARM in RPG)

                R1
                ==
                D X <-stand alone field or ...
                CALL 'C2'
                PARM X

                C2
                ==
                Linkage defines X as 01 level.
                Procedure Division using X.
                Call 'C3' using X.

                C3
                ==
                Linkage defines X as 01 level.
                Procedure Division using X.
                Call 'R4 ' using X.

                R4
                ==

                Defines X in entry PLIST or PI.

                Comment

                Working...
                X