home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
db22re.zip
/
SHOWAUTH.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-03-09
|
4KB
|
129 lines
/*
┌──────────────────────────────────────────────────────────────────┐
│ Name : showauth.cmd │
│ Purpose : show auth of logged-on user │
│ Platform : DB2/2 │
│ Author : Jeff Fisher │
│ IBM Toronto Development Lab │
│ Disclaimer : This "sample" code is for demonstrations only, no │
│ warrenties are made or implied as to correct │
│ function. You should carefully test this code in │
│ your own environment before using it. │
│ │
└──────────────────────────────────────────────────────────────────┘
*/
Status:
call SetColor
address cmd '@echo off'
call SQLDBS 'OPEN DATABASE DIRECTORY ON D USING :scanvar'
if SQLCA.SQLCODE \= 0 then signal ErrorSQL
scanid = scanvar.1
say
say c.yellow
say 'There are' scanvar.2 'databases on drive D:'
say c.itcyan
do i=1 to scanvar.2
call SQLDBS 'GET DATABASE DIRECTORY ENTRY :scanvar.1 USING :entry'
if SQLCA.SQLCODE \= 0 then signal ErrorSQL
call Start_Using entry.1
call SQLDBS 'GET AUTHORIZATIONS :cvar'
if SQLCA.SQLCODE \= 0 then signal ErrorSQL
call Stop_Using
if cvar.1 = '1' then cvar1 = 'yes'
else cvar1 = 'no '
if cvar.2 = '1' then cvar2 = 'yes'
else cvar2 = 'no '
if cvar.3 = '1' then cvar3 = 'yes'
else cvar3 = 'no '
if cvar.4 = '1' then cvar4 = 'yes'
else cvar4 = 'no '
if cvar.5 = '1' then cvar5 = 'yes'
else cvar5 = 'no '
if cvar.6 = '1' then cvar6 = 'yes'
else cvar6 = 'no '
if cvar.7 = '1' then cvar7 = 'yes'
else cvar7 = 'no '
if cvar.8 = '1' then cvar8 = 'yes'
else cvar8 = 'no '
if cvar.9 = '1' then cvar9 = 'yes'
else cvar9 = 'no '
if cvar.10 = '1' then cvar10 = 'yes'
else cvar10 = 'no '
address cmd 'CLS'
say c.itgreen
say ' ------------------------------------------'
say c.yellow
say ' Your authorizations for Database:' entry.1
say c.itcyan
say ' Direct Indirect'
say c.green
say ' SYSADM 'CVAR1' 'CVAR6
say ' DBADM 'CVAR2' 'CVAR7
say ' CREATETAB 'CVAR3' 'CVAR8
say ' BINDADD 'CVAR4' 'CVAR9
say ' CONNECT 'CVAR5' 'CVAR10
say c.itgreen
say ' ------------------------------------------'
say c.normal
pause
end
call SQLDBS 'CLOSE DATABASE DIRECTORY :scanid'
if SQLCA.SQLCODE \= 0 then signal ErrorSQL
EndProg:
exit
Start_Using:
arg DBNAME
call SQLEXEC 'CONNECT TO' DBNAME 'IN SHARED MODE'
if SQLCA.SQLCODE \=0 then signal ErrorSQL
return
Stop_Using:
arg DBNAME
call SQLEXEC 'CONNECT RESET'
if SQLCA.SQLCODE \=0 then signal ErrorSQL
return
ErrorSQL:
call beep 220,1000
say c.itred
say ' >>> SQL has returned a fatal condition code'
say ' abending step = ' step
say ' SQLCODE = ' SQLCA.SQLCODE
say ' MSG = ' SQLMSG
say
call SQLDBS 'CLOSE DATABASE DIRECTORY :scanvar'
pause
signal EndProg
SetColor:
ansii.esc = '1B'x
c.normal = ansii.esc || '[0m'
c.highlite = ansii.esc || '[1m'
c.blackback = ansii.esc || '[40m'
c.green = c.normal || ansii.esc || '[32m'
c.grey = c.normal || ansii.esc || '[37m'
c.itred = c.highlite || ansii.esc || '[31m'
c.itgreen = c.highlite || ansii.esc || '[32m'
c.yellow = c.highlite || ansii.esc || '[33m'
c.itblue = c.highlite || ansii.esc || '[34m'
c.itmagenta = c.highlite || ansii.esc || '[35m'
c.itcyan = c.highlite || ansii.esc || '[36m'
c.white = c.highlite || ansii.esc || '[37m'
c.std = c.normal || c.itcyan || c.blackback
c.reset = c.normal || c.grey || c.blackback
return 0