! ----- READ_DIVISION_DATA.FUN ----- ! ! ----- SUBROUTINE TO READ IN ALL DIVISION INFORMATION ----- ! ! ---------- RETURNED: ---------- ! ----- DIVISION_CTR = Count of divisions read in ! ----- DIVISION_NAMES() = List of Division codes ! ----- DIVISION_UIC_GROUPS() = UIC Group Numbers for each Div ! ----- DIVISION_OTHER() = List of Other Info for each Division ! ! ----- Last Change 07/22/93 by Brian Lomasky ----- ! SUB READ_DIVISION_DATA %INCLUDE "NUSER.INC" DECLARE WORD ERR_FLAG ! LOCAL ERROR FLAG DECLARE STRING EXTRACTED_OTHER ! EXTRACTED OTHER VALUE DECLARE STRING EXTRACTED_UIC ! EXTRACTED UIC GROUP DECLARE LONG TEMP_LONG ! TEMPORARY LONGWORD DECLARE STRING TEMP_STRING ! TEMPORARY STRING EXTERNAL WORD FUNCTION NUMERIC( & STRING) ! CHECK FOR NUMERIC STRING EXTERNAL LONG FUNCTION OCT_TO_DEC( & LONG) ! CONVERT OCTAL TO DECIMAL DIVISION_CTR = -1% ! INIT COUNT OF DIVISIONS ERR_FLAG = FALSE ! INIT ERROR FLAG WHEN ERROR IN OPEN "TOOLS:NUSER.DAT" FOR INPUT AS FILE #99%, & SEQUENTIAL, ACCESS READ, ALLOW READ, & RECORDTYPE ANY USE IF ERR = FILE_NOT_FOUND THEN PRINT "Error - Can't find any existing" & + " TOOLS:NUSER.DAT file" + BEL ERR_FLAG = TRUE CONTINUE END IF IF ERR = PROTECTION_VIOLATION THEN PRINT "You do not have the privilege" + & " to open TOOLS:NUSER.DAT" + BEL ERR_FLAG = TRUE CONTINUE END IF IF ERR = CANNOT_OPEN_FILE THEN PRINT "Error - Can't open any existing" & + " TOOLS:NUSER.DAT file" + BEL PRINT "VMS error status value:"; VMSSTATUS ERR_FLAG = TRUE CONTINUE END IF PRINT "VMS error status value:"; VMSSTATUS EXIT HANDLER END WHEN CALL SYS$EXIT(ERROR_WITH_NO_PUTMSG BY VALUE) IF ERR_FLAG WHILE NOT ERR_FLAG WHEN ERROR IN LINPUT #99%, TEMP_STRING USE IF ERR = END_OF_FILE THEN ERR_FLAG = TRUE CONTINUE END IF PRINT PRINT "Unexpected BASIC Error " + & NUM1$(ERR) + & " while reading TOOLS:NUSER.DAT" + BEL PRINT "VMS error status value:"; VMSSTATUS EXIT HANDLER END WHEN IF NOT ERR_FLAG THEN IF DIVISION_CTR >= MAX_DIVS THEN PRINT "Error - Too many" + & " divisions found in" PRINT " TOOLS:NUSER.DAT" & + " - Increase" + & " MAX_DIVS in" + BEL PRINT " NUSER.INC and recompile" CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG BY VALUE) END IF ! ----- REMOVE ANY SPACES ----- TEMP_STRING = EDIT$(TEMP_STRING, 2%) ! ----- SKIP ANY COMMENT LINES ----- ITERATE IF LEFT(TEMP_STRING, 1%) = "!" IF LEN(TEMP_STRING) <> 11% THEN PRINT "%Bad NUSER.DAT" & + " line #" + & NUM1$(DIVISION_CTR + 2%)& + " - Wrong length" + BEL CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG BY VALUE) END IF IF MID(TEMP_STRING, 4%, 1%) <> "," THEN PRINT "%Bad NUSER.DAT" & + " line #" + & NUM1$(DIVISION_CTR + 2%)& + " - No comma in" + & " 4th char" + BEL CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG BY VALUE) END IF IF MID(TEMP_STRING, 8%, 1%) <> "," THEN PRINT "%Bad NUSER.DAT" & + " line #" + & NUM1$(DIVISION_CTR + 2%)& + " - No comma in" + & " 8th char" + BEL CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG BY VALUE) END IF EXTRACTED_UIC = SEG$(TEMP_STRING, 5%, 7%) IF NOT NUMERIC(EXTRACTED_UIC) THEN PRINT "%Bad NUSER.DAT" & + " line #" + & NUM1$(DIVISION_CTR + 2%)& + " - Non-numeric UIC" + BEL CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG BY VALUE) END IF ! ----- CONVERT UIC GROUP TO DECIMAL VALUE ----- TEMP_LONG = INTEGER(EXTRACTED_UIC, LONG) TEMP_LONG = OCT_TO_DEC(TEMP_LONG) ! ----- ALLOW OCTAL UIC GROUPS FROM ----- ! ----- 1 -> 37776 (1 -> 16382 DECIMAL) ----- IF TEMP_LONG < 1% OR TEMP_LONG > 16382% THEN PRINT "%Bad NUSER.DAT" & + " line #" + & NUM1$(DIVISION_CTR + 2%)& + " - UIC out of range" + BEL CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG BY VALUE) END IF EXTRACTED_OTHER = RIGHT(TEMP_STRING, 9%) IF NOT NUMERIC(EXTRACTED_OTHER) THEN PRINT "%Bad NUSER.DAT" & + " line #" + & NUM1$(DIVISION_CTR + 2%)& + " - Non-numeric Other" + BEL CALL SYS$EXIT( & ERROR_WITH_NO_PUTMSG BY VALUE) END IF DIVISION_CTR = DIVISION_CTR + 1% ! ----- STORE DIVISION CODE ----- DIVISION_NAMES(DIVISION_CTR) = & LEFT(TEMP_STRING, 3%) ! ----- STORE UIC GROUP NUMBERS FOR EACH ----- ! ----- DIVISION ----- DIVISION_UIC_GROUPS(DIVISION_CTR) = & INTEGER(EXTRACTED_UIC, WORD) ! ----- STORE OTHER INFO FOR EACH DIVISION ----- DIVISION_OTHER(DIVISION_CTR) = & INTEGER(EXTRACTED_OTHER, WORD) END IF NEXT CLOSE #99% END SUB