[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference vaxaxp::vmsnotes

Title:VAX and Alpha VMS
Notice:This is a new VMSnotes, please read note 2.1
Moderator:VAXAXP::BERNARDO
Created:Wed Jan 22 1997
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:703
Total number of notes:3722

108.0. "DIGITAL, Oracle and DECdtm" by RTOAL2::MAHER (TIER3 simply a better RPC!) Wed Jan 29 1997 10:46

Hi,

A recent note in the Rdb notes conference (4970) described a customer
requirement for distributing a transaction within 2 processes. I have
a working example of exactly what the customer is asking for but am
faced with two problems:-

1) Last I looked, not only were the branch managment services unsupported
   but th functional spec had "Proprietary and Confidential" written all
   over it (which I assume is a fair step up from internal use only). So
   it seems pretty obvious that it can't be made available to a customer
   without a PID. (How a customer is supposed to request a PID for
   something noone can tell them about is beyond me)

2) Rdb was sold to Oracle, and although there is a special relationship
   (part of which is we can look at their conferences and they can look
   at ours) there are seperate companies. So normally I would post this
   reply in the Rdb conference and let them decide if the customer gets
   to see it but don't want to break my confidentiality agreement.

   Needless to say there is nothing I could tell Rdb engineers about VMS
   that they probably don't know already but, in an exchange of notes, is
   it OK to talk about something that Rdb has been using since year dot
   but is considered P&C to DIGITAL. (Bizare situation! If only RMS
   journaling had stayed RMS journalling then DECdtm could have been
   given to Oracle and might have more of a future)

Anyway, I have posted an example in the next three replies.

.1 Is the master routine that runs in the context of the main process.

.2 Is the slave routine that runs in the context of a sub-process.

