home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
db22re.zip
/
DIRSCAN.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-03-09
|
4KB
|
122 lines
/*
┌──────────────────────────────────────────────────────────────────┐
│ Name : dirscan.cmd │
│ Purpose : database directory scan │
│ 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. │
│ │
└──────────────────────────────────────────────────────────────────┘
*/
address cmd '@echo off'
call SetColor
address cmd 'CLS'
Menu:
say
say
say c.gre '*****************************'
say c.yel ' Database Directory Scan'
say
say c.gre ' Enter:'c.nor' Drive 'c.gre'or'c.nor' X 'c.gre'to EXIT'
say
say c.gre '*****************************'
say c.nor
pull drive
if drive = 'X' then signal EndProg
if drive = ' ' then
do
say
say c.red 'Invalid response: try again'
say
signal menu
end
call DirScan
signal menu
DirScan:
step = 'open database directory'
call SQLDBS 'OPEN DATABASE DIRECTORY ON' drive 'using :scanvar'
if SQLCA.SQLCODE \= 0 then signal ErrorSQL
scan_flag = 'Y'
address cmd 'CLS'
say
do i=1 to scanvar.2
step = 'get database directory entry'
call SQLDBS 'GET DATABASE DIRECTORY ENTRY :scanvar.1 USING :entry'
if SQLCA.SQLCODE \= 0 then signal ErrorSQL
say
say c.gre '-------------------------------------------'
say c.itcya 'Database:' entry.1 'Alias:' entry.2'Drive:' entry.3
say ' Internal name:' entry.4
say ' Node name :' entry.5
say ' Dbtype :' entry.6
say ' Comment :' entry.7
say ' Codepage :' entry.8
say ' Enttype :' entry.9
say c.gre '-------------------------------------------'
say c.nor
pause
end
step = 'close database directory'
call SQLDBS 'CLOSE DATABASE DIRECTORY :scanvar.1'
if SQLCA.SQLCODE \= 0 then signal ErrorSQL
address cmd 'CLS'
return
EndProg:
say c.nor
if scan_flag = 'Y' then
do
call SQLDBS 'CLOSE DATABASE DIRECTORY :scanvar.1'
end
address cmd 'CLS'
if RC \= 0 then signal ErrorSQL
exit
ErrorSQL:
say c.red
call beep 220,1000
say
say ' >>> SQL has returned a fatal condition code'
say ' step = ' step
say ' SQLCODE = ' SQLCA.SQLCODE
say ' MSG = ' SQLMSG
say
pause
signal Menu
SetColor:
ansii.esc = '1B'x
c.nor = ansii.esc || '[0m'
c.hih = ansii.esc || '[1m'
c.red = c.nor || ansii.esc || '[31m'
c.gre = c.nor || ansii.esc || '[32m'
c.yel = c.hih || ansii.esc || '[33m'
c.itblu = c.hih || ansii.esc || '[34m'
c.itcya = c.hih || ansii.esc || '[36m'
return 0