******************************************************************************* * * SQL catalog verification tool. * * Module %M% Version %I% Date %H% * * (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved * This is unpublished proprietary source code of Ardent Software Inc. * The copyright notice above does not evidence any actual or intended * publication of such source code. * ******************************************************************************* * * Maintenance log - insert most recent change descriptions at top * * Date.... GTAR# WHO Description......................................... * 10/14/98 23801 SAP Change copyrights. * 03/13/96 17797 AGM Replace SH and DOS with OS.EXEC * 01/25/96 17671 LAG Windows NT port * 07/18/93 10131 DPB Initial creation of catalog verification tool. * ******************************************************************************* * * VERIFY.SCHEMAS(Fix, Brief, VTables) * * This subroutine will verify the SQL catalog contents for all schemas. * * Fix This boolean variable indicates whether or not any * discrepencies found should be fixed. * Brief This boolean variable indicates the amout of output * expected from the subroutine. When turned on only * extrememly critical problems are reported. * VTables This boolean variable indicates whether of not the * tables associated with the schema should be verified. * ******************************************************************************* SUBROUTINE VERIFY.SCHEMAS(Fix, Brief, VTables) INCLUDE UNIVERSE.INCLUDE VERIFY.COM INCLUDE UNIVERSE.INCLUDE MACHINE.NAME ****************** ** Windows NT port ** DEFFUN IS.FULLPATH(FILESPEC) CALLING "*IS.FULLPATH" DEFFUN IS.EQPATHS(FILESPEC.A, FILESPEC.B) CALLING "*IS.EQPATHS" DEFFUN GET.DIRNAME(FILESPEC) CALLING "*GET.DIRNAME" DEFFUN GET.BASENAME(FILESPEC) CALLING "*GET.BASENAME" ** ****************** Verbose = NOT(Brief) ;* Opposite of Brief. (Saves opcodes) GOSUB BUILDLIST: FOR I = 1 to SchemaCount CALL *WRAP.PRINT(" ",Width,0,0) CALL *WRAP.PRINT("Verifying schema '":SchemaList:"'.",Width,0,0) CALL *VERIFY.SCHEMA(Schemas, Fix, Brief, VTables) NEXT I FOR I = 1 to DCOUNT(Plist,@FM) IF I = 1 THEN CALL *WRAP.PRINT(" ",Width,0,0) CALL *WRAP.PRINT("These schemas could not be verified (due to OS or SQL permissions):",Width,0,0) END CALL *WRAP.PRINT("** Schema '":Plist:"' located in '":PPlist:"'.",Width,0,3) FECount += 1 NEXT I RETURN BUILDLIST: IF LPTR THEN CRT "Searching entire system for schemas. This may take a while." IF Verbose THEN CALL *WRAP.PRINT("Searching entire system for schemas. This may take a while.",Width,0,0) ****************** ** Windows NT port ** IF OS.TYPE = "UNIX" THEN EXECUTE "SH -c 'find / -name VOC -exec ":UV.ROOT:"/bin/UVfile -s {} \;'" CAPTURING junk END ELSE EXECUTE "DOS /C '":UV.ROOT:"/bin/uvwalk \ -name VOC -recurse -all -ntfs -uvfile'" CAPTURING junk END ** ****************** IF Verbose THEN PRINT ON Pchan "Building schema list.": NUMFLDS = COUNT(junk,@FM) Schemas = "" SchemaList = "" SchemaPList = "" SchemaCount = 0 Plist = "" PPlist = "" FOR I = 2 to NUMFLDS IF UPCASE(junk[1,13]) = "UNIVERSE/SQL:" THEN IF Verbose THEN PRINT ON Pchan ".": SchemaCount = SchemaCount + 1 tmp = CONVERT(" ",@FM,junk) SchemaList = tmp<8> ****************** ** Windows NT port ** IF OS.TYPE = "UNIX" THEN tmp = CONVERT(":",@FM,junk) END ELSE tmp = CONVERT(": ",@FM,junk) END ** ****************** SchemaPList = tmp<1> tmp = SchemaPList[1,LEN(SchemaPList)-4] SchemaPList = tmp Schemas = tmp I = I+1 END NEXT I SELECTV uvschema TO schemlist done = 0 LOOP READNEXT id FROM schemlist ELSE done = 1 WHILE NOT(done) READ srec FROM uvschema,id ELSE CONTINUE LOCATE(srec<2>,SchemaPList;tmp) THEN IF SchemaList # id THEN INS id BEFORE Plist<-1> INS srec<2> BEFORE PPlist<-1> END END ELSE IF Verbose THEN PRINT ON Pchan ".": CHKNAME = srec<2>:"/VOC" GOSUB GETSCHEMA IF GetName = -1 THEN INS id BEFORE Plist<-1> INS srec<2> BEFORE PPlist<-1> END ELSE SchemaCount = SchemaCount + 1 SchemaPList = srec<2> SchemaList = id Schemas = id END END REPEAT IF Verbose THEN PRINT ON Pchan ".done" RETURN GETSCHEMA: EXECUTE OS.EXEC:" '":UV.ROOT:"/bin/UVfile -s ":CHKNAME:"'" CAPTURING junk IF junk<1>[1,8] = "[EACCES]" THEN GetName = -1 END ELSE IF INDEX(junk,"Permission denied",1) THEN GetName = -1 END ELSE IF junk<1>[LEN(junk<1>)-24,LEN(junk<1>)] = "No such file or directory" THEN GetName = -2 END ELSE IF junk = "" THEN GetName = 0 END ELSE junk = CONVERT(" ",@FM,junk<2>) GetName = junk IF GetName = "" THEN GetName = -3 END END RETURN