Inefficient, but I check for Direct, Local and/or Global. Here is the
subroutine that I use, which you can see has three opens. On the positive
side, this has not failed me since I started using it. (Hopefully, there
are no typos in this.)
SUBROUTINE VERIFY.PROGRAM(PROGRAM.NAME,CATALOG.TYPE,CATALOG.PATH)
*
* Open files, initialize variables
*
OPEN 'CTLG' TO F.CTLG ELSE STOP 201,'CTLG'
OPEN 'CTLGTB' TO F.CTLGTB ELSE STOP 201,'CTLGTB'
OPEN 'VOC' TO F.VOC ELSE STOP 201,'VOC'
CATALOG.TYPE = ''
CATALOG.PATH = ''
*
* Check for a voc entry
*
READ VOC.REC FROM F.VOC,PROGRAM.NAME THEN
IF VOC.REC<1> = 'C' THEN
OBJECT.PATH = VOC.REC<2>
NUM.FIELDS = COUNT(OBJECT.PATH,'/') + 1
*
* Check to see if this is a direct catalog
*
OBJECT.NAME = FIELD(OBJECT.PATH,'/',NUM.FIELDS)
OBJECT.FILE = FIELD(OBJECT.PATH,'/',NUM.FIELDS - 1)
IF OBJECT.NAME = '_':PROGRAM.NAME AND OBJECT.FILE # "CTLG"
THEN
CATALOG.TYPE<-1> = 'Direct'
CATALOG.PATH<-1> = OBJECT.PATH
END
*
* Look in the CTLG file, indicates local catalog
* (This could be deceiving if the direct catalog exists.)
*
READV EXISTS FROM F.CTLG,PROGRAM.NAME,0 THEN
CATALOG.TYPE<-1> = 'Local'
IF VOC.REC<3> # '' THEN
OBJECT.PATH := ' - ':VOC.REC<3>
END
CATALOG.PATH<-1> = OBJECT.PATH
END
END
END ELSE
*
* Look in the CTLG file, indicates a local catalog, but no
* corresponding voc record. This is probably an error, since
* without a voc record, I don't think you can call the program.
*
READV EXISTS FROM F.CTLG,PROGRAM.NAME,0 THEN
CATALOG.TYPE<-1> = 'Local?'
CATALOG.PATH<-1> = PROGRAM.NAME
END
END
*
* Look in the global catalog directory for the program name
*
READ CTLGTB.REC FROM F.CTLGTB,PROGRAM.NAME THEN
CATALOG.TYPE<-1> = 'Global'
CATALOG.PATH<-1> = CTLGTB.REC<3>
END
RETURN
--------------------------------------------------
Charlie Rubeor
Senior Database Administrator
Wiremold/Legrand
60 Woodlawn Street
West Hartford, CT 06110
Tel: 860-233-6251 x3498
Fax: 860-523-3690
Email: [EMAIL PROTECTED]
--------------------------------------------------
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/