+ Reply to Thread
Results 1 to 3 of 3

Thread: Call Cobol/400 program from RPG/400

  1. #1

    Default Call Cobol/400 program from RPG/400

    On Thursday, November 27, 1997, 08:48 PM, damian Esealuka wrote: I need to be able to write a code in RPG/III/400 that will be able to call a cobol program and return to RPG upon completion. Can someone please show me how this is done. Thanks. Simply use the CALL statement. Use the PARM statement for any parameters. Your COBOL program should include a LINKAGE SECTION to accept these parameters. If your COBOL program uses files not included in your RPG program, and you require overrides, you may have to write a CL Program which includes an OVRDBF statement. If this is the case, then your RPG program should call the CL program, and the CL program should call the COBOL program. Another method would use OVRDBF statements in the CL Program which calls the RPG program. These overrides will remain in effect when the COBOL program is called. David Abramowitz

  2. #2
    Guest.Visitor Guest

    Default Call Cobol/400 program from RPG/400

    On Friday, November 28, 1997, 04:01 AM, David Abramowitz wrote: On Thursday, November 27, 1997, 08:48 PM, damian Esealuka wrote: I need to be able to write a code in RPG/III/400 that will be able to call a cobol program and return to RPG upon completion. Can someone please show me how this is done. Thanks. Simply use the CALL statement. Use the PARM statement for any parameters. Your COBOL program should include a LINKAGE SECTION to accept these parameters. If your COBOL program uses files not included in your RPG program, and you require overrides, you may have to write a CL Program which includes an OVRDBF statement. If this is the case, then your RPG program should call the CL program, and the CL program should call the COBOL program. Another method would use OVRDBF statements in the CL Program which calls the RPG program. These overrides will remain in effect when the COBOL program is called. David Abramowitz
    the PROCEDURE STATEMENT has to have a "USING ..." clause , also. Bob Hamilton TEXAS BUSINESS SYSTEMS 736 Pinehurst Richardson, Texas 75080

  3. #3
    Guest.Visitor Guest

    Default Call Cobol/400 program from RPG/400

    On Sunday, November 30, 1997, 05:47 AM, Sajeev wrote: One of the problems we encountered in a situation such as yours was that a COBOL program called from an RPG pgm need not be running under the same activation group. The called COBOL program may not return to the calling RPG program. We resolved this by having a dummy COBOL pgm call the RPG program which in turn would call the correct COBOL program. However, the ILE version seems to have resolved this bug.
    This was not a bug. Cobol has the concept of 'run unit'. Ie. the first Cobolprogram in the call stack opens the run unit. Subsequently called Cobolprograms are within the same run unit, and terminate (if you use EXIT-PROGRAM or GOBACK) without deactivating the program resources (RPG equivalent is *INLR=OFF). However, when the 1st. pgm terminates, this ends the run unit, and system resources are freed. Therefore, in OPM days, calling RPG -> Cobol1 would not return, because the run unit ended with Cobol1, and the call stack was terminated. In ILE, these different (obscure) language 'features' were unified. A Cobol run unit still has meaning, but is scoped within an activation group. So, if your RPG program is in activation group A which calls a Cobol in activation group B, the run unit initiated would be confined to Ag B, thus on return to your RPG pgm not terminating what's in another Ag (A). Another important point to move on to ILE! Hope i was able to clarify ... Regards, Martin.

+ Reply to Thread

Similar Threads

  1. Call a Java program from a COBOL program?
    By Guest.Visitor in forum Programming
    Replies: 3
    Last Post: 10-23-2000, 12:25 PM
  2. java call to cobol prg
    By Guest.Visitor in forum Programming
    Replies: 5
    Last Post: 04-10-2000, 01:33 PM
  3. COBOL Call/Parm
    By Guest.Visitor in forum Programming
    Replies: 11
    Last Post: 02-19-1999, 07:11 AM
  4. Call a Java program from a COBOL program?
    By Guest.Visitor in forum Application Software
    Replies: 0
    Last Post: 01-01-1995, 02:00 AM
  5. Call a Java program from a Cobol Program?
    By Guest.Visitor in forum Programming
    Replies: 0
    Last Post: 01-01-1995, 02:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts