Routines for c_dbsvcs.kb


AddContractHistoryEntry

File Name

c_dbsvcs.kb

Syntax

AddContractHistoryEntry ( VAL InTran: BOOLEAN, VAL contract_id: INTEGER, VAL history_string: STRING, VAL history_notes: STRING ): INTEGER

Parameters

InTran - in a transaction or not

contract_id - contract ID

history_string - contract history string

history_notes - contract history notes

Returns

SQL return result

Side Effects

None

Description

This function adds a record to the CONTRACT_HIST table.

Dialog Forms Called

None


AddInventoryHistoryEntry

File Name

c_dbsvcs.kb

Syntax

AddInventoryHistoryEntry ( VAL InTran: BOOLEAN, VAL contract_id: INTEGER, VAL history_notes: STRING, VAL is_inventory_id: INTEGER, VAL event_name: STRING ): INTEGER

Parameters

InTran - in a transaction or not

contract_id - contract ID

history_notes - contract history notes

is_inventory_id - inventory ID

event_name - event name

Returns

SQL return result

Side Effects

None

Description

This function adds a record to the INVENTORY_HISTORY table.

Dialog Forms Called

None


CreateSelectString

File Name

c_dbsvcs.kb

Syntax

CreateSelectString ( REF baseSelect: String, REF whereString: String, REF userWhere: String, REF orderBy: String ): String

Parameters

baseSelect - the basic select statement (select * from table)

whereString - a WHERE clause to the select statement (where a = b )

userWhere - a user-specified WHERE clause appended to the select statement

order by - a clause used to order the select statement

Returns

The completed select string

Side Effects

None

Description

This generic function takes the parameters provided and creates a select statement.

Dialog Forms Called

None


DeleteContractFromAsset

File Name

c_dbsvcs.kb

Syntax

DeleteContractFromAsset ( VAL contract_id: INTEGER, VAL is_inventory_id: INTEGER )

Parameters

contract_id - contract ID

is_inventory_id - inventory ID

Returns

SQL return result

Side Effects

None

Description

This function deletes the association between a selected contract and asset.

Dialog Forms Called

None


DeleteHistRec

File Name

c_dbsvcs.kb

Syntax

DeleteHistRec ( VAL InTran: BOOLEAN, VAL DeleteRec: Inventory_HistoryRec )

Parameters

InTran - in a transaction or not

DeleteRec - inventory history record to be deleted

Returns

SQL return result

Side Effects

None

Description

This function deletes a inventory history record.

Dialog Forms Called

None


DeleteHistRecForContract

File Name

c_dbsvcs.kb

Syntax

DeleteHistRecForContract ( VAL contract_id: INTEGER )

Parameters

contract_id - contract id

Returns

SQL return result

Side Effects

None

Description

This function deletes an inventory history record from the INVENTORY_HISTORY table based on the contract id.

Dialog Forms Called

None


DeleteInvContract

File Name

c_dbsvcs.kb

Syntax

DeleteInvContract ( VAL InTran: BOOLEAN, REF DeleteRec: InvContractRec ): INTEGER

Parameters

InTran - in a transaction or not

DeleteRec - inventory contract record to be deleted

Returns

SQL return result

Side Effects

None

Description

This function deletes an inventory contract record from the INV_CONTRACT table.

Dialog Forms Called

None


DeleteMaintFeeRec

File Name

c_dbsvcs.kb

Syntax

DeleteMaintFeeRec ( VAL InTran: BOOLEAN, REF DeleteRec: Maintenance_FeeRec ): INTEGER

Parameters

InTran - in a transaction or not

DeleteRec - maintenance fee record to be deleted

Returns

SQL return result

Side Effects

None

Description

This function deletes a maintenance fee record.

Dialog Forms Called

None


FinishSqlWork

File Name

c_dbsvcs.kb

Syntax

FinishSqlWork ( VAL i: INTEGER)

Parameters

i - integer return code

Returns

None

Side Effects

None

Description

This function is usually called at the end of a db function and, if provided with a success code, it commits the SQL block. Otherwise, it rolls back all the preceding SQL up to the last BeginWork.

Dialog Forms Called

None


GetCachePos

File Name

c_dbsvcs.kb

Syntax

GetCachePos(VAL TBName: STRING): INTEGER

Parameters

TBName - name of the table for which to obtain the columns

Returns

String

Side Effects

None

Description

Insures that the columns for TBName are loaded, and returns the index number identifiying the location of the table in the cache.

Dialog Forms Called

None


GetColumnAliases

File Name

c_dbsvcs.kb

Syntax

GetColumnAliases ( VAL TBName, ColName: STRING )

Parameters

TBName - table name for which to get aliases

ColName - column for which to get alias

Returns

