Trailing-Edge
-
PDP-10 Archives
-
bb-d868b-bm_tops20_v3a_2020_dist
-
3a-sources/conv20.mac
There are 3 other files named conv20.mac in the archive. Click here to see a list.
;<HUIZENGA.CONV20>CONV20.MAC.7, 14-Dec-77 09:55:29, EDIT BY HUIZENGA
;CONSOLE CONNECT TIME IN LOGOUT ENTRY NEEDS TO BE IN MILLISECONDS
;<3-UTILITIES>CONV20.MAC.7, 8-Nov-77 10:46:51, EDIT BY KIRSCHEN
;MORE COPYRIGHT UPDATING...
;<3-UTILITIES>CONV20.MAC.6, 26-Oct-77 10:59:38, EDIT BY KIRSCHEN
;UPDATE COPYRIGHT FOR RELEASE 3
TITLE CONV20 - USAGE FORMAT TO FACT FORMAT CONVERSION PROGRAM - V3(5)
SUBTTL BAHUIZENGA/BAH 13-JUN-77
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
; OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1976, 1977, 1978 BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
SALL
;TEMPORARIES
T1=1
T2=2
T3=3
T4=4
;PERMANENT ACS
P1=10
P2=11
P3=12
P4=13
;PUSHDOWN POINTER
P=17
SEARCH MONSYM,MACSYM
.REQUIRE SYS:MACREL
VERS==3 ;MAJOR VERSION NUMBER
UPDAT==0 ;MINOR VERSION NUMBER
EDIT==5 ;EDIT NUMBER
CUST==0 ;CUSTOMER/SWS EDIT CODE
PGVER. VERS,UPDAT,EDIT,CUST
PDLLEN==50 ;PUSHDOWN STACK LENGTH
SUBTTL EDIT HISTORY
;EDIT 2/BAH MAKE END OF FILE RETURN REPORT CORRECTLY. FIX SO THAT THE
; RUNNING JOB'S USER ID NUMBER GETS PUT INTO WORD 2 OF DISK UTILIZATION
; ENTRIES. IN ADDITION, SET UP DEFAULT INPUT AND OUTPUT FILE-SPECS.
;EDIT 3/BAH ONE CALL TO UNSUPP DOES NOT ALLOW FOR SKIP RETURN.
;EDIT 4/BAH FACT FILE SET DATE-TIME ENTRIES NO BEING CORRECTLY SIMULATED
; ON A SYSTEM RELOAD. ALSO DATE AND TIME WORD IN SET DATE-TIME ENTRIES
; WAS ALWAYS ZERO.
SUBTTL USAGE FILE ENTRY FORMATS
;*********************************
RADIX 10
;*********************************
;LENGTH OF FIELDS TO BE PICKED UP IN A USAGE FILE RECORD
LENTYP==4 ;ENTRY TYPE LENGTH
LENSEQ==1 ;RECORD SEQUENCE LENGTH
LENJOB==4 ;JOB # LENGTH
LENLIN==4 ;LINE # LENGTH
LENUSR==39 ;USER/DIRECTORY NAME LENGTH
LENDTM==14 ;DATE/TIME LENGTH
LENACT==39 ;ACCOUNT STRING LENGTH
LENRUN==9 ;RUNTIME LENGTH
LENANO==3 ;# OF ACCOUNT STRINGS IN DISK USAGE ENTRY LENGTH
LENPAG==10 ;# OF FILE PAGES USED LENGTH
LENSTR==6 ;FILE STRUCTURE NAME LENGTH
LENCON==7 ;CONSOLE CONNECT TIME LENGTH
;*********************************
RADIX 8
;*********************************
;BYTE POINTERS TO THE BEGINNING CHARACTER OF EACH FIELD CONTAINING DATA
; THAT WILL BE CONVERTED AND PUT INTO A BINARY (MIXED MODE)
; FACT FORMATED FILE.
;HEADER OF ALL USAGE RECORDS - FIRST 20 CHARACTERS (4 WORDS)
USETYP: POINT 7,USEBLK ;ENTRY TYPE USED FOR BINARY CONVERSIONS
USESEQ: POINT 7,USEBLK+1,6 ;RECORD SEQUENCE NUMBER (WILL BE REFERENCED WITH
; A LDB INSTEAD OF AN ILDB AS THE OTHERS)
;ENTRY HEADER RECORD - IS ALWAYS THE FIRST RECORD OF ALL ENTRIES
USEJOB: POINT 7,USEBLK+4 ;JOB #
USELDT: POINT 7,USEBLK+4,27 ;DATE/TIME ENTRY WAS MADE
USELIN: POINT 7,USEBLK+7,27 ;LINE #
;USER IDENTFICATION RECORD
USEUSR: POINT 7,USEBLK+4 ;USER/DIRECTORY NAME
;SESSION RECORD #1
USEACT: POINT 7,USEBLK+4 ;ACCOUNT STRING
USERUN: POINT 7,USEBLK+13,27 ;USER'S RUNTIME
USEBDT: POINT 7,USEBLK+15,20 ;DATE/TIME USER BEGAN SESSION
USECON: POINT 7,USEBLK+32,27 ;CONSOLE CONNECT TIME (SECONDS)
;DISK USAGE DIRECTORY RECORD
USEANO: POINT 7,USEBLK+4 ;NUMBER OF ACCOUNT STRINGS (RECORDS) IN ENTRY
USEDUN: POINT 7,USEBLK+12,27 ;POINTER TO USER/DIRECTORY NAME
;DISK USAGE ACCOUNT STRING RECORD
;USEACT:POINT 7,USEBLK+4 ;ACCOUNT STRING. ALREADY DEFINED IN SESSION ENTRY
USEDIR: POINT 7,USEBLK+13,27 ;DIRECTORY NAME
USEPAG: POINT 7,USEBLK+25,20 ;NUMBER OF FILE PAGES USED
USESTR: POINT 7,USEBLK+30,20 ;STRUCTURE NAME
SUBTTL FACT FILE ENTRY FORMATS
;HEADER BLOCK DEFINITIONS (FIRST THREE WORDS OF EVERY ENTRY)
DEFSTR HDRTYP,FACTBL,8,9 ;TYPE CODE
DEFSTR HDRJOB,FACTBL,17,9 ;JOB #
DEFSTR HDRLIN,FACTBL,29,12 ;LINE #
DEFSTR HDRCNT,FACTBL,35,6 ;WORD COUNT OF ENTRY
DEFSTR HDRUSR,FACTBL+1,35,36 ;USER #
DEFSTR HDRDTM,FACTBL+2,35,36 ;DATE/TIME
;LOGIN DEFINITIONS
DEFSTR LGIZER,FACTBL+3,35,36 ;ZERO WORD
DEFSTR LGICHR,FACTBL+4,35,36 ;CHAR COUNT OF ACCOUNT STRING
LGIACT: POINT 7,FACTBL+5 ;POINTER TO BEGINNING OF ACCOUNT STRING
;LOGOUT DEFINITIONS
DEFSTR LGORUN,FACTBL+3,35,36 ;RUNTIME
DEFSTR LGOCON,FACTBL+4,35,36 ;CONSOLE TIME (MILLISECONDS)
;DISK UTILIZATION DEFINITION
DEFSTR SPCPAG,FACTBL+3,35,36 ;# OF FILE PAGES USED
;SINCE THE FORMAT AND PLACEMENT OF THE ACCOUNT STRING IN THE DISK
;UTILIZATION ENTRY IS THE SAME AS THE LOGIN ENTRY, LGICHR AND LGIACT, ALONG
;WITH THE ROUTINE LGIWD5 WILL BE USED. THE CALL, HOWEVER, WILL BE FOR
;SPCWD5 INSTEAD OF LGIWD5.
;
;THE STRUCTURE/DIRECTORY NAME STRING WILL BE BUILT BY HAND WITHOUT THE USE
;OF DEFSTR'S. AFTER THE ACCOUNT STRING, THE NEXT WORD WILL CONTAIN THE WORD
;COUNT OF THE STRUCTURE/DIRECTORY NAME STRING. AFTER THAT WILL BE THE
;ACTUAL STRING.
;MISCELLANEOUS VALUES
SPACE==40 ;SPACE ( )
SLASH==57 ;SLASH (/)
COLON==72 ;COLON (:)
LANGLE==74 ;LEFT ANGLE BRACKET
RANGLE==76 ;RIGHT ANLGE BRACKET
SUBTTL TOP LEVEL ROUTINE
START: RESET
MOVE P,[IOWD PDLLEN,PDL] ;SET UP STACK POINTER
CALL GETIN ;GET USAGE FORMAT INPUT FILE SPEC
CALL GETOUT ;GET FACT FORMAT OUTPUT FILE SPEC (NEW OR OLD)
CALL GETOPN ;GO OPEN THE FILES
CALL CLRTBL ;ZERO THE FACT ENTRY BUILDING TABLE
;HERE TO BEGIN TO READ AN ENTRY
READXX: CALL SETRD ;SET UP TO READ ANOTHER RECORD
READX1: LDB T1,USESEQ ;GET SEQUENCE # POINTER
CAIE T1,"1" ;IS THIS THE FIRST RECORD OF AN ENTRY?
JRST READXX ;NO, READ UNTIL WE FIND ONE
MOVE T1,USETYP ;GET POINTER TO ENTRY TYPE
MOVEI T2,LENTYP ;GET THE LENGTH
CALL NUMDEC ;CONVERT FOR DISPATCH TABLE
MOVEM T1,SAVTYP ;SAVE THE ENTRY TYPE
CAIL T1,DISLEN ;DO WE KNOW ABOUT THIS ENTRY TYPE?
JRST [CALL UNSUPP ;NO REPORT IT AND READ NEXT ENTRY
JRST READX1 ;WILL NEVER HAPPEN
JRST READXX]
CALL @DISPAT(T1) ;GO PROCESS APPROPRIATE ROUTINE
; THE DISPATCH ROUTINE WILL DO A SKIP RETURN
; IF NO ERRORS ARE ENCOUNTERED. OTHERWISE,
; IF A SEQUENCE NUMBER OF 1 IS READ, THE
; ROUTINE WILL DO A NON-SKIP RETURN
JRST [HRROI [ASCIZ /
%Incomplete entry found/]
PSOUT
JRST READX1] ;ERROR RETURN
JRST READXX ;GOOD RETURN
SUBTTL DISPATCH TABLE TO PROCESS USAGE ENTRIES TO FACT ENTRIES
DISPAT: UNSUPP ;NO ENTRY NUMBERED '0000'
RESTAR ;SYSTEM RESTART ENTRY '0001' - MAKES AN
; SYSTEM FROM SCRATCH ENTRY '740'
SESSIO ;SESSION ENTRY '0002' - MAKES A LOGIN ENTRY
; '501' AND A LOGOUT ENTRY '141'
SESSIO ;INCOMPLETE SESSION ENTRY '0003' -
; MAKES A LOGIN ENTRY '501' AND A CHKPNT
; ENTRY '201'
UNSUPP ;UNDEFINED ENTRY '0004'
CNGDTM ;DATE/TIME CHANGE ENTRY '0005' - MAKES
; A TIME SET ENTRY '741'
UNSUPP ;'0006' ENTRY NOT SUPPORTED IN FACT FILE
UNSUPP ;'0007' ENTRY NOT SUPPORTED IN FACT FILE
UNSUPP ;'0008' ENTRY NOT SUPPORTED IN FACT FILE
DISKUS ;DISK USAGE DIRECTORY AND ACCOUNT STRING
; ENTRY '0009' - MAKES DISK UTILIZATION
; ENTRIES '540' AND '601'
DISLEN=.-DISPAT ;LENGTH OF DISPATCH TABLE
SUBTTL SECOND LEVEL ROUTINES
;GETIN - ROUTINE TO GET THE INPUT FILE SPEC FOR THE FILE THAT HAS THE USAGE
; FORMAT. THIS FILE'S DATA WILL BE CONVERTED TO FACT FILE FORMAT
;CALL GETIN
GETIN: HRROI T1,[ASCIZ /
Please enter the USAGE file to be read: /]
PSOUT ;ASK FOR THE INPUT FILE NAME
MOVEI T1,USEJTB ;ARGUMENT BLOCK FOR GTJFN LONG FORM
MOVEI T2,0
GTJFN ;GET IT
ERJMP [CALL INERR ;REPORT ERROR. WILL RETURN TO ASK FOR ANOTHER
JRST GETIN] ; USAGE FILE NAME
HRRZM T1,USEJFN ;SAVE INPUT JFN
RET
;GETOUT - ROUTINE TO THE THE OUTPUT FILE SPEC FOR THE FILE THAT WILL
; HAVE THE FACT FILE FORMAT.
;CALL GETOUT
GETOUT: HRROI T1,[ASCIZ /
Please enter file to be written: /]
PSOUT ;ASK FOR OUTPUT FILE NAME
MOVEI T1,FCTJTB ;ARGUMENT BLOCK FOR GTJFN LONG FORM
MOVEI T2,0
GTJFN ;GET IT
ERJMP [CALL OUTERR ;REPORT ERROR. WILL RETURN TO ASK FOR ANOTHER
JRST GETOUT] ; OUTPUT FILE SPEC
HRRZM T1,FCTJFN ;SAVE OUTPUT JFN
RET
;GETOPN - ROUTINE TO OPEN INPUT AND OUTPUT FILES
;CALL GETOPN
GETOPN: MOVE T1,USEJFN ;GET INPUT JFN OF USAGE FILE
MOVX T2,7B5!OF%RD ;READ ONLY, ASCII
OPENF ;OPEN THE FILE
ERJMP [CALL XERSTR
HALTF]
MOVE T1,FCTJFN ;GET OUTPUT JFN OF FACT FILE
MOVX T2,44B5!OF%APP ;APPEND, BINARY (MIXED MODE)
OPENF ;OPEN THE FILE
ERJMP [CALL XERSTR
HALTF]
RET ;NOW GO PROCESS
;FCTOUT - ROUTINE TO OUTPUT FACT FILE ENTRIES. THE ENTRY IS FOUND IN FACTBL:.
; THE BYTE COUNT (36-BIT BYTES) IS FOUND BY REFERENCING HDRCNT
;CALL: CALL FCTOUT
FCTOUT: LOAD P1,HDRCNT ;GET THE WORD COUNT OF ENTRY
SKIPA P2,[0] ;ZERO INDEX TO WORD TO BE OUTPUT
FCTOU1: AOS P2 ;ADJUST INDEX
MOVE T1,FCTJFN ;GET FACT FILE JFN
MOVE T2,FACTBL(P2) ;GET THE DATA
BOUT ;OUTPUT THE WORD
SOJG P1,FCTOU1 ;ARE WE FINISHED?
CALL CLRTBL ;YES. ZERO FACT FILE ENTRY BUILDING TABLE
RET ;AND RETURN
;DONE - ROUTINE TO FINISH UP
;CALL DONE
DONE: CALL CHKEOF ;GO SEE IF INPUT ERROR WAS AN EOF
CALL XERSTR ;NOT AN EOF, REPORT IT
MOVE T1,USEJFN ;GET USAGE FILE JFN
CLOSF ;CLOSE THE USAGE FILE
ERCAL XERSTR ;REPORT THE ERROR
MOVE T1,FCTJFN ;GET THE FACT FILE JFN
CLOSF ;CLOSE THE FACT FILE
ERCAL XERSTR ;REPORT THE ERROR
HALTF ;ALL DONE WITH PROCESS
HALTF ;STOP
;CHKEOF - ROUTINE TO SEE IF AN END OF FILE WAS REACHED
;CALL: CALL CHKEOF
CHKEOF: MOVEI T1,.FHSLF ;OUR PROCESS HANDLE
GETER ;GET THE LAST ERROR
HRRZS T2 ;ISOLATE THE ERROR
CAIE T2,IOX4 ;IS IT AN END OF FILE?
RET ;NO, DO A NON-SKIP RETURN
HRROI T1,[ASCIZ /
[USAGE to FACT conversion completed]/] ;YES. REPORT CONVERSION COMPLETE
PSOUT
RETSKP
SUBTTL USAGE DATA TO FACT DATA CONVERSION ROUTINES
;UNSUPP - ROUTINE TO USE IF A USAGE FILE ENTRY HAS NOT BEEN SUPPORTED
; IN THE FACT FILES PRODUCED BY TOPS20 VERSION 2 AND PREDECESSORS
UNSUPP: SETZM FLGDSK ;MAKE SURE DISK ENTRIES WILL BE RIGHT
HRROI T1,[ASCIZ /%Not supported in FACT format - /]
PSOUT
MOVEI T1,.PRIOU ;REPORT THE ENTRY TYPE
MOVE T2,USETYP
MOVNI T3,LENTYP
MOVEI T4,0
SOUT
HRROI T1,[ASCIZ /
/]
PSOUT
RETSKP
;RESTAR - ROUTINE TO PROCESS SYSTEM RESTART RECORD
; ALWAYS DOES A SKIP RETURN SINCE ONLY ONE USAGE RECORD HAS TO BE
; READ TO MAKE A FACT FILE ENTRY
RESTAR: SETZM FLGDSK ;MAKE SURE DISK ENTRIES WILL BE RIGHT
SETZRO HDRCNT ;ZERO WORD COUNT OF ENTRY
;CREATE THE FIRST WORD OF THE ENTRY (ONLY ONE WORD FOR THIS ONE)
MOVEI T1,740 ;GET ENTRY TYPE
STOR T1,HDRTYP ;FORMAT IT
INCR HDRCNT ;FIRST WORD IS DONE
CALL FCTOUT ;OUTPUT THE ENTRY
; RETSKP ;TIME SET ENTRY MUST BE MADE ON RESTARTS
; SO FALL INTO CNGDTM.
;CNGDTM- ROUTINE TO CONVERT A CHANGE DATE/TIME ENTRY OF A USAGE FILE TO A
; TIME SET ENTRY OF A FACT FILE.
CNGDTM: SETZM FLGDSK ;MAKE SURE DISK ENTRIES WILL BE RIGHT
SETZRO HDRCNT ;ZERO THE WORD COUNT
MOVEI T1,741 ;ENTRY TYPE OF A TIME SET ENTRY
STOR T1,HDRTYP ;STORE IT
MOVE T1,USEJOB ;GET THE POINTER TO JOB #
MOVEI T2,LENJOB ; AND ITS LENGTH
CALL NUMDEC ;CONVERT
STOR T1,HDRJOB ;STORE IT
MOVE T1,USELIN ;GET THE POINTER TO LINE #
MOVEI T2,LENLIN ; AND ITS LENGTH
CALL NUMOCT ;CONVERT
STOR T1,HDRLIN ;STORE IT
INCR HDRCNT ;DONE WITH FIRST WORD
SETZRO HDRUSR ;NO DIRECTORY/USER INFORMATION AVAILABLE
INCR HDRCNT ;DONE WITH SECOND WORD
MOVE T1,USELDT ;GET POINTER TO DATE/TIME
CALL DATTIM ;CONVERT IT
STOR T2,HDRDTM ;STORE IT
INCR HDRCNT ;DONE WITH THIRD WORD
CALL FCTOUT ;NOW OUTPUT THE ENTRY
RETSKP ;FINISHED
;DISKUS - ROUTINE TO CONVERT USAGE FILE DISK USAGE DIRECTORY AND ACCOUNT
; STRING RECORDS TO FACT FILE DISK UTILIZATION ENTRIES.
DISKUS: SKIPN FLGDSK ;HAS THE DISK UTILIZATION INITIAL ENTRY BEEN MADE?
CALL SPCBEG ;NO. GO MAKE IT
MOVE T1,USELDT ;DATE/TIME IS IN THIS RECORD
CALL DATTIM ;CONVERT IT TO INTERNAL FORMAT
MOVEM T2,SAVDAT ;AND THEN SAVE IT FOR THE REST OF THE ENTRIES
DISKU1: CALL SETRD ;READ NEXT RECORD
MOVE T1,USETYP ;GET THE ENTRY TYPE TO ENSURE DISK ENTRYS ARE
MOVEI T2,LENTYP ; STILL BEING READ
CALL NUMDEC ;CONVERT
CAME T1,SAVTYP ;IS THIS A DISK ENTRY?
RET ;NO. DO A NON-SKIP RETURN. A NON-SKIP RETURN WILL BE
; THE ONLY RETURN TO THE MAIN LOOP SINCE THE
; THE FIRST RECORD OF THE NEXT ENTRY WILL
; ALREADY HAVE BEEN READ
LDB T1,USESEQ ;GET THE SEQUENCE NUMBER
CAIE T1,"2" ;IS THIS THE SECOND RECORD?
RET ;NO. RETURN
SETOM T1 ;NOW FIND THIS JOB'S 36-BIT USER NUMBER
MOVE T2,[-3,,TEMP]
MOVEI T3,.JIUNO
GETJI
JRST [ERCAL XERSTR
SETZM SAVUSR
JRST DISKU2]
MOVE T1,TEMP(.JIUNO)
MOVEM T1,SAVUSR ;SAVE THE USER NUMBER
DISKU2: CALL SETRD ;THIS SECTION PROCESSES THE ACCOUNT STRING RECORDS
MOVE T1,USETYP ;GET THE ENTRY TYPE TO ENSURE DISK RECORDS
MOVEI T2,LENTYP ;ARE STILL BEING READ
CALL NUMDEC ;CONVERT
CAME T1,SAVTYP ;IS IT THE SAME TYPE?
RET ;NO. RETURN TO MAIN LOOP (READX1)
LDB T1,USESEQ ;GET THE SEQUENCE NUMBER
CAIE T1,"3" ;MAKE SURE THIS IS AN ACCOUNT STRING RECORD
RET ;RETURN TO THE MAIN LOOP. (READX1)
CALL SPCWD1 ;WORK ON FIRST WORD OF ENTRY (TYPE,JOB,LINE,COUNT)
MOVE T1,SAVUSR ;GET THE USER/DIRECTORY NUMBER
STOR T1,HDRUSR ;STORE IT
INCR HDRCNT ;DONE WITH SECOND WORD OF ENTRY
MOVE T1,SAVDAT ;NOW GET THE DATE/TIME
STOR T1,HDRDTM ;STORE IT
INCR HDRCNT ;DONE WITH THIRD WORD OF ENTRY
CALL SPCWD4 ;GET THE NUMBER OF FILE PAGES USED
CALL SPCWD5 ;GET THE ACCOUNT STRING
CALL SPCWDN ;GET THE DIRECTORY NAME
CALL FCTOUT ;OUTPUT THE ENTRY
JRST DISKU2 ;GO PROCESS THE NEXT RECORD
;SPCBEG - ROUTINE TO MAKE THE BEGINNING OF DISK UTILIZATION ENTRY. THIS
; ENTRY WILL BE MADE IF 'FLGDSK' IS ZERO.
SPCBEG: SETZRO HDRCNT ;ZERO THE WORD COUNT
MOVEI T1,540 ;SIGNIFY THE BEGINNING OF DISK UTILIZATION
STOR T1,HDRTYP ; STATISTICS
INCR HDRCNT ;DONE WITH FIRST WORD AND ENTRY
CALL FCTOUT ;GO OUTPUT IT NOW
SETOM FLGDSK ;SIGNIFY THAT THE ENTRY HAS BEEN MADE
RET
;SPCWD1 - ROUTINE TO WORK ON FIRST WORD OF DISK UTILIZATION ENTRY
SPCWD1: MOVEI T1,601 ;ENTRY TYPE
STOR T1,HDRTYP ;STORE IT
SETZRO HDRJOB ;JOB # AND LINE # ARE ZERO IN THESE
SETZRO HDRLIN ; ENTRIES
INCR HDRCNT ;DONE WITH FIRST WORD
RET
;SPCWD4 - ROUTINE TO WORK ON FOURTH WORD OF DISK UTILIZATION ENTRY, NAMELY,
; THE NUMBER OF FILE PAGES USED.
SPCWD4: MOVE T1,USEPAG ;GET POINTER TO THE NUMBER
MOVEI T2,LENPAG ;AND ITS FIELD LENGTH
CALL NUMDEC ;CONVERT IT
STOR T1,SPCPAG ;STORE IT
INCR HDRCNT ;DONE WITH WORD FOUR
RET
;SPCWDN - ROUTINE TO WORK ON THE LAST SET OF WORDS OF THE DISK UTILIZATION ENTRY.
; THE FIRST WORD OF THIS SET HAS THE WORD COUNT USED BY THE STRUCTURE/DIRECTORY
; NAME STRING. THE REST OF THIS SET CONTAINS THE STRUCTURE/DIRECTORY
; NAME STRING. IT IS IMPORTANT THAT ALL THE REST OF THE DISK UTILIZATION
; ENTRY BE DONE BEFORE THIS ROUTINE IS CALLED.
SPCWDN: STKVAR <CNTADR> ;DEFINE A WORD WHERE THE ADDRESS OF
; THE WORD COUNT WILL BE STORED
LOAD T1,HDRCNT ;GET THE CURRENT WORD COUNT OF THE ENTRY
MOVEI T2,FACTBL(T1) ;GET THE ADDRESS OF THE DIRECTORY WORD COUNT
MOVEM T2,CNTADR ;STORE IT FOR FUTURE REFERENCE
MOVE T3,[POINT 7,FACTBL+1] ;SET UP POINTER TO FIRST WORD OF DIRECTORY NAME
ADD T3,T1
MOVE T1,USESTR ;GET THE POINTER TO THE STRUCTURE NAME
MOVEI T2,LENSTR ;AND ITS LENGTH
MOVEI P1,0 ;P1 WILL BE USED TO KEEP THE NUMBER OF CHARACTERS
SPCWN1: ILDB T4,T1 ;GET A CHARACTER
CAIN T4," " ;ARE WE FINISHED?
JRST SPCWN2 ;YES. NOW GO GET DIRECTORY NAME
IDPB T4,T3 ;STORE IT
ADDI P1,1 ;COUNT THE CHARACTER
SOJG T2,SPCWN1 ;HAVE WE REACHED THE MAXIMUM FIELD LENGTH?
SPCWN2: MOVEI T4,COLON ;SIGNIFY END OF STRUCTURE NAME
IDPB T4,T3 ;NOW WE HAVE 'STRUCTURE:'
MOVEI T4,LANGLE ;ALSO SIGNIFY BEGINNING OF DIRECTORY NAME
IDPB T4,T3
ADDI P1,2 ;COUNT THE COLON AND LEFT ANGLE BRACKET
MOVE T1,USEDIR ;GET THE POINTER TO THE DIRECTORY NAME
MOVEI T2,LENUSR ;AND THE FIELD LENGTH (T3 STILL CONTAINS POINTER
; TO THE CORRECT PLACE
SPCWN3: ILDB T4,T1 ;GET A CHARACTER
CAIN T4," " ;ARE WE FINISHED?
JRST SPCWN4 ;YES. FINISH UP.
IDPB T4,T3 ;STORE IT
ADDI P1,1 ;COUNT THE CHARACTER
SOJG T2,SPCWN3 ;HAVE WE REACHED THE MAXIMUM FIELD LENGTH?
SPCWN4: MOVEI T4,RANGLE ;YES. NOW SIGNIFY END OF DIRECTORY NAME
IDPB T4,T3 ;STORE IT
MOVEI T4,.CHNUL ;JUST IN CASE BE SURE TO INCLUDE A NULL
IDPB T4,T3 ;STORE IT
ADDI P1,2 ;COUNT THE RIGHT ANGLE BRACKET AND NULL
IDIVI P1,5 ;NOW FIND THE WORD COUNT
CAIE P2,0 ;ARE THERE ANY CHARACTERS LEFT OVER?
ADDI P1,1 ;YES. COUNT THE WORD
MOVEM P1,@CNTADR ;STORE THE WORD COUNT
INCR HDRCNT ;COUNT FOR THE WORD COUNT WORD
LOAD T1,HDRCNT ;GET THE ENTRY WORD COUNT
ADD T1,P1 ;ADJUST IT.
STOR T1,HDRCNT ;STORE IT
RET ;ALL DONE
;SESSIO - ROUTINE TO CONVERT A SESSION ENTRY OF A USAGE FILE
; TO A LOGIN AND A LOGOUT ENTRY IN FACT FILE FORMAT. A SESSION
; ENTRY CONSISTS OF THREE RECORDS. IF ANY INFORMATION IS MISSING,
; THE ROUTINE WILL DO A NON-SKIP RETURN. OTHERWISE,
; IT WILL DO A SKIP RETURN
SESSIO: SETZRO HDRCNT ;INITIALIZE THE WORD COUNT OF ENTRY
CALL LGIWD1 ;WORK ON FIRST WORD OF LOGIN ENTRY (TYPE,JOB,LINE,COUNT)
CALL LGOWD3 ;LOGOUT DATE/TIME IS IN THIS RECORD.
; SO CONVERT IT NOW AND SAVE FOR LATER
CALL LGIWD4 ;WORK ON FOURTH WORD OF LOGIN ENTRY (ALWAYS ZERO)
;NOW ALL DATA HAS BEEN OBTAINED FROM THE FIRST USAGE RECORD. GO READ ANOTHER ONE.
CALL SETRD ;SET UP TO READ ANOTHER RECORD
LDB T1,USESEQ ;GET THE RECORD SEQUENCE #
CAIE T1,"2" ;IS THIS THE SECOND RECORD?
RET ;NO GIVE A NON-SKIP ERROR RETURN
CALL LGIWD3 ;WORK ON WORD THREE OF THE LOGIN ENTRY (DATE/TIME)
CALL LGIWD5 ;WORK ON WORDS 5-N (ACCOUNT STRING)
CALL LGOWD4 ;RUNTIME IS IN THIS RECORD. SO GET IT AND
; SAVE IT FOR LATER (WORD 4, LOGOUT/CHKPNT)
;NOW ALL DATA HAS BEEN OBTAINED FROM THE SECOND USAGE RECORD.
;GO READ THE THIRD TO GET THE USER NAME
CALL SETRD ;GO READ ANOTHER RECORD
LDB T1,USESEQ ;GET THE RECORD SEQUENCE #
CAIE T1,"3" ;IS THIS THE THIRD RECORD?
RET ;NO, GIVE A NON-SKIP RETURN
CALL LGIWD2 ;WORK ON WORD 2 OF THE LOGIN ENTRY (USER NUMBER)
CALL FCTOUT ;NOW OUTPUT THE LOGIN ENTRY
;NOW MAKE A LOGOUT OR CHECKPOINT ENTRY. THE TWO DIFFERENCES OF THESE
; ENTRIES ARE: 1)ENTRY TYPE AND 2) CHECKPOINT ENTRY HAS 0 FOR
; THE CONSOLE TIME.
CALL LGOWD1 ;WORK ON WORD 1 OF THE LOGOUT/CHECKPOINT ENTRY
MOVE T1,SAVUSR ;WORK ON WORD 2 OF THE LOGOUT/CHKPNT ENTRY
STOR T1,HDRUSR ;USER NUMBER HAS ALREADY BEEN FOUND
MOVE T1,SAVLDT ;WORK ON WORD 3
STOR T1,HDRDTM ;DATE/TIME HAS ALREADY BEEN FOUND
MOVE T1,SAVRUN ;WORK ON WORD 4
STOR T1,LGORUN ;RUNTIME HAS ALREADY BEEN FOUND
CALL LGOWD5 ;WORK ON WORD 5
CALL FCTOUT ;OUTPUT THE ENTRY
RETSKP ;DONE
;LGIWD1 - ROUTINE TO MAKE THE FIRST WORD OF A LOGIN ENTRY
; THE ENTRY HEADER RECORD MUST BE IN USEBLK
LGIWD1: MOVEI T1,501 ;LOGIN TYPE CODE
STOR T1,HDRTYP ;STORE IT
MOVE T1,USEJOB ;GET POINTER TO JOB #
MOVEI T2,LENJOB ; AND ITS LENGTH
CALL NUMDEC ;CONVERT
STOR T1,HDRJOB ;STORE IT
MOVEM T1,SAVJOB ;ALSO SAVE IT FOR THE LOGOUT ENTRY
MOVE T1,USELIN ;GET POINTER TO LINE #
MOVEI T2,LENLIN ; AND ITS LENGTH
CALL NUMOCT ;CONVERT
STOR T1,HDRLIN ;STORE IT
MOVEM T1,SAVLIN ;ALSO SAVE IT FOR THE LOGOUT ENTRY
INCR HDRCNT ;DONE WITH FIRST WORD
RET
;LGIWD2 - ROUTINE TO MAKE WORD 2 OF A LOGIN ENTRY, A 36-BIT
; USER NUMBER
LGIWD2: MOVE T1,USEUSR ;GET THE POINTER TO THE USER NAME
CALL USRNUM ;GET THE USER NUMBER
STOR T3,HDRUSR ;STORE IT
INCR HDRCNT ;DONE WITH ANOTHER WORD
MOVEM T3,SAVUSR ;ALSO SAVE IT
RET ;AND RETURN
;LGIWD3 - ROUTINE TO MAKE WORD 3 OF THE LOGIN ENTRY. THE DATE/TIME IS
; FOUND IN THE SECOND USAGE RECORD OF A SESSION ENTRY.
LGIWD3: MOVE T1,USEBDT ;GET POINTER OF LOGIN DATE/TIME
CALL DATTIM ;CONVERT
STOR T2,HDRDTM ;STORE IT IN FACT FILE BLOCK
MOVEM T2,SAVBDT ;ALSO SAVE IT TO COMPUTE CONSOLE TIME IN LOGOUT ENTRY
INCR HDRCNT ;DONE WITH WORD 3
RET
;LGIWD4 - ROUTINE TO MAKE WORD 4 OF LOGIN. IT IS ALWAYS ZERO.
LGIWD4: SETZRO LGIZER ;STORE IT
INCR HDRCNT ;DONE WITH WORD 4
RET
;LGIWD5/SPCWD5 - ROUTINE TO MAKE THE FIFTH THROUGH N WORDS, WHERE N IS THE NUMBER
; OF WORDS NEEDED TO STORE THE ACCOUNT STRING. AN ACCOUNT STRING
; IS LEFT-JUSTIFIED SPACE-FILLED IN THE USAGE FILE
SPCWD5:
LGIWD5: SETZRO LGICHR ;MAKE SURE COUNT IS ZERO
MOVE T1,USEACT ;GET POINTER TO ACCOUNT STRING
MOVEI T2,LENACT ;AND ITS MAXIMUM LENGTH
MOVE T3,LGIACT ;SET UP A POINTER TO THE FACT ACCOUNT STRING
LGIW5A: ILDB T4,T1 ;GET THE A CHARACTER
CAIN T4," " ;ARE WE FINISHED?
JRST LGIW5B ;GO FINISH UP
IDPB T4,T3 ;STORE THE CHARACTER
DECR LGICHR ;COUNT THE CHARACTER (MUST BE NEGATIVE)
SOJG T2,LGIW5A ;HAVE WE REACHED 39 CHARS YET?
LGIW5B: INCR HDRCNT ;COUNT THE CHARACTER COUNT WORD
LOAD T1,LGICHR ;YES, GET THE CHARACTER COUNT
MOVNS T1 ;MAKE THE COUNT POSITIVE
IDIVI T1,5 ;GET THE WORD COUNT OF ACCOUNT STRING
LOAD T3,HDRCNT ;GET THE OLD ENTRY WORD COUNT
ADD T3,T1 ;ADJUST THE COUNT
CAIE T2,0 ;ARE THERE ANY CHARACTERS LEFT OVER?
ADDI T3,1 ;YES, INDICATE ONE MORE WORD IN THE ENTRY
STOR T3,HDRCNT ;STORE IT
RET ;AND RETURN
;LGOWD1 - ROUTINE TO MAKE WORD 1 OF A LOGOUT/CHECKPOINT ENTRY. IT
; CONTAINS THE ENTRY TYPE, JOB #, LINE #, AND WORD COUNT
; (ALWAYS 5).
LGOWD1: MOVE T1,SAVTYPE ;GET THE ENTRY TYPE
CAIE T1,2 ;IS THIS A COMPLETE SESSION?
SKIPA T1,[201] ;NO. HAVE TO MAKE A CHECKPOINT ENTRY
MOVEI T1,141 ;YES. HAVE TO MAKE A LOGOUT ENTRY
STOR T1,HDRTYP ;STORE IT
MOVE T1,SAVJOB ;GET THE JOB #
STOR T1,HDRJOB ;STORE IT
MOVE T1,SAVLIN ;GET THE LINE #
STOR T1,HDRLIN ;STORE IT
MOVEI T1,5 ;LENGTH OF ENTRY IS ALWAYS 5
STOR T1,HDRCNT ;STORE IT
RET ;DONE WITH FIRST WORD
;LGOWD2 - ROUTINE TO WORK ON WORD 2 OF LOGOUT/CHKPNT ENTRY, THE 36-BIT
; USER NUMBER
LGOWD2: MOVE T1,SAVUSR ;GET THE USER NUMBER USED IN LOGIN ENTRY
STOR T1,HDRUSR ;STORE IT
RET ;DONE WITH WORD 2, LOGOUT/CHKPNT
;LGOWD3 - ROUTINE TO MAKE LOGOUT/CHKPNT WORD 3. THE LOGOUT DATE/TIME IS IN RECORD 1
; OF THE USAGE FILE. HENCE IT WILL BE CONVERTED HERE BUT SAVED
; IN SAVLDT UNTIL THE LOGOUT OR CHECKPOINT ENTRY IS MADE.
LGOWD3: MOVE T1,USELDT ;GET LOGOUT DATE/TIME POINTER
CALL DATTIM ;CONVERT
MOVEM T2,SAVLDT ;SAVE IT FOR LATER
RET
;LGOWD4 - ROUTINE TO MAKE WORD 4 OF LOGOUT ENTRY, THE RUNTIME.
LGOWD4: MOVE T1,USERUN ;GET POINTER TO RUNTIME
MOVEI T2,LENRUN ;AND ITS LENGTH
CALL NUMDEC ;CONVERT IT
MOVEM T1,SAVRUN ;SAVE IT FOR NOW
RET ;AND RETURN
;LGOWD5 - ROUTINE TO MAKE WORD 5 OF LOGOUT ENTRY, THE CONSOLE
; TIME (IN MILLISECONDS).
LGOWD5: MOVE T1,USECON ;GET POINTER TO COSOLE CONNECT TIME
MOVEI T2,LENCON ;AND ITS LENGTH
CALL NUMDEC ;CONVERT THE NUMBER
IMULI T1,^D1000 ;CONVERT TO MILLISECONDS
STOR T1,LGOCON ;STORE IT
RET ;DONE WITH WORD 5, LOGOUT
SUBTTL COMMON SUBROUTINES
;SETRD - ROUTINE TO SET UP THE SIN JSYS BLOCK TO READ A USAGE FILE RECORD
;CALL: CALL SETRD
SETRD: HRRZ T1,USEJFN ;GET THE JFN FOR THE USAGE FILE
HRROI T2,USEBLK ;BLOCK TO BE READ INTO
MOVEI T3,^D128*5 ;MAXIMUM CHARACTERS TO BE READ
MOVEI T4,.CHLFD ;LINE FEED IS THE TERMINATING CHARACTER
SIN ;READ THE RECORD
ERJMP DONE ;ERROR. FINISH UP
RET
;NUMDEC - ROUTINE TO CONVERT AN ASCII NUMBER TO BINARY (RADIX 10)
;NUMOCT - ROUTINE TO CONVERT AN ASCII NUMBER TO BINARY (RADIX 8)
;CALL: MOVE T1,POINTER TO FIRST CHARACTER OF NUMBER IN USEBLK
; MOVE T2,LENGTH OF FIELD WHICH CONTAINS NUMBER
; CALL NUMDEC/NUMOCT
;RETURNS NUMBER IN T1
NUMDEC: SKIPA T4,[^D10] ;HERE IF THE BASE IS 10
NUMOCT: MOVEI T4,^D8 ;HERE IF THE BASE IS 8
STKVAR <PTR>
MOVEM T1,PTR ;SAVE POINTER
MOVEI T1,0 ;START WITH ZERO
NUMOC1: ILDB T3,PTR ;GET NEXT CHARACTER
IMUL T1,T4 ;ADJUST PLACE HOLDER
ADDI T1,-"0"(T3) ;CONVERT DIGIT
SOJG T2,NUMOC1 ;ADJUST CHARACTER COUNT
RET ;CONVERTED NUMBER IS IN T1
;USRNUM - ROUTINE TO GET A USER NUMBER WHEN GIVEN THE USER NAME IN A USAGE
; ENTRY
;CALL MOVE T1,POINTER TO USER NAME
USRNUM: MOVE T2,[POINT 7,TEMP] ;SET UP BYTE POINTER TO ASCIZ STRING
MOVEI T4,LENUSR ;GET LENGTH OF USER FIELD
USRNU1: ILDB T3,T1 ;GET A CHARACTER
CAIN T3," " ;HAVE WE READ THE WHOLE NAME?
JRST USRNU2 ;YES GO FIND THE USER NUMBER
IDPB T3,T2 ;MAKE AN ASCIZ STRING
SOJG T4,USRNU1 ;CONTINUE
USRNU2: MOVEI T3,.CHNUL ;MAKE A NULL BYTE
IDPB T3,T2 ;NOW IT'S AN ASCIZ STRING
MOVEI T1,0 ;DO RECOGNITION
HRROI T2,TEMP ;POINTER TO STRING
RCUSR ;GET THE USER NUMBER
TXNE T1,RC%NOM!RC%AMB ;DID WE GET THE USER NUMBER?
MOVEI T3,0 ;NO. SET TO ZERO
RET
;DATTIM - ROUTINE TO CONVERT YYYYMMDDHHMMSS FORMAT DATE/TIME TO INTERNAL
; DATE/TIME WORD
;CALL: MOVE T1,POINTER TO DATE/TIME IN USAGE RECORD
;RETURNS DATE/TIME IN T2
; T2 IS USED AS THE BYTE POINTER TO THE IDTIM ARGUMENT BLOCK
; T3 IS USED AS THE ADJUSTED BYTE POINTER TO THE USAGE DATE/TIME ITEMS
; T4 IS USED FOR THE DATA
; THE ARGUMENT STRING FOR THE IDTIM JSYS WILL HAVE THE FORMAT OF
; MM/DD/YY HHMM:SS<NULL>
DATTIM: MOVE T2,[POINT 7,TEMP] ;PICK UP BYTE POINTER TO THE ARGUMENT BLOCK
MOVEI T3,4 ;NEED TO PICK UP THE MONTH FIRST
ADJBP T3,T1 ;GET THE BYTE POINTER TO THE MONTH (MM)
ILDB T4,T3 ;GET THE FIRST CHARACTER
IDPB T4,T2 ;STORE FIRST CHARACTER
ILDB T4,T3
IDPB T4,T2 ;MONTH IS NOW STORED
MOVEI T4,SLASH ;INDICATE THE END OF THE MONTH FIELD
IDPB T4,T2
ILDB T4,T3 ;BYTE POINTER FOR DAY (DD) IS ALREADY SET
IDPB T4,T2
ILDB T4,T3 ;NOW GET THE SECOND CHARACTER
IDPB T4,T2 ;DATE IS NOW STORED
MOVEI T4,SLASH ;INDICATE THE END OF THE DAY FIELD
IDPB T4,T2
MOVEI T3,2 ;NOW GET THE BYTE POINTER FOR THE YEAR (YY)
ADJBP T3,T1
ILDB T4,T3 ;GET FIRST CHARACTER
IDPB T4,T2 ;STORE IT
ILDB T4,T3 ;GET THE SECOND
IDPB T4,T2 ;STORE IT
MOVEI T4,.CHTAB ;INDICATE THE END OF THE DATE FIELD (MM/DD/YY)
IDPB T4,T2 ; WITH A TAB
MOVEI T3,^D8 ;NOW MAKE A BYTE POINTER TO THE TIME (HHMMSS)
ADJBP T3,T1
ILDB T4,T3 ;FIRST GET THE HOUR (HH)
IDPB T4,T2
ILDB T4,T3
IDPB T4,T2 ;HOURS ARE DONE
ILDB T4,T3 ;NOW GET THE MINUTES (MM)
IDPB T4,T2
ILDB T4,T3
IDPB T4,T2 ;MINUTES ARE DONE
MOVEI T4,COLON ;INDICATE END OF HOUR-MINUTE FIELD (HHMM:)
IDPB T4,T2
ILDB T4,T3 ;NOW GET THE SECONDS
IDPB T4,T2
ILDB T4,T3
IDPB T4,T2 ;DONE WITH SECONDS (HHMM:SS)
MOVEI T4,.CHNUL ;TERMINATE STRING WITH A NULL
IDPB T4,T2 ;IDTIM ARGUMENT IS NOW BUILT
HRROI T1,TEMP ;SET UP FOR IDTIM JSYS
MOVEI T2,0
IDTIM
JRST [CALL XERSTR
MOVEI T2,0
RET] ;ERROR. REPORT AND SET DATE/TIME TO ZERO
RET ;RETURN
RET
;CLRTBL - ROUTINE TO ZERO FACT FILE ENTRY BUILDING TABLE, FACTBL.
CLRTBL: SETZM FACTBL
MOVE T1,[FACTBL,,FACTBL+1]
BLT T1,FACEND
RET
SUBTTL ERROR SUBROUTINES
;INERR - ROUTINE TO REPORT GTJFN ERROR OF INPUT FILE SPEC. WILL RETURN
; TO ASK FOR ANOTHER INPUT FILE NAME
;CALL INERR
INERR: HRROI T1,[ASCIZ /
?GTJFN failed: /] ;BEGIN ERROR REPORT
PSOUT
CALL XERSTR ;LET MONITOR DO THE REST
RET ;GO ASK FOR FILE NAME AGAIN
;OUTERR - ROUTINE TO REPORT GTJFN ERROR OF OUTPUT FILE SPEC. WILL
; RETURN TO ASK FOR ANOTHER OUTPUT FILE NAME
;CALL OUTERR
OUTERR: HRROI T1,[ASCIZ /
?GTJFN failed: /] ;BEGIN ERROR REPORT
PSOUT
CALL XERSTR ;LET MONITOR DO THE REST
RET ;GO ASK FOR FILE NAME AGAIN
;XERSTR - ROUTINE TO REPORT MOST RECENT ERROR. WILL ALWAYS RETURN TO THE
; CALLER
;CALL XERSTR
XERSTR: JSERR ;REPORT THE ERROR
RET ;RETURN
SUBTTL MISCELLANEOUS STORAGE
PDL: BLOCK PDLLEN ;STACK POINTER
USEJFN: 0 ;USAGE FILE JFN (INPUT)
FCTJFN: 0 ;FACT FILE JFN (OUTPUT)
USEBLK: BLOCK ^D128 ;STORAGE FOR A USAGE FILE RECORD
FACTBL: BLOCK 40 ;STORAGE FOR FACT FILE ENTRY
FACEND: 0 ;SIGNIFIES END OF FACT ENTRY BLOCK (USED FOR BLT'S)
SAVTYP: 0 ;USAGE ENTRY TYPE
SAVJOB: 0 ;JOB NUMBER
SAVLIN: 0 ;LINE NUMBER
SAVBDT: 0 ;LOGIN DATE/TIME FOR SESSION ENTRY
SAVLDT: 0 ;LOGOUT/CHKPNT DATE/TIME FOR SESSION ENTRY
SAVDAT: 0 ;DATE/TIME SAVED FOR DISK UTILIZATION ENTRIES
SAVRUN: 0 ;LOGOUT/CHKPNT RUN TIME
SAVUSR: 0 ;36-BIT USER NUMBER
FLGDSK: 0 ;USED TO KEEP TRACK IF DISK UTILIZATION ENTRIES
;ARE BEING WORKED ON SINCE FACT FILES HAVE ONE
;BEGINNING ENTRY FOR EVERY SET OF DISK UTILIZATION
;ENTRIES. THIS WORD IS ZEROED WHENEVER SOMETHING
;OTHER THAN DISK ENTRIES ARE BEING WORKED ON.
USEJTB: GJ%OLD!GJ%CFM
.PRIIN,,.PRIOU
0
0
POINT 7,[ASCIZ /USAGE/]
POINT 7,[ASCIZ /OUT/]
0
0
0
FCTJTB: GJ%FOU
.PRIIN,,.PRIOU
0
0
POINT 7,[ASCIZ /FACT/]
POINT 7,[ASCIZ /BIN/]
0
0
0
USEFIL: [ASCIZ /USAGE/] ;DEFAULT INPUT FILE NAME
USEEXT: [ASCIZ /OUT/] ;DEFAULT INPUT EXTENSION
FCTFIL: [ASCIZ /FACT/] ;DEFAULT OUTPUT FILE NAME
FCTEXT: [ASCIZ /BIN/] ;DEFAULT OUTPUT EXTENSION
TEMP: BLOCK 21 ;USED TO SET UP ASCIZ STRINGS FOR JSYS'S
END START