Page 1 of 1
RUN-UNIT in a IDMS COBOL program
Posted: Wed Aug 08, 2007 3:27 pm
by kabya79
Hi,
I am having a IDMS cobol program where the control is being transfered to a second COBOl program and then it returns back to the first COBOL program.
How may RUN-UNIT would be present when the second COBOL program is execution ?. Are there going to be 2 RUN-UNITs? Or will there be only one RUN-UNIT? If someone can clarify my doubt on the RUN-UNIT concept it would be a great help.
Thanks in advance.
Re: RUN-UNIT in a IDMS COBOL program
Posted: Tue Mar 04, 2008 3:42 pm
by stalwart_itsme
Hi,
A "Run Unit" refers to an IDMS program that was or is running between the time of the "BIND
RUN-UNIT" statement until the final FINISH or ROLLBACK.
Here in your case it could be minimum two run unit in the following case. First IDMS-cobol program is one run-unit, which processess the database, issues finish and goes to the sub program. In the subprogram it again issues Bind run-unit, processess the database, finishes it and comes back again to main program. So it is two run-unit. It could even be three run-unit if it is again issues bind run-unit after returning from the subprogram...

If the sub-program is not accessing the IDMS database, then it could be one run-unit, which is issued in the main IDMS Cobol program.
Re: RUN-UNIT in a IDMS COBOL program
Posted: Tue Mar 04, 2008 3:56 pm
by stalwart_itsme
More over a program can have any number of run-units.
In Your program, number of run-units depends upon, Number of times u give Bind Run-unit and Finish command.

Re: RUN-UNIT in a IDMS COBOL program
Posted: Tue Jun 30, 2009 10:02 pm
by Dennis1SOIL
If your desire is to have both the calling (driver) program and the subordinate (called) program using the same single run-unit ... I will tell you how below.
First though, remember a recovery unit consists of all the updates between Checkpoints (where a the BIND RUN-UNIT DML verb is the first Checkpoint and either a COMMIT or a FINISH is the next Checkpoint). If your program(s) happen to abort at any time - all the updates done in that one Run-unit/Recovery-Unit (i.e. since the run-unit was started or since the most recent COMMIT was issued) will be rolled out. So, given this information - you may NEED to have only a single run-unit being used for updates done by both the driver and the sub-program.
OK, here is the way to share the run-unit :
The key things to remember are:
1) The SUBSCHEMA-CTRL block must be passed from the Driver program to the Sub-program (so the sub-program will issue the 'COPY IDMS SUBSCHEMA-CONTROL' statement in it's LINKAGE AREA and the Driver program passes SUBSCHEMA-CTRL via a USING when it calls the sub-program).
2) The Driver program is the only program to issue the "BIND RUN-UNIT" DML verb.
(Note also: If both programs will access the same record-type, the Bind address for any shared records must also be passed between programs).
Re: RUN-UNIT in a IDMS COBOL program
Posted: Sun Jul 25, 2010 10:50 am
by selvakumarmvs
Hi Dennis,
You said that If both programs will access the same record-type, the Bind address for any shared records must also be passed between programs...
what is the Bind address for shared record??? can u give some example plz...
Instead of passing bind address, can we pass DB key of shared record and obtain that shared record data in sub-program without binding that shared record in sub-program...is it possible????