$Result - the defined alias, or ColName if no alias exists

Side Effects

None

Description

This function returns the column aliases for any database column.

Dialog Forms Called

None


GetColumnsAndTypesForTable

File Name

c_dbsvcs.kb

Syntax

GetColumnsAndTypesForTable ( VAL TBName: STRING, REF availColumns: LIST OF STRING, REF availTypes: LIST OF STRING)

Parameters

TBName - name of the table for which to obtain the columns

availColumns - columns retrieved as available for the TBName

availTypes - types of all the columns

Returns

A list of column names and their data types for the table

Side Effects

None

Description

Function obtains the list of columns and types from SAI_Syscolumns for the desired table.

Dialog Forms Called

None


GetColumnsForTable

File Name

c_dbsvcs.kb

Syntax

GetColumnsForTable ( VAL TBName: STRING ): LIST OF STRING

Parameters

TBName - name of the table for which to obtain the columns

Returns

A list of column names for the table

Side Effects

None

Description

Function obtains the list of columns from SAI_Syscolumns for the desired table.

Dialog Forms Called

None


GetEventList

File Name

c_dbsvcs.kb

Syntax

GetEventList ( REF ktypeList: LIST OF EventRec, REF EventNameList: LIST OF STRING, VAL event_owner: STRING ): INTEGER

Parameters

ktypeList - list of event records

EventNameList - event name list

event_owner - event owner

Returns

SQL return result

Side Effects

None

Description

This function returns a list of all event records in the EVENTS table.

Dialog Forms Called

None


GetInvContractID

File Name

c_dbsvcs.kb

Syntax

GetInvContractID ( VAL contract_id: INTEGER, VAL is_inventory_id: INTEGER ): INTEGER

Parameters

contract_id - contract ID

is_inventory_id - inventory ID

Returns

SQL return result

Side Effects

None

Description

This function returns an inventory contract ID from the INV_CONTRACT table.

Dialog Forms Called

None


GetSAISysColSelect

File Name

c_dbsvcs.kb

Syntax

GetSAISysColSelect( VAL TBName: STRING): STRING

Parameters

TBName - name of the table for which to obtain the columns

Returns

String

Side Effects

None

Description

Returns a select string that ignores the case of the table and qualifier.

Dialog Forms Called

None


GetSiteInfo

File Name

c_dbsvcs.kb

Syntax

GetSiteInfo

Parameters

None

Returns

SiteRecord

Side Effects

None

Description

Gets the local site.

Dialog Forms Called

None


GetTMEIPNameByInventoryID

File Name

c_dbsvcs.kb

Syntax

GetTMEIPNameByInventoryID ( VAL is_inventory_id: INTEGER, REF network_node_name: STRING )

Parameters

is_inventory_id - is_inventory_id

network_node_name - node name from the TME NETWORK_NODE table

Returns

Database return code

-111 - is_inventory_id is unknown

-222 - tivoli data source is not known and cannot try to connect

Side Effects

None

Description

This function returns the TME network_node_name by passing in the is_inventory_id. It will hit the TSD EXTERNAL_MAP table, connect to the Tivoli datasource, hit the TME NETWORK_NODE table, disconnect from the Tivoli datasource and reconnect to the current datasource.

Dialog Forms Called

None


GetTMEMachInfoByAssetTag

File Name

c_dbsvcs.kb

Syntax

GetTMEMachInfoByAssetTag ( VAL asset_tag: STRING )

Parameters

asset_tag - asset tag

Returns

$Result - LIST OF TMEMachineTypeNameRec (unknown if no records)

Side Effects

None

Description

This function returns a list of Tivoli machine types and machine names for a TME machine based on the asset_tag for a given asset.

Dialog Forms Called

None


GetTMEMachInfoByInventoryID

File Name

c_dbsvcs.kb

Syntax

GetTMEMachInfoByInventoryID ( VAL is_inventory_id: INTEGER )

Parameters

is_inventory_id - inventory ID

Returns

$Result - LIST OF TMEMachineTypeNameRec (unknown if no records)

Side Effects

None

Description

This function returns a list of Tivoli machine types and machine names for a TME machine based on the is_inventory_id for a given asset.

Dialog Forms Called

None


GetTMEMachInfoByPeopleID

File Name

c_dbsvcs.kb

Syntax

GetTMEMachInfoByPeopleID ( VAL people_id: INTEGER )

Parameters

is_inventory_id - inventory ID

Returns

$Result - LIST OF TMEMachineTypeNameRec (unknown if no records)

Side Effects

None

Description

This function returns a list of Tivoli machine types and machine names for a TME machine based on the people_id for a given asset.

Dialog Forms Called

None


InitializeDBMSVendor

File Name

c_dbsvcs.kb

Syntax

InitializeDBMSVendor

