Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Translating IBM's HEX format in KSH

28 views
Skip to first unread message

David Larochette

unread,
Apr 10, 2018, 2:37:46 PM4/10/18
to
Le 10-04-2018, bwmil...@gmail.com <bwmil...@gmail.com> a écrit :
> Everyone -
>
> hello... running AIX 7 with DB2 ESE at 10.5 FP8.
>
> I'm experiencing a locking issue and through the use of mon_get_locks and mon_connection_summary I've been able to derive which set of applications are holding locks possibly forcing some lock timeouts on our EDI process.
>
> HANDLE APPLICATIONHOLDINGLOCK LOCK_COUNT LOCK_ATTRIBUTES
> 18548 RFSES500.exe Lock TABLE F4201 PRODDTAT4K 1 0000000000002000
> 54906 RFSES500.exe Lock TABLE F4201 PRODDTAT4K 1 0000000000002000
> 57577 RFSES500.exe Lock TABLE F4201 PRODDTAT4K 1 0000000000002000
> 57784 RFSES500.exe Lock TABLE F4201 PRODDTAT4K 1 0000000000003000
> 15225 RFSES500.exe Lock TABLE F4211 PRODDTAT32K 1 0000000000002000
>
> I need to translate the LOCK_ATTRIBUTES from mon_get_locks like '0000000000003000' into english...
>
> This describes the LOCK_ATTRIBUTES field...
>
> #define SQLM_LOCKATTR_WAIT_FOR_AVAIL 0x00000001 /* wait for availability */
> #define SQLM_LOCKATTR_ESCALATED 0x00000002 /* acquired by escalation */
> #define SQLM_LOCKATTR_RR_IN_BLOCK 0x00000004 /* RR lock "in" block */
> #define SQLM_LOCKATTR_INSERT 0x00000008 /* insert lock */
> #define SQLM_LOCKATTR_RR 0x00000010 /* lock by RR scan */
> #define SQLM_LOCKATTR_UPDATE_DELETE 0x00000020 /* update/delete row lock */
> #define SQLM_LOCKATTR_ALLOW_NEW 0x00000040 /* allow new lock requests */
> #define SQLM_LOCKATTR_NEW_REQUEST 0x00000080 /* a new lock requestor */
> #define SQLM_LOCKATTR_DELETE_IN_BLOCK 0x00000000 /* deleted row "in" block */
> #define SQLM_LOCKATTR_INDOUBT 0x00000200 /* held by indoubt trans */
> #define SQLM_LOCKATTR_LOW_PRIORITY 0x00000400 /* held by low priority app */
>
> As a prior IBM DB2 mainframer I know that IBM adds the hex +001 +002 = +003 in order to combine the attributes... is there a way in SHELL script to decompose this? Any Insight as to how to identify exactly the meaning of these LOCK_ATTRIBUTES would be helpful...thanks in advance.

the way to decompose the field is to apply a binary AND operator between
LOCK_ATTRIBUTES and each SQLM_LOCKATTR_... flag.

if (($lockattr & $SQLM_LOCKATTR_WAIT_FOR_AVAIL))
then
echo "wait for availability"
elif (($lockattr & $SQLM_LOCKATTR_ESCALATED))
then
echo "acquired by escalation"
fi

Alas this will be to no avail as the lock attributes values do not
correspond with any given flag.
0 new messages