dbTalk Databases Forums  

execute ".L" workaround for D3

comp.databases.pick comp.databases.pick


Discuss execute ".L" workaround for D3 in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Frank Winans
 
Posts: n/a

Default execute ".L" workaround for D3 - 09-08-2006 , 06:24 PM






In D3,
.L
at the tcl prompt shows your recently issued commands.

You might want to capture this in a program, as
EXECUTE ".L" CAPTURING REPLY

but that gives an error message about tcl stack depth exceeded.
Or, just leaves you at the debug prompt with no error message.

{do END at the **************** prompt to get out of that situation, btw}


The workaround is to EXECUTE ".LL" CAPTURING REPLY
in your program, and copy your MD .L
item to MD .LL

It is mainly attractive to run .L instead of reading your tcl-stack file item
because .L has really elegant code to figure out which of the last two words of
WHO / user exit U50BB
is your userid -- they swap when r83.setup is in effect.
Your userid is the item id to look at in tcl-stack.




Reply With Quote
  #2  
Old   
GVP
 
Posts: n/a

Default Re: execute ".L" workaround for D3 - 09-08-2006 , 09:25 PM






OPEN "TS" TO ts THEN
READ UserTS from TS,@user then crt UserTS
END


Reply With Quote
  #3  
Old   
Tony Gravagno
 
Posts: n/a

Default Re: execute ".L" workaround for D3 - 09-09-2006 , 12:35 AM



"Frank Winans" wrote:
Quote:
... .L has really elegant code to figure out which
of the last two words of WHO / user exit U50BB
is your userid -- they swap when r83.setup is in effect.
Your userid is the item id to look at in tcl-stack.
It's not "elegant code". There are many ways to identify your user,
account, port, etc. Run the following code. Someone should be logged
into port2 for the last couple lines to show any data:

user1 = @user
user2 = @who
user3 = oconv('u','u50bb')
account1 = @account
account2 = @logname
account3 = oconv('a','u50bb')
port1 = @pib
port2 = oconv('p','u50bb')
crt "user ":user1, user2, user3
crt "acct ":account1, account2, account3
crt "port "ort1, port2

original.who = system(29)
execute "who (c" capturing out
execute "who" capturing who1
crt "'who' in r83 mode (":system(29):") = ":who1
execute "who (a" capturing out
execute "who" capturing who2
crt "'who' in D3 mode (":system(29):") = ":who2
* see if we need to reset who verb to R83 mode
if original.who = 1 then execute "who (c" capturing out

crt "user,acct on port 2 is ":
crt oconv('u%2','u50bb'):","conv('a%2','u50bb')




Reply With Quote
  #4  
Old   
dzigray
 
Posts: n/a

Default Re: execute ".L" workaround for D3 - 09-14-2006 , 12:50 PM



for completeness, don't forget about the "charge-to" side-effect...
which suffixes both an asterisk and text to each user id. eg.
"charge-to client1" will cause a user logged into "user" to be seen as
"user*client1" vs "user" in each of your code examples.

ie. if you truly want the "pure" user name, you must always perform the
equivalent of \field(oconv('u%2','u50bb'),"*",1)\

although seldom used these days "charge-to" feature (which also ties
into the logon accounting option ('a'-option) on tracking user
statistics)... will cause unwanted side-effects to many-a-application
logic not allowing for it.



Tony Gravagno wrote:
Quote:
"Frank Winans" wrote:
... .L has really elegant code to figure out which
of the last two words of WHO / user exit U50BB
is your userid -- they swap when r83.setup is in effect.
Your userid is the item id to look at in tcl-stack.

It's not "elegant code". There are many ways to identify your user,
account, port, etc. Run the following code. Someone should be logged
into port2 for the last couple lines to show any data:

user1 = @user
user2 = @who
user3 = oconv('u','u50bb')
account1 = @account
account2 = @logname
account3 = oconv('a','u50bb')
port1 = @pib
port2 = oconv('p','u50bb')
crt "user ":user1, user2, user3
crt "acct ":account1, account2, account3
crt "port "ort1, port2

original.who = system(29)
execute "who (c" capturing out
execute "who" capturing who1
crt "'who' in r83 mode (":system(29):") = ":who1
execute "who (a" capturing out
execute "who" capturing who2
crt "'who' in D3 mode (":system(29):") = ":who2
* see if we need to reset who verb to R83 mode
if original.who = 1 then execute "who (c" capturing out

crt "user,acct on port 2 is ":
crt oconv('u%2','u50bb'):","conv('a%2','u50bb')


Reply With Quote
  #5  
Old   
dzigray
 
Posts: n/a

Default Re: execute ".L" workaround for D3 - 09-14-2006 , 01:15 PM



so i don't get hammered... obviously my example is for user on pib2,
and assumes you can extrapolate.

Quote:
equivalent of \ field(oconv('u%2','u50bb'),"*",1) \


Reply With Quote
  #6  
Old   
Scott Ballinger
 
Posts: n/a

Default Re: execute ".L" workaround for D3 - 09-14-2006 , 03:18 PM



Also could add port3 = system(22).
The "u" "a" "p" options for the u50bb user exit have been around since
ap (7.0 or so?) - really handy since they don't depend on which flavor
of "who" is in effect. See "help u50bb" if you have ref installed.

/Scott Ballinger
Pareto Corporation
Edmonds WA USA
206 713 6006

Tony Gravagno wrote:
Quote:
port1 = @pib
port2 = oconv('p','u50bb')


Reply With Quote
  #7  
Old   
Frank Winans
 
Posts: n/a

Default Re: execute ".L" workaround for D3 - 09-14-2006 , 04:13 PM



"dzigray" wrote
Quote:
for completeness, don't forget about the "charge-to" side-effect...
which suffixes both an asterisk and text to each user id. eg.
"charge-to client1" will cause a user logged into "user" to be seen as
"user*client1" vs "user" in each of your code examples.

ie. if you truly want the "pure" user name, you must always perform the
equivalent of \field(oconv('u%2','u50bb'),"*",1)\

although seldom used these days "charge-to" feature (which also ties
into the logon accounting option ('a'-option) on tracking user
statistics)... will cause unwanted side-effects to many-a-application
logic not allowing for it.

Another 'gotcha' is, the tcl-stacks item id that bears your history of
recent commands is kept in item id same as your user id normally,
but an "i" on a9 of your users item makes the item id be your port
number instead. I've never seen a client use this "i", but was once
unamused to find charge-to in use during a new client conversion to d3.




Reply With Quote
  #8  
Old   
Scott Ballinger
 
Posts: n/a

Default Re: execute ".L" workaround for D3 - 09-14-2006 , 05:51 PM



Looks like the dm,bp, "." (dot) program uses the (undocumented?) user
exit "u6e" to test whether your tcl-stack is kept by port or user-id:

024 who = Oconv('','u50bb');* [05]
025 If Oconv('','u6e') = 1 Then
026 user = Field(who,' ',1);* [05] users i-option set, use pib
number
027 End Else
028 user = Field(who," ",2+System(29));* [02] [05]
029 End

/Scott Ballinger

Frank Winans wrote:
Quote:
Another 'gotcha' is, the tcl-stacks item id that bears your history of
recent commands is kept in item id same as your user id normally,
but an "i" on a9 of your users item makes the item id be your port
number instead. I've never seen a client use this "i", but was once
unamused to find charge-to in use during a new client conversion to d3.


Reply With Quote
  #9  
Old   
Tony Gravagno
 
Posts: n/a

Default Re: execute ".L" workaround for D3 - 09-15-2006 , 08:19 PM



Two more minor points.

Back in the early '80's I worked at a service bureau which charged
clients using data like CPU ticks used and pages printed in our
office. That was on an Ultimate. I don't believe those stats have
been accurate in D3 for many years.

While Dave is absolutely right about the charge-to factor, there could
be times where you DO want to know the know the user is doing a
charge-to, so you may not want to pick off that data element. I doubt
seriously anyone would care about that, considering the way systems
are used these days. Howevah!! D3 does have a weird habit of
affixing "fsi:" onto some account names when you do a logto within
code. We see this in flashconnect all the time and it's a real PITA
sometimes to ensure that when we're checking the current account that
we strip that text before reading against an account table. They
might have addressed this in v7.5, dunno.

HTH
T

"dzigray" wrote:

Quote:
for completeness, don't forget about the "charge-to" side-effect...
which suffixes both an asterisk and text to each user id. eg.
"charge-to client1" will cause a user logged into "user" to be seen as
"user*client1" vs "user" in each of your code examples.

ie. if you truly want the "pure" user name, you must always perform the
equivalent of \field(oconv('u%2','u50bb'),"*",1)\

although seldom used these days "charge-to" feature (which also ties
into the logon accounting option ('a'-option) on tracking user
statistics)... will cause unwanted side-effects to many-a-application
logic not allowing for it.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.