Parameters

None

Returns

None

Side Effects

None

Description

This procedure sets the two global database identifier variables. The g_DBMS variable contains the value returned by TDT. The g_DBMS_VENDOR variable is then set based upon that value. The g_DBMS variable can contain several different values per database platform, depending upon version number. The g_DBMS_VENDOR variable always contains one of the five database vendor constants of the form DBMS_V_ORACLE.

Dialog Forms Called

None


InsertHistRec

File Name

c_dbsvcs.kb

Syntax

InsertHistRec ( VAL InTran: BOOLEAN, REF InsertRec: Inventory_HistoryRec )

Parameters

InTran - in a transaction or not

InsertRec - inventory history record to be inserted

Returns

SQL return result

Side Effects

None

Description

This function inserts a record into the INVENTORY_HISTORY table.

Dialog Forms Called

None


InsertInvContract

File Name

c_dbsvcs.kb

Syntax

InsertInvContract ( VAL InTran: BOOLEAN, REF InsertRec: InvContractRec ): INTEGER

Parameters

InTran - in a transaction or not

InsertRec - inventory contract record to be inserted

Returns

SQL return result

Side Effects

None

Description

This function inserts a new record in the INV_CONTRACT table.

Dialog Forms Called

None


InsertMaintFeeRec

File Name

c_dbsvcs.kb

Syntax

InsertMaintFeeRec ( VAL InTran: BOOLEAN, REF InsertRec: Maintenance_FeeRec): INTEGER

Parameters

InTran - flag that indicates if in a transaction or not

InsertRec - maintenance fee record to be inserted

Returns

SQL return result

Side Effects

None

Description

This function inserts a record into the MAINTENANCE_FEE table.

Dialog Forms Called

None


IsDeadlock

File Name

c_dbsvcs.kb

Syntax

IsDeadlock ( VAL rc: INTEGER ): BOOLEAN

Parameters

rc - integer return code

Returns

TRUE if rc indicates deadlock, FALSE otherwise

Side Effects

None

Description

Function determines if the current error code is a deadlock.

Dialog Forms Called

None


IsSQLCFGEntry

File Name

c_dbsvcs.kb

Syntax

IsSQLCFGEntry ( VAL dataSource: STRING): BOOLEAN

Parameters

dataSource - name of the data source for which to search

Returns

TRUE if datasource exits.

Side Effects

None

Description

Checks to see if a data source name exists in the SQL configuration file.

Dialog Forms Called

None


LoadNotificationContext

File Name

c_dbsvcs.kb

Syntax

LoadNotificationContext ( VAL newSend: NotifySendRec )

Parameters

newSend - input notify record

Returns

None

Side Effects

None

Description

This function sets up the global notification record with initial values.

Dialog Forms Called

None


LoadTypeAndAddress

File Name

c_dbsvcs.kb

Syntax

LoadTypeAndAddress ( REF notification_type: STRING, REF address: STRING, VAL user_id: STRING, VAL people_id: INTEGER ): BOOLEAN

Parameters

notification_type - type of notification being sent

address - location of notification

user_id - user ID of receiving user

people_id - people ID of receiving person

Returns

BOOLEAN

Side Effects

None

Description

None

Dialog Forms Called

None


MapDBTranRtn

File Name

c_dbsvcs.kb

Syntax

MapDBTranRtn ( VAL i: INTEGER): INTEGER

Parameters

i - integer return code

Returns

An integer that indicates success or failure to the calling function

Side Effects

None

Description

This function is usually called at the end of a db function and returns a generic success or failure code to the calling function.

Dialog Forms Called

None


MapEvent2Status

File Name

c_dbsvcs.kb

Syntax

MapEvent2Status ( VAL event_id: INTEGER )

Parameters

event_id - event ID

Returns

event status

Side Effects

None

Description

This function maps an event to a specific status.

Dialog Forms Called

None


NotifyUser

File Name

c_dbsvcs.kb

Syntax

NotifyUser ( REF ntfySend: NotifySendRec ): INTEGER

Parameters

ntfySend - a notify send record

Returns

Integer value indicating success or failure.

Side Effects

None

Description

Sends a notification to a user.

Dialog Forms Called

None


SendAlarm

File Name

c_dbsvcs.kb

Syntax

SendAlarm ( REF ntfySend: NotifySendRec ): BOOLEAN

Parameters

NotifySendRec - notification record containing the information required in order to send the requested alarm

Returns

Integer - success or failure

Side Effects

None

Description

Creates a new alarm based on information stored in NotifySendRec.

Dialog Forms Called

None


SendNotification

File Name

c_dbsvcs.kb

Syntax

SendNotification ( REF ntfySend: NotifySendRec )

Parameters

ntfySend - a notification send record

Returns

