What are the DBIDs my current Natural session is connected to?

Hello all!

Is there any Natural-method or USR-Subprogram telling me the DBIDs of my open ADABAS-DB-Connections?

I already experimented with USR2023N and USR1068N. No success so far.

Of course Natual has to know the open DB-Connections. One END TRANSACTION calls every Database you are connected to.

Any ideas?

Thanks

Matthias

We use USR1040N to get the current UDB like this (including caching the result in an AIV):


DEFINE DATA

PARAMETER

01 #P-UDB             (N8)

LOCAL

01 USR1040L
  02 #INPUTS
    03 #FUNCTION    (A1)
  02 #INPUT-OUTPUTS
    03 #UDB-PARM    (N5)
  02 #OUTPUTS
    03 #RESPONSE    (I4)

INDEPENDENT
1 +CACHE-UDB (N8) INIT<-1>

END-DEFINE

IF +CACHE-UDB NE -1
  #P-UDB := +CACHE-UDB
  ESCAPE MODULE
END-IF

ASSIGN #FUNCTION = 'G'
CALLNAT 'USR1040N' USR1040L
#P-UDB := #UDB-PARM
+CACHE-UDB := #P-UDB

ON ERROR
  #P-UDB := 99999999
  WRITE 'Error while reading UDB'
  ESCAPE MODULE
END-ERROR

END

Hi Stefan,

thanks for answering. USR1040N gives me the content of the session Parameter UDB. But this is not what I’m looking for.

Imagine the following: Let’s say my UDB is set to 001.

DEFINE DATA LOCAL
01 VIEW01 VIEW MYFILE1-DB12 /* DBID=012 is hardcoded in DDM
  02 FIELD01
01 VIEW02 VIEW MYFILE2 /* DBID=014 manipulated by session Parameter TF
  02 FIELD02
01 VIEW03 VIEW MYFILE3 /* DBID=0 in DDM, File is not in TF-Table, that means Parameter UDB would be taken
END-DEFINE
*
/* udb is 001 at the moment
*
GET VIEW01 1
/* Now I'm connected to DBID=012 
*
GET VIEW02 2
/* Now I'm connected to DBID=014
*
*
/* I'm not connected to DBID=001 (which is my UDB) because I did no I/O on VIEW03
END

My question remains: Is there any Natural-method or USR-Subprogram telling me the DBIDs of my open ADABAS-DB-Connections?

The correct answer to my sample would be 12 and 14, and not 001 (which is my udb).

Thanks

matthias

Natural will ignore an END TRANSACTION statement if no records are on hold, so he must track ET status. But I’m not sure he tracks every database you’ve accessed, that is, read without updates.

In any case, I’ll vote for your Brainstorm request for a new User Exit that reports open DBs and includes ET status.

Thanks for answering.
See my new feature request #06287

“Liked” and “commented.”