I have a batch COBOL program which calls another batch COBOL subprogram. I
want this subprogram to write to a queue; it will also write a database
record. But I am having bind issues. According to my understanding, in
order for my subprogram to write to a queue, it must issue a BIND TASK and a
FINISH TASK. I have my subprogram's PROTOCOL statement as DC-BATCH DEBUG,
and COPY IDMS SUBSCHEMA-CONTROL in my working storage. My subprogram
immediately does a BIND TASK, and a COPY IDMS SUBSCHEMA-BINDS. Then I ready
my areas that my subprogram needs. When I leave my subprogram, I do a
FINISH and FINISH TASK. When I run it, I get an 0077 in my calling program
as soon as I return from my subprogram and attempt another DML command, so I
assume my FINISH TASK finished my calling program's run unit. I have
experimented somewhat, but no luck. I would prefer to not have to extend my
run unit to my subprogram if possible. Can anyone shed some light on what
needs to be done for this to work successfully? I have written IDMS batch
COBOL programs that use queues before, but they have always been stand-alone
and not subprograms.
Thanks in advance...
"
IDMS Public Discussion Forum
IDMS-L@LISTSERV.IUASSN.COM
SMTP
IDMS-L@LISTSERV.IUASSN.COM
IDMS-L@LISTSERV.IUASSN.COM
SMTP
Normal
Normal
Re: Writing to a queue from a COBOL subprogram
"
A run-unit is identified by the address of the subschema-control used on the bind run-unit command.
Is the calling program pass as a parameter to the subprogram the subschema control of the calling program used on the bind run-unit of the called subprogram? If this the case
i assume that the FINISH of the subprogram terminate the common run-unit. For not to extend the calling program run-unit, I recommandthat the calling program pass the data to the subprogram in a way that the subprogram execute his bind run-unit not using the subschema-control of the calling program.
Michel Lamoureux B.A., B.Sc.PrésidentLacosi Inc.212, ch. des Patriotes SudMont-Saint-Hilaire (Québec)J3H 3G6Tél.: (450) 281-2031Téléc.: (450) 281-2032Cell.: (514)
462-4282michel.lamoureux@videotron.cawww.lacosi.com> Date: Mon, 4 Feb 2008 16:12:06 -0600> From:
JHUTCHIN@IPSCO.COM> Subject: Writing to a queue from a COBOL subprogram> To:
IDMS-L@LISTSERV.IUASSN.COM> > I have a batch COBOL program which calls another batch COBOL subprogram. I want this subprogram to write to a queue; it will also write a database record. But I am having bind issues. According to my understanding, in order for my subprogram to write to a queue, it must issue a BIND TASK and a FINISH TASK. I have my subprogram's PROTOCOL statement as DC-BATCH DEBUG, and COPY IDMS SUBSCHEMA-CONTROL in my working storage. My subprogram immediately does a BIND TASK, and a COPY IDMS SUBSCHEMA-BINDS. Then I ready my areas that my subprogram needs. When I leave my subprogram, I do a FINISH and FINISH TASK. When I run it, I get an 0077 in my calling program as soon as I return from my subprogram and attempt another DML command, so I assume my FINISH TASK finished my calling program's run unit. I have experimented somewhat, but no luck. I would prefer to not have to extend my run unit to my subprogram if possible. Can anyone shed some light on what needs to be done for this to work successfully? I have written IDMS batch COBOL programs that use queues before, but they have always been stand-alone and not subprograms.> > Thanks in advance...
_________________________________________________________________
"
IDMS Public Discussion Forum
IDMS-L@LISTSERV.IUASSN.COM
SMTP
IDMS-L@LISTSERV.IUASSN.COM
IDMS-L@LISTSERV.IUASSN.COM
SMTP
Normal
Normal
Re: Writing to a queue from a COBOL subprogram
"Joan,
I have seen cases where the 0077 was the ""second error code"", while the
real error code had been masked by the program's internal error-handling
logic. In these cases, I sometimes found a more telling clue in the
DC-log of the CV that the program ran against. Have a look there.
Jim Ritterbusch
Joan Hutchinson wrote:
I have a batch COBOL program which calls another batch COBOL subprogram. I want this subprogram to write to a queue; it will also write a database record. But I am having bind issues. According to my understanding, in order for my subprogram to write to a queue, it must issue a BIND TASK and a FINISH TASK. I have my subprogram's PROTOCOL statement as DC-BATCH DEBUG, and COPY IDMS SUBSCHEMA-CONTROL in my working storage. My subprogram immediately does a BIND TASK, and a COPY IDMS SUBSCHEMA-BINDS. Then I ready my areas that my subprogram needs. When I leave my subprogram, I do a FINISH and FINISH TASK. When I run it, I get an 0077 in my calling program as soon as I return from my subprogram and attempt another DML command, so I assume my FINISH TASK finished my calling program's run unit. I have experimented somewhat, but no luck. I would prefer to not have to extend my run unit to my subprogram if possible. Can anyone shed some light on what needs to be done for this to work successfully? I have written IDMS batch COBOL programs that use queues before, but they have always been stand-alone and not subprograms.
Thanks in advance...
"
IDMS Public Discussion Forum
IDMS-L@LISTSERV.IUASSN.COM
SMTP
IDMS-L@LISTSERV.IUASSN.COM
IDMS-L@LISTSERV.IUASSN.COM
SMTP
Normal
Normal
Writing to a queue from a COBOL subprogram
"I have a batch COBOL program which calls another batch COBOL subprogram. I want this subprogram to write to a queue; it will also write a database record. But I am having bind issues. According to my understanding, in order for my subprogram to write to a queue, it must issue a BIND TASK and a FINISH TASK. I have my subprogram's PROTOCOL statement as DC-BATCH DEBUG, and COPY IDMS SUBSCHEMA-CONTROL in my working storage. My subprogram immediately does a BIND TASK, and a COPY IDMS SUBSCHEMA-BINDS. Then I ready my areas that my subprogram needs. When I leave my subprogram, I do a FINISH and FINISH TASK. When I run it, I get an 0077 in my calling program as soon as I return from my subprogram and attempt another DML command, so I assume my FINISH TASK finished my calling program's run unit. I have experimented somewhat, but no luck. I would prefer to not have to extend my run unit to my subprogram if possible. Can anyone shed some light on what needs to be done for this to work successfully? I have written IDMS batch COBOL programs that use queues before, but they have always been stand-alone and not subprograms.
Thanks in advance...
"
IDMS Public Discussion Forum
IDMS-L@LISTSERV.IUASSN.COM
SMTP
IDMS-L@LISTSERV.IUASSN.COM
IDMS-L@LISTSERV.IUASSN.COM
SMTP
Normal
Normal
Re: Writing to a queue from a COBOL subprogram
"I would remove the copy idms-subschema binds in the subprogram since you
are not doing any database calls in that program. The main program is
doing the database work and it should do the subschema binds and finish.
Do not pass subschema-control between the programs. It reads like you
have not, but I want to make sure.
Lutz Petzold
TDM UDB/IDMS Support
(401) 782 2265 or (860) 636 0291
Pager (860) 366 0865 or Telalert
This e-mail may contain confidential or privileged information. If
you think you have received this e-mail in error, please advise the
sender by reply e-mail and then delete this e-mail immediately.
Thank you. Aetna
"
IDMS Public Discussion Forum
IDMS-L@LISTSERV.IUASSN.COM
SMTP
IDMS-L@LISTSERV.IUASSN.COM
IDMS-L@LISTSERV.IUASSN.COM
SMTP
Normal
Normal
Re: Writing to a queue from a COBOL subprogram
"Thanks for all the comments and suggestions so far. Some clarification:
- my subprogram does write a database record as well, and so I still need binds in my subprogram
- I am currently not passing the subschema-control and extending the run unit to my subprogram
- this subprogram will be called from many different programs, so I am leery to do anything that will commit the data in the calling programs. So if the FINISH TASK finishes all run-units, including the one from the calling program, does it also commit what was done in the calling program thus far?
"
IDMS Public Discussion Forum
IDMS-L@LISTSERV.IUASSN.COM
SMTP
IDMS-L@LISTSERV.IUASSN.COM
IDMS-L@LISTSERV.IUASSN.COM
SMTP
Normal
Normal
Re: Writing to a queue from a COBOL subprogram
"I would question that all the run-units are finished. The bind
establishes a new run unit, but also a new task. The way IDMS sorts out
mulitple run-units is through the subschema-control which points to the
local request element which points to the ere. There should be three
ere's created by your scenario, causing three tasks to be attached on
the cv side. I am assuming that the calling program also has a protocol
of dc-batch? The subschema-control has a different layout between batch
and dc-batch. The dc-batch is longer, and different stuff is used in
it. Does your subprogram have a bind and a bind-task statement? I would
code it like that. To answer your question, I think the finish task
statement should only finish the batch-dc requests like write printer
and write queue. Then another finish for the database bind. But, as
you can probably guess, I am only guessing. Run a PMRM active task
display on the cv side while you're testing this program.
Lutz Petzold
TDM UDB/IDMS Support
(401) 782 2265 or (860) 636 0291
Pager (860) 366 0865 or Telalert
This e-mail may contain confidential or privileged information. If
you think you have received this e-mail in error, please advise the
sender by reply e-mail and then delete this e-mail immediately.
Thank you. Aetna
"
IDMS Public Discussion Forum
IDMS-L@LISTSERV.IUASSN.COM
SMTP
IDMS-L@LISTSERV.IUASSN.COM
IDMS-L@LISTSERV.IUASSN.COM
SMTP
Normal
Normal
Re: Writing to a queue from a COBOL subprogram
"Hi Joan
When you issue a finish task it commits all run-units that are active
under the task, that means the calling program as well as the subprogram
that is why you are getting the 0077.
For this to work successfully I think you need to have the subprogram as
it's own task so when you issue the finish task or commit task that you
only commit what the subprogram did and you can continue processing in
the calling program from where you left off.
If you run a journal report against these transaction id's you can
determine when the transactions were committed or the transaction was
finished.
Dennis Robock
Alberta Department of Energy