of_register


pfcapsrv.pbl   >   pfc_n_cst_trregistration   >   of_register   

Full name pfc_n_cst_trregistration.of_register
Access public
Extend of integer
Return value integer
Prototype public function integer of_register(n_tr)

Name Datatype
No Data

Name Datatype
li_cnt integer
li_slotavailable integer
li_upperbound integer

public function integer of_register (n_tr atr_object);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  		of_Register
//
//	Access:  		public
//
//	Arguments:
//	atr_object   	Transaction object to register.
//
//	Returns:  		integer
//						 1 = success
//						 0 = transaction object has already been registered.
//						-1 = error
//
//	Description:  	Registers a transaction object with the service.
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	5.0   Initial version
// 5.0.02 Prevent objects from being registered more than once.
//
//////////////////////////////////////////////////////////////////////////////
//
//	Copyright © 1996-1999 Sybase, Inc. and its subsidiaries.  All rights reserved.
//	Any distribution of the PowerBuilder Foundation Classes (PFC)
//	source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////

integer	li_slotavailable=0
integer	li_cnt=0
integer	li_upperbound=0

// Check arguments.
if IsNull(atr_object) Or not IsValid (atr_object) then
	return -1
end if

// Determine if there is an open slot available.
// Determine if the object has already been registered.
li_upperbound = UpperBound (inv_trans[])
For li_cnt = 1 to li_upperbound
	// Check to see if transaction object was already registered.
	if inv_trans[li_cnt].tr_object = atr_object then
		Return 0
	end if	

	// Determine if there is an open slot.
	if not inv_trans[li_cnt].b_used then
		If li_slotavailable = 0 Then
			//Get the first slot found
			li_slotavailable = li_cnt
		End If		
	end if
Next

//If an available slot was not found then create a new entry
If li_slotavailable = 0 Then
	li_slotavailable = li_upperbound + 1
End If

// Register the transaction object.
inv_trans[li_slotavailable].tr_object = atr_object
inv_trans[li_slotavailable].b_used = true

// Increase count of registered transaction objects.
ii_count++	

Return 1
end function

     
Name Owner
No Data

     
Name Owner
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.upperbound systemfunctions

     
Full name
No Data

     
Name Scope
No Data