INTEGER

Side Effects

None

Description

None

Dialog Forms Called

None


SendUserNotification

File Name

c_dbsvcs.kb

Syntax

SendUserNotification ( REF notify: NotifySendRec ): INTEGER

Parameters

NotifySendRec - the notification record that holds all the information pertinent to the notification that is being sent

Returns

None

Side Effects

None

Description

This function is used to send a notification to a specific user.

Dialog Forms Called

None


SetInvStatusFromEvent

File Name

c_dbsvcs.kb

Syntax

SetInvStatusFromEvent ( VAL event_id: INTEGER, VAL planned: BOOLEAN, VAL is_inventory_id: INTEGER )

Parameters

event_id - event ID

planned - TRUE if planned, FALSE if completed

is_inventory_id - inventory ID

Returns

SQL return result

Side Effects

None

Description

This function sets the inventory status based on the event.

Dialog Forms Called

None


SQLFormatOperator

File Name

c_dbsvcs.kb

Syntax

SQLFormatOperator ( VAL operator: STRING, VAL dataValue: STRING, VAL dataType: INTEGER ): STRING

Parameters

operator - an operator for an SQL statement

dataValue - the data used at the right of the operator

dataType - indicates what type the dataValue is

Returns

A string that is correctly formatted and can be used in a

WHERE clause

Side Effects

None

Description

This function takes the parameters and creates a syntactically correct statement to be used by a SQL WHERE clause.

Dialog Forms Called

None


StoreNotification

File Name

c_dbsvcs.kb

Syntax

StoreNotification ( REF ntfySend: NotifySendRec )

Parameters

ntfySend - a notification send record

Returns

None

Side Effects

None

Description

None

Dialog Forms Called

None


UpdateHistRec

File Name

c_dbsvcs.kb

Syntax

UpdateHistRec ( VAL InTran: BOOLEAN, VAL BeforeRec: Inventory_HistoryRec, VAL AfterRec: Inventory_HistoryRec )

Parameters

InTran - in a transaction or not

BeforeRec - original inventory history record

AfterRec - new inventory history record

Returns

SQL return result

Side Effects

None

Description

This function updates an inventory history record.

Dialog Forms Called

None


UpdateInvContract

File Name

c_dbsvcs.kb

Syntax

UpdateInvContract ( VAL InTran: BOOLEAN, REF BeforeRec: InvContractRec, REF AfterRec: InvContractRec ): INTEGER

Parameters

InTran - in a transaction or not

BeforeRec - original inventory contract record

AfterRec - new inventory contract record

Returns

SQL return result

Side Effects

None

Description

This function updates an inventory contract record.

Dialog Forms Called

None


UpdateListOfHistRec

File Name

c_dbsvcs.kb

Syntax

UpdateListOfHistRec ( VAL InTran: BOOLEAN, REF BeforeList: Inventory_HistoryRec, REF AfterList: Inventory_HistoryRec )

Parameters

InTran - in a transaction or not

BeforeList - original list of inventory history records

AfterList - new list of inventory history records

Returns

SQL return result

Side Effects

None

Description

This function updates a list of inventory history records.

Dialog Forms Called

None


UpdateListOfInvContracts

File Name

c_dbsvcs.kb

Syntax

UpdateListOfInvContracts ( VAL InTran: BOOLEAN, REF BeforeList: LIST OF InvContractRec, REF AfterList: LIST OF InvContractRec ): INTEGER

Parameters

InTran - in a transaction or not

BeforeList - original list of inventory contract records

AfterList - new list of inventory contract records

Returns

SQL return result

Side Effects

None

Description

This function updates a list of inventory contract records.

Dialog Forms Called

None


UpdateListOfMaintFeeRec

File Name

c_dbsvcs.kb

Syntax

UpdateListOfMaintFeeRec ( VAL InTran: BOOLEAN, REF BeforeRec: LIST OF Maintenance_FeeRec, REF AfterRec: LIST OF Maintenance_FeeRec ): INTEGER

Parameters

InTran - in a transaction or not

BeforeRec - original list of maintenance fee records

AfterRec - new list of maintenance fee records

Returns

SQL return result

Side Effects

None

Description

This function updates a list of maintenance fee records.

Dialog Forms Called

None


UpdateMaintFeeRec

File Name

c_dbsvcs.kb

Syntax

UpdateMaintFeeRec ( VAL InTran: BOOLEAN, REF BeforeRec: Maintenance_FeeRec, REF AfterRec: Maintenance_FeeRec ): INTEGER

Parameters

InTran - in a transaction or not

BeforeRec - original maintenance fee record

AfterRec - new maintenance fee record

Returns

SQL return result

Side Effects

None

Description

This function updates a maintenance fee record.

Dialog Forms Called

None