Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
3 replies Latest Post - ‏2013-01-10T06:22:39Z by kumar.ss
kumar.ss
kumar.ss
4 Posts
ACCEPTED ANSWER

Pinned topic DB2 COBOL Stored procedure - COBOL compilation requirement : need help

‏2012-12-12T08:06:31Z |
Hi,

We have a integration requirement where we need to invoke COBOL on z/OS from java running on unix.
we are exploring option of using DB2 stored procedure written in COBOL.

Redbook documentation/example has step to compile/link the COBOL program and load into db2 load lib.

Is it possible to re-use already compiled existing COBOL program?
i.e is it possible to point DB2 to use COBOL from existing library? if yes, then please let me know how to do it
Updated on 2013-01-10T06:22:39Z at 2013-01-10T06:22:39Z by kumar.ss
  • ToddBurchDB2
    ToddBurchDB2
    74 Posts
    ACCEPTED ANSWER

    Re: DB2 COBOL Stored procedure - COBOL compilation requirement : need help

    ‏2012-12-12T11:50:27Z  in response to kumar.ss
    It depends.

    There are two aspects. Issuing the CREATE PROCEDURE statement, and writing the procedure itself.

    The CREATE PROCEDURE statement tells DB2 about the input and output parameters, and also a bit about how the procedure operates (does it READ DB2 data, MODIFY DB2 data, etc.)

    The COBOL code must be able to receive the input parameters as DB2 builds the parameter list, and populate the output variables as DB2 requires as well. I would suspect your COBOL program does not conform to this requirement today.

    On the whole, you can probably reuse most of your existing program logic, but it must be able to conform to the operating environment in which it will run (under WLM).

    Todd
  • SystemAdmin
    SystemAdmin
    3105 Posts
    ACCEPTED ANSWER

    Re: DB2 COBOL Stored procedure - COBOL compilation requirement : need help

    ‏2013-01-05T08:25:00Z  in response to kumar.ss
    i assume you don't want to change your existing code since other programs are calling it / using it
    what i would do is to write a wrapper program in cobol. That program will be invoked by the stored procedure, it will set up all the parameters the way db2 expects and then call the existing code. This way you don't touch your existing code, you just add a rather simple adapter which does the necessary integration with db2
    • kumar.ss
      kumar.ss
      4 Posts
      ACCEPTED ANSWER

      Re: DB2 COBOL Stored procedure - COBOL compilation requirement : need help

      ‏2013-01-10T06:22:39Z  in response to SystemAdmin
      thanks for your replies. yes, we wrote wrapper programs because existing program linkage section variable was declared at different level and not 01.

      we found out answers for my question (can we use existing compiled cobol program).
      the answer is yes and no. :-)
      yes - if the cobol program do not have any DB call.
      NO - if the COBOL program has DB call/statement.

      reason: our existing programs were compiled with DSNCLI.
      finally we recompiled (cobol program with db2 calls) with DSNRLI and it is working for select. we are testing it for update now.