.3 Is the SQL common to both that updates the personnel DB.
   (Compile with /context=(set_trans_rw,update_dept)

Regards Richard Maher.

BTW, in answer to "Where are the customers?" just look through the Rdb
conferences over the years!
T.RTitleUserPersonal
Name
DateLines
108.1RTOAL2::MAHERTIER3 simply a better RPC!Wed Jan 29 1997 10:47183
identification division.
program-id.     master_rtn.
data division.
working-storage section.
01  ss$_normal              pic s9(9)   comp    value   external ss$_normal.
01  ss$_abort               pic s9(9)   comp    value   external ss$_abort.
01  sys_status              pic s9(9)   comp.
01  db_spec.  
    03                      pic x(20)           value   "alias pers filename".
    03  db_filename         pic x(30)           value   "[.test]mf_personnel".
01  dtm_iosb. 
    03  dtm_iosb_status     pic s9(4)   comp.
    03                      pic xx.
    03  reason_code         pic s9(9)   comp.
01  msg_buf                 pic x(256).
01  msg_len                 pic 9(4)    comp.
01  sql_ctx.
    03                      pic 9(9)    comp    value 1.
    03                      pic 9(9)    comp    value 1.
    03                      pic 9(9)    comp    value 16.
    03  tid                 pic x(16)           value low-values.
    03                      pic 9(9)    comp    value zero.
01  bid                     pic x(16).
*
01 rdb$message_vector                                   external.
    03 rdb$lu_num_arguments     pic s9(9) comp.
    03 rdb$lu_status            pic s9(9) comp.
    03 rdb$alu_arguments                                occurs 18 times.
        05 rdb$lu_arguments     pic s9(9) comp.
*
01  sqlcode                 pic s9(9)       comp.
01  mbx_chan                pic 9(4)        comp.
01  io$_readvblk            pic s9(9)       comp    value   external io$_readvblk.
01  io$_writevblk           pic s9(9)       comp    value   external io$_writevblk.
01  letter_sent.
    03  ls_tid              pic x(16).
    03  ls_bid              pic x(16).
    03  new_name            pic x(30).
    03                      pic x(450).
01  iosb.
    03  cond_val            pic 9(4)        comp.
    03  byte_count          pic 9(4)        comp.
    03  chan_info           pic 9(9)        comp.
01  spawn_flags             pic 9(9)        comp    value 1.
*
procedure division.
kick_off section.
00.
    call "sys$crembx" 
	using 	by value 	0
                by reference 	mbx_chan
                by value 	512, 512, 0, 0
                by descriptor 	"my_mbx"
                by value 	0
	giving  sys_status.
    if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

    call "lib$spawn" 
	using  by descriptor 	"$run s"
               by value 	0, 0
               by reference	spawn_flags
       giving  sys_status.
    if sys_status not = ss$_normal call "lib$stop" using by value sys_status.
*
    call "declare_connection_name" using sqlcode, db_spec.
    if rdb$lu_status not = ss$_normal 
         call "sys$putmsg" using rdb$message_vector
         call "lib$stop" using by value ss$_abort.

    perform dist_trans.

    stop run.
*
dist_trans section.
00.
    display "Enter new department name  : " no advancing erase screen.
    accept new_name protected reversed at end go to fini.

    call "sys$start_transw" 
	using   by value 	0, 0
                by reference 	dtm_iosb
                by value 	0, 0
                by reference 	tid
                by value 	0, 0
        giving  sys_status.
    if sys_status = ss$_normal move dtm_iosb_status to sys_status.
    if sys_status not = ss$_normal call "lib$stop" using by value sys_status.
*
    call "sys$add_branchw" 
	using    by value 	0, 0
                 by reference 	dtm_iosb
                 by value 	0, 0
                 by reference 	tid
                 by descriptor 	"your_node"
                 by reference 	bid
          giving sys_status.
    if sys_status = ss$_normal move dtm_iosb_status to sys_status.
    if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

    move tid to ls_tid.
    move bid to ls_bid.

    call "sys$qiow" 
	using   by value        0, mbx_chan, io$_writevblk
                by reference    iosb 
                by value        0, 0
                by reference    letter_sent
                by value        512, 0, 0, 0, 0
        giving  sys_status.
    if sys_status = ss$_normal move cond_val to sys_status.
    if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

    perform the_tran. 
*+
* Wait until the sub-process has finished its Rdb work.
*-
    call "sys$qiow" 
	using   by value        0, mbx_chan, io$_readvblk
                by reference    iosb 
                by value        0, 0
                by reference    letter_sent
                by value        512, 0, 0, 0, 0
        giving  sys_status.
    if sys_status = ss$_normal move cond_val to sys_status.
    if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

    if sqlcode = zeros
	perform commit_trans
    else 
	perform abort_trans.
*
fini.
*
the_tran section.
00.
    call "set_trans_rw" using sqlcode, sql_ctx.
    if rdb$lu_status not = ss$_normal 
         call "sys$putmsg" using rdb$message_vector
         call "lib$stop" using by value ss$_abort.

    call "update_dept" using sqlcode, new_name, sql_ctx.
    if rdb$lu_status not = ss$_normal 
         call "sys$putmsg" using rdb$message_vector.
*
fini.
*
commit_trans section.
00.
    call "sys$end_transw" 
	using     by value 	0, 0
                  by reference 	dtm_iosb
                  by value 	0, 0
                  by reference 	tid
          giving  sys_status.
    if sys_status not = ss$_normal call "lib$stop" using by value sys_status.
*
    if dtm_iosb_status = ss$_abort
         call "sys$getmsg" 
		using 	by value 	reason_code
                        by reference 	msg_len
                        by descriptor 	msg_buf
                        by value 	0,0
                 giving sys_status
         if sys_status not = ss$_normal
              call "lib$stop" using by value sys_status
         end-if
         display "Couldn't commit - " msg_buf (1:msg_len)
    else if dtm_iosb_status not = ss$_normal
              call "lib$stop" using by value dtm_iosb_status.
*
abort_trans section.
00.
    call "sys$abort_transw" 
	using   by value 	0, 0
                by reference 	dtm_iosb
                by value 	0, 0
                by reference 	tid
                by value 	0
        giving  sys_status.
    if sys_status = ss$_normal or ss$_abort move dtm_iosb_status to sys_status.
    if sys_status not = ss$_normal call "lib$stop" using by value sys_status.
*
end program master_rtn.
108.2RTOAL2::MAHERTIER3 simply a better RPC!Wed Jan 29 1997 10:48158
identification division.
program-id.     slave_rtn.
data division.
working-storage section.
01  ss$_normal              	pic s9(9)   comp    value   external ss$_normal.
01  ss$_abort               	pic s9(9)   comp    value   external ss$_abort.
01  sys_status              	pic s9(9)   comp.
01  db_spec.  
    03                      	pic x(20)           value   "alias pers filename".
    03  db_filename         	pic x(30)           value   "[.test]personnel".
01  dtm_iosb. 
    03  dtm_iosb_status     	pic s9(4)   comp.
    03                      	pic xx.
    03  reason_code         	pic s9(9)   comp.
01  msg_buf                 	pic x(256).
01  msg_len                 	pic 9(4)    comp.
01  sql_ctx.
    03                      	pic 9(9)    comp    value 1.
    03                      	pic 9(9)    comp    value 1.
    03                      	pic 9(9)    comp    value 16.
    03  tid                 	pic x(16)           value low-values.
    03                      	pic 9(9)    comp    value zero.
01  bid                     	pic x(16).
*
01 rdb$message_vector                                   external.
    03 rdb$lu_num_arguments     pic s9(9) comp.
    03 rdb$lu_status            pic s9(9) comp.
    03 rdb$alu_arguments                                occurs 18 times.
        05 rdb$lu_arguments     pic s9(9) comp.
*
01  sqlcode                 	pic s9(9)       comp.
01  mbx_chan  		        pic 9(4)        comp.
01  io$_readvblk                pic s9(9)       comp    value   external        io$_readvblk.
01  io$_writevblk               pic s9(9)       comp    value   external        io$_writevblk.
01  letter_sent.
    03  ls_tid          	pic x(16).
    03  ls_bid              	pic x(16).
    03  new_name            	pic x(30).
    03                      	pic x(450).
01  iosb.
    03  cond-val                pic 9(4)        comp.
    03  byte-count              pic 9(4)        comp.
    03  chan-info               pic 9(9)        comp.
*
procedure division.
kick_off section.
00.
    call "sys$assign" 
	using 	by descriptor 	"my_mbx"
                by reference 	mbx_chan
                by value 	0, 0, 0
	giving  sys_status.
    if sys_status not = ss$_normal call "lib$stop" using by value sys_status.
*
    call "declare_connection_name" using sqlcode, db_spec.
    if rdb$lu_status not = ss$_normal 
         call "sys$putmsg" using rdb$message_vector
         call "lib$stop" using by value ss$_abort.
*
    perform dist_trans.

    stop run.
*
dist_trans section.
00.
    call "sys$qiow" 
	using   by value	0, mbx-chan, io$_readvblk
                by reference    iosb 
                by value        0, 0
                by reference    letter-sent 
                by value        512, 0, 0, 0, 0
	giving  sys-status.
    if sys-status = ss$_normal move cond-val to sys-status.
    if sys-status not = ss$_normal call "lib$stop" using by value sys_status.

    move ls_tid to tid.
    move ls_bid to bid.

    call "sys$start_branchw" 
	using	by value	0, 0
		by reference	dtm_iosb
                by value 	0, 0
                by reference 	tid
                by descriptor 	"your_node"
		by reference 	bid
                by value 	0, 0, 0
	giving  sys_status.
    if sys_status = ss$_normal move dtm_iosb_status to sys_status.
    if sys_status not = ss$_normal call "lib$stop" using by value sys_status.
*
    perform the_update. 
*
    call "sys$qiow" 
	using   by value        0, mbx_chan, io$_writevblk
                by reference    iosb 
                by value        0, 0
                by reference    letter-sent
                by value        512, 0, 0, 0, 0
	giving  sys-status.
    if sys-status = ss$_normal move cond-val to sys-status.
    if sys-status not = ss$_normal call "lib$stop" using by value sys_status.
*
fini.
    if sqlcode = zeros
         perform commit_trans
    else perform abort_trans.
*
the_update section.
00.
    call "set_trans_rw" using sqlcode, sql_ctx.
    if rdb$lu_status not = ss$_normal 
         call "sys$putmsg" using rdb$message_vector
         call "lib$stop" using by value ss$_abort.

    call "update_dept" using sqlcode, new_name, sql_ctx.
    if rdb$lu_status not = ss$_normal 
         call "sys$putmsg" using rdb$message_vector.
*
fini.
*
commit_trans section.
00.
    call "sys$end_branchw" 
	using    by value 	0, 0
                 by reference 	dtm_iosb
                 by value 	0, 0
                 by reference	tid, bid
         giving  sys_status.
    if sys_status not = ss$_normal call "lib$stop" using by value sys_status.
*
    if dtm_iosb_status = ss$_abort
         call "sys$getmsg" 
		using 	by value 	reason_code
                        by reference 	msg_len
                        by descriptor 	msg_buf
                        by value 	0,0
                 giving sys_status
         if sys_status not = ss$_normal
              call "lib$stop" using by value sys_status
         end-if
         display "Couldn't commit - " msg_buf (1:msg_len)
    else if dtm_iosb_status not = ss$_normal
              call "lib$stop" using by value dtm_iosb_status.
*
abort_trans section.
00.
    call "sys$abort_transw" 
	using   by value 	0, 0
                by reference 	dtm_iosb
                by value 	0, 0
                by reference 	tid
                by value 	0
                by reference 	bid
	giving  sys_status.
    if sys_status = ss$_normal or ss$_abort move dtm_iosb_status to sys_status.
    if sys_status not = ss$_normal call "lib$stop" using by value sys_status.
*
end program slave_rtn.
108.3RTOAL2::MAHERTIER3 simply a better RPC!Wed Jan 29 1997 10:4931
module		dtm_sql
language	cobol
parameter	colons

    declare global pers alias filename [.test]mf_personnel

procedure declare_connection_name
	(
	 sqlcode,
	 :db_spec		char(50)
	);

	connect to :db_spec as 'abc';

procedure set_trans_rw
	(sqlcode);

	set transaction read write;

procedure update_dept
	(
	 sqlcode,
	 :new_name		char(30)
	);

	update 
		pers.departments
	   set
		department_name = :new_name
	 where
		department_code = 'SUSA';
108.4MOVIES::DECDTM-VMSXDELTA::HOFFMANSteve, OpenVMS EngineeringWed Jan 29 1997 13:1511
   OpenVMS simply picks up a saveset from the DECdtm folks and incorporates
   it into the distribution -- you'll likely want to check with the DECdtm
   folks on this question.  MOVIES::DECDTM-VMS.

   I'm not familiar with the "branch management services" -- the brief
   look at the examples posted in the early replies seem to contain only
   documented DECdtm services.

   The other package in this area is DECRTR, the reliable transaction router.

108.53 Services - Too much to ask?EDSD01::MAHERTIER3 simply a better RPC!Thu Jan 30 1997 03:3918
    Hi,
    
>   I'm not familiar with the "branch management services" -- the brief
>   look at the examples posted in the early replies seem to contain only
>   documented DECdtm services.
    
    The master_rtn reply makes use of sys$add_branchw and the slave_rtn
    uses sys$start_branchw and sys$end_branchw. I've never seen any of
    these routines in customer accessible documentation. Although it 
    would simply be a matter of taking the pages out of the functional
    spec and putting them in the SS reference manaual. If you have seen
    them documented please let me know where.
    
    > The other package in this area is DECRTR, the reliable transaction router.
    
    You've got to be winding me up!
    
    Regards Richard Maher.                  
108.6Ask DECdtm...XDELTA::HOFFMANSteve, OpenVMS EngineeringThu Jan 30 1997 09:3813
:                       -< 3 Services - Too much to ask? >-

   Ask the right folks.  As I said, OpenVMS engineering has nothing to
   do with the decision to (or not to) document and support the DECdtm
   services.   (I tried to get the documentation of the recovery/rollback
   routine support released a while back...)

:    > The other package in this area is DECRTR, the reliable transaction router.
:    
:    You've got to be winding me up!

   No, I'm not.  It's a 10 kilogram sledgehammer, but it is documented.

108.7MOVIES::POTTERhttp://www.vmse.edo.dec.com/~potter/Thu Feb 06 1997 09:0431
   Ask the right folks.  As I said, OpenVMS engineering has nothing to
   do with the decision to (or not to) document and support the DECdtm
   services.   (I tried to get the documentation of the recovery/rollback
   routine support released a while back...)

Well, close.

DECdtm _does_ come from OpenVMS engineering, but not from the ZKO office.
However, it is now owned by the sustaining engineering group (if that's the
correct term), and no future development of the product is planned.

As it happens, it's no longer checked in as a saveset, but rather it is checked
in module-by-module, just like any other facility on the masterpack.

I've hurt my head a few times on the brick wall of DECdtm documentation, and I
think that most DECdtm project leaders have done the same.  It has just never
seemed like "the right time".  Richard and I chatted about this some time
ago, and it prompted another batch of head-butting for me, but as the product 
was just about to be transferred to Bryan Jones' group even I could see it was
an inopportune moment to document the additional services.

Maybe someone like Rich Marcello would have the clout to get this work done, I
don't know.  

Since I spent about four years working on this product, since I see copies
of loads of glossies describing world-wide mission-critical appications that
run on VMS (stock markets and the like), I'm sure you can guess whether I
would like to see it being documented.

regards,
//alan