*15:19  09/28/70       TIME OF UPDATE                                   U:LO0001
         PCC      0
         PSR      0
         TITLE    'UTS LOGON/LOGOFF - VERSION A00'                      U:LO0004
*
*
*        UTS LOGON/LOGOFF - VERSION A00                                 U:LO0006
*
*
         PAGE
***********************************************************************
*                                                                     *
*        TO RUN ON-LINE UNDER BTM, SET 'FORBTM' TO A 1 AND            *
*            SET 'BTMACCN' EQUAL TO AN 8-CHARACTER TEXT               *
*            STRING CONTAINING THE ACCOUNT.                           *
*        TO ASSEMBLE FOR UTS, SET 'FORBTM' TO A 0                     *
*                                                                     *
***********************************************************************
FORBTM   EQU      0                 SET FOR BTM
FORUTS   EQU      1-FORBTM          SET FOR UTS
FORSEC   EQU      0                 SET TO 1 FOR ELAP TIME IN MIN AND SEC
         DO       FORBTM
BTMACCN  EQU      'C64003'
         FIN
         SYSTEM   SIG7FDP
         PAGE
*
*        SEND MESSAGE TO OPERATOR (USES R2, SR4)
*
SEND     CNAME
         PROC
LF       RES      0
I        DO       NUM(AF)
         LI,R2    AF(I)
         DO       FORUTS
         CAL1,2   SENDOPMS
         ELSE
         LB,SR4   AF(I)
         CAL1,1   FAKEOPMS
         FIN
         FIN
         PEND
*
*        SEND MESSAGE TO TERMINAL USER (USES R2, R3)
*
TYPES    CNAME    0
TYPE     CNAME    1
         PROC
LF       RES      0
I        DO       NUM(AF)
         LI,R2    AF(I)
         DO       NAME
         LB,R3    AF(I)
         CAL1,1   ERIDMSG
         ELSE
         CAL1,1   ERIDMSGS
         FIN
         FIN
         PEND
         PAGE
*
*        PROC TO SET UP ERROR CODE MESSAGE (USES R2, R4)
*
SETERROR CNAME
         PROC
LF       RES      0
         DO1      AF(1)~=R2
         LW,R2    AF(1)
         BAL,SR4  BIN2HEX
         LI,R2    '='
         STB,R2   R4
         STW,R4   ERRCODEM+3
         PEND
*
*        PROC TO GENERATE TEXTC CODE WITHOUT LISTING HEX
*
TXTC     CNAME
         PROC
         DISP     %
         LIST     0
LF       TEXTC    AF
         LIST     1
         PEND
         PAGE
         REF      SENDOPMS
         REF      TIMEVERT
         REF      M:EO                                                  U:LO0008
         DO       FORUTS                                                U:LO0010
         REF      M:UC
         FIN
         DO       FORBTM
         REF      M:SO
M:UC     EQU      M:SO
         REF      EXITOFF
         REF      EXITON
         REF      FAKEOPMS
         FIN
         REF      JACCN
         REF      JUNAME
         REF      J:ABUF
         REF      ACCOUNT
         REF      JTELFLGS
         REF      JSTDOPT
         REF      ACCNTSUM
         REF      RATEFLAG
         REF      J:CCBUF
         REF      J:JIT
         REF      S:OUIS
         REF      S:GUIS
         REF      S:GJOBTBL
         REF      MAXG
         REF      SB:GJOBUN
         REF      S:GJOBACN
         REF      DOUBLEZERO
         REF      J:EUP
         REF      JEUPVP
         REF      JRNST
         REF      JCPPO
         REF      M:X1
         REF      JABC
         REF,1    JB:PRIV
         REF,1    JB:LC
         REF,1    JB:LPP
         REF      RECORD
         REF      OPMES
         REF      LISTLOC
         REF      RECSIZE
         REF      TIMBUF
         REF      UNME
         REF      UACCOUNT
         REF      UPASSWD
         REF      KEYBUFF
         REF      ERRTRY
         REF      BIN2HEX
         REF      ERRCODEM
         REF      TIMBUF1           LOGON TIME IN MINS. FROM ACCTSUM
         REF      J:XP
         REF      MPPO
         REF      MPO
         REF      MDPO
         REF      MUPO
         REF,1    JB:NFPOOL
         REF      J:ASSIGN
         REF      PRDCRM,PRDPRM,TMDCRM,TMDPRM
         REF      TMPDCPK,TMPDPPK
         REF      UEXTACC
         REF      M:LL
         REF      SV:RSIZ,SH:RNM
         REF      JB:MAX
         REF      SV:LIM,SL:NAME
         REF      SV:FTYM,SH:SYMT
         REF,2    JH:LDCF
         REF      J:AMR
         DEF      SECTION1
         DEF      P:JIT
LIST     EQU      LISTLOC
UC       EQU      M:UC
M:LOG    EQU      M:EO                                                  U:LO0014
M:RATE   EQU      M:EO                                                  U:LO0015
SYSACCNT EQU      ':SYS    '
SYSUNAME EQU      'LBE         '
         PAGE
* SYMBOLIC REGISTER DEFINITIONS
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R5       EQU      5
R6       EQU      6
R7       EQU      7
SR1      EQU      8
SR2      EQU      9
SR3      EQU      10
SR4      EQU      11
D1       EQU      12
D2       EQU      13
D3       EQU      14
D4       EQU      15
* DISPLACEMENT VALUES FOR LOGIN RECORD
LR:ACC   EQU      0                 ACCOUNT
LR:USR   EQU      2                 USER NAME
LR:FG    EQU      5                 READ
LR:PW    EQU      6                 PASSWORD
LR:CPP   EQU      8                 AUTO-CALL PASSWORD
LR:CPA   EQU      10                AUTO-CALL ACCOUNT
LR:CPN   EQU      12                AUTO-CALL PROCESSOR LMN NAME
LR:BIL   EQU      15                BATCH,ON-LINE,GHOST BILLING
LR:PRIV  EQU      16                BATCH,ON-LINE,GHOST PRIVILEGE
LR:ARAD  EQU      18                ACCU. PERM RAD SPACE
LR:DMR   EQU      20                DEF AND MAX FILE RETENTION PERIODS
LR:ADIS  EQU      22                ACCU PERM DISK SPACE
LR:EACCT EQU      24                EXTENDED ACCOUNTING INFORMATION
LR:UNML  EQU      30                USER LIMIT SPECIFICATION TABLE (HALFWORD)
LR:UOML  EQU      62                ON-LINE LIMIT
LR:UGML  EQU      78                GHOST LIMIT
LR:UNMR  EQU      94                RESOURCE NAME TABLE(HALFWORD)
LR:UOMR  EQU      106               ON-LINE RESOURCE VALUE(BYTE)
LR:UGMR  EQU      110               GHOST RESOURCE VALUE(BYTE)
LR:UNMP  EQU      114               PERIPHERAL NAME TABLE(HALFWORD)
LR:UPFLG EQU      122               ON-LINE PERIPHERAL AUTHORIZATION(BYTE)
LMTSZE   EQU      15                SIZE OF LIMIT TABLES IN :USERS RECORD
ARS      EQU      UC+4              ACTUAL RECORD SIZE OF LAST RECORD READ
LOGRECSZ EQU      126               LOGON RECORD SIZE(NOW EXPANDED)
TRYERR   EQU      5                 ERROR RETRY COUNT
         REF      COCLN             FOR LINE NUMBER
DCBER    EQU      3                 ERROR RETURN POINTER IN DCB
DCBAR    EQU      4                 ABNORMAL RETURN POINTER IN DCB
P:JIT    EQU      J:JIT             FOR DISPLAY
         PAGE
THISISIT CSECT    1
SECTION1 RES      0
         BOUND    8
TXLOGON  TEXTC    'LOGON'
SLAVE    GEN,8,4,20   0,12,LOGON:COC
         DATA         0             ****LOGON'S RETURN TO SLAVE MODE**
MASTER   GEN,8,24    8,0
NEWLINE  DATA     X'01150000'       NEW LINE MESSAGE
YFFFE    DATA     X'FFFE0000'
Y03      DATA     X'03000000'
XFFFF    DATA     X'FFFF'
TEL      TXTC     'TEL'
SYS      TEXT     SYSACCNT
SYSUSR   TEXT     SYSUNAME
BLANKS   TEXT     '    '
TIMKWD   TEXT     'TIME'
ERID     TXTC     'ID?'
ERAC     TXTC     'ACCOUNT?'
EREXT    TXTC     'EXT. ACNT. LEFT OR RIGHT PAREN. MISSING'
PASSWORD TXTC     'PASSWORD '
NAMACT   TXTC     'ACCOUNT/ID '                                         U:LO0017
IDMSG    TXTC     'LOGON PLEASE: '
SORRY   TXTC     'SORRY, UNABLE TO LOG YOU ON ' LAST BYTE IS EOT
TIM      TXTC     'XEROX CP-V AT YOUR SERVICE'
ONATM    TXTC     'ON AT '
DOWN     TXTC     'UNRECOVERABLE I/O ON RAD'
NOTHERE  TXTC     'ABNORMAL ERROR ON LOGON FILE'
SLASH    TXTC     '/'
QUEST    TXTC     '?'
MAILMSG  TXTC     'CHECK DC/MAILBOX'
RDLOGONM TXTC     'UNRECOVERABLE ERROR READING USERS FILE'
         DO       FORBTM
TIMEMSG  TXTC     '12:00 JUN 03,''70'
         FIN
ARFMSG   TXTC     'UNABLE TO ACCESS RATE FILE'
RRFMSG   TXTC     'UNABLE TO READ RATE FILE'
OPNRFMSG TXTC     'UNABLE TO OPEN RATE FILE'
FILEXMSG TXTC     'FILE STORAGE LIMIT EXCEEDED(RAD)'
PACKXMSG TXTC     'FILE STORAGE LIMIT EXCEEDED(PACK)'
LOFFMSG  TXTC     'BARRED BY INSTALLATION,SEE SOMEBODY'
AMERRMSG TXTC     'UNABLE TO WRITE ASSIGN-MERGE RECORD'
*     ASSIGN/MERGE TABLE IMAGE
         CSECT    0                 DATA AREA
MERTAB   EQU      %
         DATA     22                INDEX TO AVAILABLE AREA
         DO1      8
         DATA     0
         DO1      3                 USER NAME (3 WDS)
         DATA     X'40404040'
         DATA     0                 LOGON TIME
         DATA     0                 BILLING TIME
         DO1      6                 EXT. ACCNT. FIELD (6 WDS)
         DATA     X'40404040'
         LIST     0
         DO1      492
         DATA     0
         LIST     1
*  THIS PROCESSOR CONTAINS THE TWO ROUTINES: LOG-ON AND LOG-OFF.
*  LOG-ON INITIALLY RECEIVES A USER REQUEST FOR SERVICE, ACCEPTS HIS
*  IDENTIFYING DATA, TESTS FOR A LEGAL ACCOUNT AND REJECTS HIS REQUEST
*  IF HE IS NOT AN AUTHORIZED USER. IF HE IS A VALID USER, HE IS
*  SERVICED BY CALLING TEL, OR, IF PREVIOUSLY SPECIFIED, ANOTHER USER
*  ASSOCIATED PROCESSOR.
*  THE LOG-OFF ROUTINE IS CHARGED WITH THE CLEAN-UP WHEN A USER HAS
*  COMPLETED A SESSION. IT WILL RELEASE TEMPORARY FILES, INITIATE THE
*  I/O RUNDOWN PROCESS AND PERFORM THE USER ACCOUNTING FUNCTION.
*
*  FOR THE LOG-ON PROCESS, ENTRY IS FROM THE MONITOR AS A RESULT OF A
*  TERMINAL ACTION. A SKELETAL JIT IS PROVIDED WITH THE USER NUMBER AS
*  SYSID.
         USECT    THISISIT          RESUME PT 1
LOGON    RES      0
         DO       FORUTS
         CAL1,8   TIMER
         DO1      FORSEC
         BAL,SR4  TIMEVERT
         ELSE
         LI,D2    BA(TIMBUF)        SIMULATE M:TIME CAL
         LB,D1    TIMEMSG
         STB,D1   D2
         LI,D1    BA(TIMEMSG)
         MBS,D1   1
         FIN
         LC       J:JIT             CHECK FOR GHOST MODE
         BCS,4    GHST              B/YES , SEE IF NON-COC USER
         LW,R4    J:JIT+JACCN       NO, GET ACCOUNT FIELD
         BNEZ     LOGOFF            REGULAR USER LOGGING OFF
         B        LOGON:COC         REGULAR USER LOGGING ON
*   MUST BE GHOST- SEE IF NON-COC USER LOGGING ON, OR GHOST LOGOFF
GHST     EQU      %
         LH,R1    M:UC              IF UC IS OPEN/HAS BEEN OPEN , HE IS
         CI,R1    X'60'             ....LOGGING OFF
         BANZ     LOGOFF            B/ M:UC IS OPEN
         LI,R1    X'FFFF'           MASK TO PICK UP DEVICE NAME
         AND,R1   M:UC+1            DEVICE NAME (UC,MC,ETC...)
         CI,R1    'UC'              IF UC, THIS IS NOT A NON-COC USER
         BE       LOGOFF            LOG OFF REGULAR GHOST
         LCFI     10                MAKE THIS FLAG
         STCF     J:JIT             FOR THE 'NON COC' USER
         CAL1,1   SETRES            SET ERR/ABN FOR IMPLICIT OPEN
         CAL1,6   MASTER            GO MASTER MODE TO CHANGE LOW CORE
         MTW,1    S:OUIS            BUMP ONLINE USERS IN SYSTEM
         MTW,-1   S:GUIS            DECREMENT GHOSTS IN SYSTEM
         LI,R1    MAXG              MAX LENGTH OF GHOST TABLES
         LD,R2    TXLOGON           OUR NAME IN TEXTC
         CD,R2    S:GJOBTBL,R1      FIND LOGON'S POSITION IN TABLES
         BE       RGHST             GOTCHA
         BDR,R1   %-2
         B        LOGON:COC         ******WEIRD*******
RGHST    EQU      %
         LD,R2    DOUBLEZERO
         STD,R2   S:GJOBTBL,R1      BLAST LOGON OUT OF THE GHOST TABLES
         STB,R2   SB:GJOBUN,R1      CLEAR USER NUMBER
         STD,R2   S:GJOBACN,R1      CLEAR LOGON'S ACCOUNT NUMBER
         LI,R1    JEUPVP            LOWER USER'S VIRTUAL
         STW,R1   J:EUP             TOP ADDRESS BELOW TEL.....
         LPSD,0   SLAVE             GOSLAVE AGAIN...
LOGON:COC EQU     %
         STW,SR1  MERTAB+8          SAVE DATE FOR A / M TABLE
         CAL1,8   WAIT5
         TYPE     NEWLINE,TIM,NEWLINE,ONATM
         LI,R3    16                PRINT TIME
         TYPES    TIMBUF
         DO1      FORSEC=0
         BAL,SR4  TIMEVERT
INQUIRE  RES      0
         LI,R2    0                 CLEAR TO ZERO WORKING STORAGE
         LI,R3    JB:LPP+1          SET LINE INDICATOR IN JIT TO TOP
         STB,R2   0,R3                 OF PAGE
         LI,R3    JB:LPP            DISABLE PAGE EJECT
         STB,R2   0,R3
         LI,R3    RECSIZE
         STW,R2     RECORD,R3
         BDR,R3   %-1
         LW,R2    BLANKS
         LW,R4    BLANKS
         LW,R3    BLANKS
         LCI      3
         STM,R2   JUNAME+J:JIT
         STM,R2   ACCOUNT           SAVE USER NAME
         LCI      2
         STM,R2   J:JIT+JACCN
         TYPE     NEWLINE,IDMSG
         CAL1,1   INMSG             READ RESPONSE
         LW,R3    ARS               PICK-UP INPUT BYTE COUNT
         SLS,R3   -17               AND FIX IT AS COUNT IN R3
         BAL,SR4  PARSE             PARSE THE INPUT USER ID
*
* CONCATINATE ACCOUNT AND NAME FOR KEYED READ OF LOGIN FILE
*
         LI,R2    UACCOUNT
         LI,R3    KEYBUFF
         LI,R4    0                 MAINTAINS BYTE COUNT
         LI,R7    8                 PUT IN LIMIT FOR ACCOUNT
         BAL,SR4  CONCAT            DO ACCOUNT
         LI,R2    UNME
         LI,R7    12                PUT IN LIMIT FOR NAME
         LI,R5    X'40'
         AI,R4    1
         STB,R5   *R3,R4            INSERT BLANK AFTER ACCT
         BAL,SR4  CONCAT            ADD NAME
         STB,R4   *R3               ADD BYTE COUNT TO KEY
         LCI      2
         LM,D3    SECAT             PROVIDE SPECIAL ACCOUNT
         XW,D3    J:JIT+JACCN
         XW,D4    J:JIT+JACCN+1
OPENIT   CAL1,1   OPNLOGON          ATTEMPT TO OPEN LOGIN FILE
         CAL1,1   LOGFILE           KEYREAD THE LOGIN FILE
         CAL1,1   CLOSE             CLOSE FILE
         LCI      2
         STM,D3   J:JIT+JACCN       RESTORE USERS ACCOUNT
*
*  CHECK IF ACCOUNT IS VALID
*
         CW,D3    RECORD
         BNE      BUMMER1
         CW,D4    RECORD+1
         BNE      BUMMER1
*
* PERFORM VALIDITY TEST ON SUPPLIED PASSWORD
*
         LW,R2    LR:PW+RECORD
         CW,R2    UPASSWD
         BNE      NOACCESS          FIRST WORD DOES'NT MATCH
         LW,R3    LR:PW+1+RECORD
         CW,R3    UPASSWD+1
         BNE      NOACCESS          SECOND WORD DOES'NT MATCH
LOGIT    RES      0
         LW,R2    UEXTACC           USE EXT. ACCTG. SPEC. AT LOGON TIME
         CW,R2    BLANKS            ANY SPECIFIED?
         BNE      LOGIT10           YES
         LI,R3    -6                NO, USE EXT. ACCTG. FROM :USERS RECORD
LOGIT5   RES      0
         LW,R2    RECORD+LR:EACCT+6,R3
         BEZ      LOGIT10
         STW,R2   UEXTACC+6,R3
         BIR,R3   LOGIT5
LOGIT10  RES      0
         LW,R2    M:UC+COCLN        LOAD LINE NUMBER
         BAL,SR4  BIN2HEX           CONVERT IT TO HEX
         LI,R3    1
         LC       J:JIT             IS THE RAS USER
         BCR,2    %+2               NO
         LI,R4    'MC'              YEP FLAG HIM
         STH,R4   OPMES+1,R3         PUT LINE NUMBER INTO MESSAGE TEXT
         LI,R1    0
COMPRS   LB,R2    J:JIT+JACCN,R1    GET ACCOUNT FROM JIT                U:LO0019
         CI,R2    ' '               WAS END OF NAME REACHED
         BE       NEXT              YES; GO GET ACCOUNT,OTHERWISE
         STB,R2   OPMES+2,R3        PUT NAME INTO OPMES
         AI,R3    1                 INCREMENT MESSAGE POINTE
         AI,R1    1                 INCREMENT JIT POINTER
         CI,R1    8                 HAS END OF ACCOUNT BEEN REACHED     U:LO0021
         BL       COMPRS            NO;
NEXT     LI,R2    ','
         STB,R2   OPMES+2,R3        PUT A COMMA INTO MESSAGE AFTER NAME
         AI,R3    1                 INCREMENT MESSAGE POINTER
         LI,R1    0                 LOAD JIT POINTER
NEXLOOP  LB,R2    ACCOUNT,R1        GET USER NAME                       U:LO0023
         CI,R2    ' '               HAS END OF ACCOUNT BEEN REACHED
         BE       OUT1              YES;
         STB,R2   OPMES+2,R3        PUT ACCOUNT INTO MESSAGE
         AI,R3    1                 INCREMENT MESSAGE POINTER
         AI,R1    1                 INCREMENT JIT POINTER
         CI,R1    12                HAS END OF NAME BEEN REACHED        U:LO0025
         BL       NEXLOOP           NO;
OUT1     AI,R3    7                 YES;
         STB,R3   OPMES             STORE BYTE COUNT INTO MESSAGE
         SEND     OPMES             SEND MESSAGE TO OPERATOR
         LI,R2    X'100'            ENABLE DIAGNOSTIC OUTPUT FOR USER   U:LO0027
         STW,R2   J:JIT+JSTDOPT
**CLEAR J:ABUF AND J:TELFLGS IN JIT
         LI,R2    0                 CLEAR J:ABUF AND JTELFLGS IN JIT    U:LO0029
         STW,R2   J:ABUF
         STW,R2   J:JIT+JTELFLGS
**PRIVILEGE
         LI,R3    BA(RECORD+LR:PRIV)+1
         LB,R2    0,R3
         CI,R2    0                 DOES THE BYTE HAVE SOMETHING IN IT
         BE       OUT3              NO.
         LI,R3    JB:PRIV
         STB,R2   0,R3              STORE PRIVELEGE INTO JIT
**FILE READ ('ALL'=0 , 'NONE'=1)
OUT3     LW,R2    RECORD+LR:FG      GET THE DESIRED RECORD
         CW,R2    =X'80000000'
         BAZ      %+3               OPTION BIT NOT SET(IE READ ALL)
         LW,R3    =X'10000000'
         STS,R3   J:ASSIGN          SET BIT 3 IN J:ASSIGN(READ NONE)
**TRANS. PROCESSOR(TP),EXEC. ONLY(XOS),RESTR. PROCESSOR(RP),SECURITY(SE)
         REF      JPUF
         LI,R3    X'10'
         STS,R2   J:JIT+JPUF        SET TP FLG  10
*
         LI,R3    2                 IF SECURITY BIT SET
         AND,R3   R2
         BEZ      OUT3A
         LI,R1    JB:PRIV           SET BIT 2 IN JB:PRIV
         LB,R6    0,R1
         OR,R6    R3
         STB,R6   0,R1
OUT3A    EQU      %
         SLS,R2   22                STORE X0S AND RP BITS INTO JIT
         LW,R3    Y03
         STS,R2   J:ASSIGN
**FILE RETENTION PERIODS
**** NONE--0(DEFAULT), NEVER--FFFF
         LH,R2    RECORD+LR:DMR     GET DEF. RETN. PERIOD
         BEZ      %+2               IF ZERO,USE DEFAULT IN JIT
         STH,R2   J:XP              STORE INTO JIT
         LI,R3    1
         LH,R2    RECORD+LR:DMR,R3  GET MAX. RETN. PERIOD
         BEZ      OUT4              USE DEFAULT
         STH,R2   J:XP,R3           STORE INTO JIT
**FILE EXTENSION BITS
OUT4     LI,R2    X'1FFFF'
         STW,R2   J:JIT+JCPPO       STORE FILE EXT
**RESOURCE
         LI,R1    SV:RSIZ           GET RESOURCE LIMIT TABLE SIZE
OUT5A    LH,R2    SH:RNM,R1         GET RESOURCE NAME
         BEZ      OUT5F             IF ZERO GET NEXT
         LI,R3    LMTSZE
OUT5B    CH,R2    RECORD+LR:UNMR,R3 WAS RESOURCE FOUND IN :USERS RECORD
         BNE      OUT5C             NO
         LB,R6    RECORD+LR:UOMR,R3  GET :USERS VALUE
         B        OUT5E
OUT5C    BDR,R3   OUT5B
         LB,R6    JB:MAX,R1         NO, USE SYSTEM DEFAULT
OUT5D    AND,R2   XFFFF             IF RESOURCE='CO', CHANGE TO PAGES
         CI,R2    'CO'
         BNE      OUT5E
         AW,R6    R6
OUT5E    STB,R6   JB:MAX,R1         STORE MAX FOR THIS RESOURCE
OUT5F    BDR,R1   OUT5A
**SERVICE
         LI,R1    SV:LIM            GET SERVICE LIMIT TABLE SIZE
OUT6A    LW,R2    SL:NAME,R1        GET SERVICE LIMIT NAME
         LI,R3    LMTSZE
OUT6B    CW,R2    RECORD+LR:UNML,R3 WAS LIMIT FOUND IN :USERS RECORD
         BE       OUT6C             YES
         BDR,R3   OUT6B
         B        OUT6F             NOT FOUND
OUT6C    LW,R6    RECORD+LR:UOML,R3 GET :USERS VALUE
OUT6E    CW,R2    TIMKWD            IGNORE 'TIME' AS N/A TO ON-LINE USER
         BE       OUT6F
         LI,R5    J:JIT
         LW,R2    LIMINFO,R1        GET STORAGE INFO.
         LB,R4    R2                SHIFT VALUE AND RESOLUTION
         SCS,R6   0,R4              VALUE TO PROPER FIELD WITHIN JIT WORD
         SLS,R4   -6                RESOLUTION
         LI,R7    -1                LOAD PROPER MASK
         CI,R1    LIMINFOA
         BGE      %+2
         LW,R7    YFFFE
         EXU      LIMSTORE,R4       STORE IT
OUT6F    BDR,R1   OUT6A             GO GET NEXT LIMIT NAME
**PERM RAD SPACE RMNG = PERM RAD SPACE LIMIT - ACCU PERM RAD SPACE
         LW,R2    J:JIT+PRDCRM      GET LIMIT FROM JIT
         SW,R2    RECORD+LR:ARAD    GET ACCU. RAD SPACE FROM :USERS
         BGEZ     OUT8
         TYPE     NEWLINE,FILEXMSG,NEWLINE
         LI,R2    0                 MINUS ACCU. SET=0
OUT8     STW,R2   J:JIT+PRDCRM
**PERM PACK SPACE RMNG = PERM PACK LIMIT - ACCU. PERM PACK SPACE
         LW,R2    J:JIT+PRDPRM      GET LIMIT FROM JIT
         SW,R2    RECORD+LR:ADIS    GET ACCU. PACK SPACE FROM :USERS
         BGEZ     OUT9
         TYPE     NEWLINE,PACKXMSG,NEWLINE
         LI,R2    0                 MINUS ACCU. SET=0
OUT9     STW,R2   J:JIT+PRDPRM
**LOGICAL DEVICE CONTROL FLAGS
         LI,R7    1                 SET LOGICAL DEVICE CONTROL FLAGS
         LI,R4    RECORD+LR:UNMP
         LI,R5    RECORD+LR:UPFLG
         BAL,SR4  SETLDCF
*
* RELEASE THE LOGIN DCB AND EXIT.
*
CLEANUP  RES      0
         CAL1,1   OPNMAIL           OPEN 'MAILBOX' TO SEE IF THERES MAIL
         CAL1,1   CLSMAIL           IT'S THERE. CLOSE 'MAILBOX'
RETREQ   TYPE     NEWLINE,MAILMSG,NEWLINE   NOTIFY USER
*
* PERFORM AUTO-CALL LOGIC
*
AUTOCALL LW,R6    LR:CPN+RECORD     AUTO-CALL PROCESSOR
         BNEZ     AUTOEXIT          YES
         LW,R6    TEL               CALL TEL PROCESSOR
         LW,R7    BLANKS
         LW,SR1   BLANKS
         LCI      2                 SYSTEM
         LM,D2    SYS               ACCOUNT
         LI,R5    J:JIT
         B        WRITEAMR
AUTOEXIT LW,R7    LR:CPN+1+RECORD   PICK UP 2ND WD PROC NAME
         LW,SR1   LR:CPN+2+RECORD   PICK UP 3RD WD PROC NAME
         LCI      2
         LM,D2    LR:CPA+RECORD     PICK UP ACCT OF PROC
         LM,SR3   LR:CPP+RECORD     PICK UP PROC PASSWD
         LCI      3
         STM,R6   J:CCBUF
         LI,R0    ' '
         STB,R0   J:CCBUF
*NOW THAT ALL NEC. INFO. IN LOG REC PROCESSED,
*PREPARE AND WRITE THE ASSIGN-MERGE RECORD
*
WRITEAMR RES      0
*
         LI,R3    -3
AM1      LW,R2    UNME+3,R3         STORE USER NAME FROM UNME
         STW,R2   MERTAB+12,R3        TO A-M RECORD
         BIR,R3   AM1
*
*LOGON DATE ALREADY STORE INTO A-M IMAGE AFTER THE TIME CALL
*
         LW,R2    TIMBUF1           STORE LOGON TIME FROM ACCTSUM
         STW,R2   MERTAB+12           TO A-M RECORD
*
         LI,R3    BA(RECORD+LR:BIL)+1  GET RATE STRUCTURE FROM LOG REC
         LB,R2    0,R3
         BEZ      %+2
         STH,R2   MERTAB+13         INTO A-M REC(LEFT HALFWD)
*
         LI,R3    1
         LH,R2    J:JIT,R3          GET SID
         STH,R2   MERTAB+13,R3      INTO A-M REC(RIGHT HALFWD)
*
         LI,R3    -6
AM2      LW,R2    UEXTACC+6,R3
         STW,R2   MERTAB+20,R3      STORE EXT. ACC. INFO.(USER SUPPLIED)
         BIR,R3   AM2                 INTO A-M RECORD
*
         LW,R2    J:JIT+PRDCRM      PERM RAD SPACE RMNG AT LOGON
         STW,R2   MERTAB+20
*
         LW,R2    J:JIT+PRDPRM      PERM PACK SPACE RMNG AT LOGON
         STW,R2   MERTAB+21
*
         DO1      FORUTS
*  NOW THAT AUTHOZN. CHECKS ARE MADE,EXIT TO THE INSTALLATION JOB
*   INITIATION ROUTINE VIA REG. 15
*  REG.3 CONTAINS THE ADDRESS OF IMAGE OF LOGON REC. AND REG.5 THAT
*   OF JIT.   THE INSTALLATION CAN THEN POLICE THE JOB AND /OR
*   MODIFY THE JIT
* UPON RETURN, IF REG.3 SET TO 0, THE JOB WILL BE AUTO. LOGGED OFF
*  REG.S EXCEPT 3 ARE EXPECTED TO BE INTACT
*
         SREF     M:ACINIT
         LI,D4    M:ACINIT
         BEZ      EVTHNOK
         LI,R3    RECORD
         LI,R5    J:JIT
         BAL,D4   *D4
         CI,R3    0
         BNE      EVTHNOK
         TYPE     NEWLINE,LOFFMSG,NEWLINE
         B        LOGOFF
EVTHNOK  EQU      %
         LI,D4    AMWERR
         CAL1,1   SETEABN           SET ERROR/ABNORMAL ADDRESSES
         CAL1,1   AMR               WRITE A-M REC
         LI,R0    0
         STB,R0   J:JIT+JRNST       INSURE ERROR CELLS ARE NULL
         STB,R0   J:JIT+JABC
         LI,R0    54                DEFAULT LINES/PAGE
         LI,R1    JB:LPP            SET UP JIT FOR TOP OF PAGING BY
         STB,R0   0,R1
         LI,R1    JB:LC
         AI,R0    1
         STB,R0   0,R1
         LCI      3                 PUT USER NAME INTO JIT SO LOGOFF
         LM,R0    ACCOUNT              WILL KNOW THE USER IS VALID
         STM,R0   J:JIT+JUNAME
         LI,R0    0                 SET UP FOR AUTO-CALL                U:LO0031
         CAL1,1   NOMSG             SET M:UC BTD TO ZERO FOR TEL
         LI,R1    JB:LPP            BA(LINES/PAGE)
         STB,R0   0,R1              STOP FURTHER PAGE HEADINGS(PLATEN,0)
         DO1      FORUTS
         CAL1,9   1                 INTERPRETIVE EXIT
         DO       FORBTM
         B        EXITON            EXIT TO INTERFACE PROGRAM IF BTM
         FIN
         PAGE
*
* A SYNTAX ERROR HAS BEEN FOUND IN USER INPUT.
*
SYNTAXA  BAL,SR4  TRIES             NO USER NAME PROVIDED-CHECK TRIES
         TYPE     ERAC              SEND 'ACCOUNT?' MESSAGE             U:LO0033
         B        SYNPRINT
SYNTAX   RES      0                 GARBLED MSG-TOO MANY CHARACTERS
         BAL,SR4  TRIES             SEE IF TOO MANY TRIES
         LW,R2    ARS
         SLS,R2   -17               GET THE ACTUAL RECORD SIZE
         CAL1,1   ECHOWTE           SEND MESSAGE BACK TO USER
         B        ACT1
SYNTAXB  BAL,SR4  TRIES             NO USER ACCOUNT PROVIDED
         TYPE     ERID              SEND 'ID?' MESSAGE                  U:LO0035
         B        SYNPRINT
SYNTAXC  BAL,SR4  TRIES             EXTENDED ACC. INFO. ERROR
         TYPE     EREXT             SEND 'EXTENDED ACCOUNTING?'
SYNPRINT RES      0
         LI,R3    0
         STW,R3   M:LOG+DCBER       ZERO ANY ERR/ABN WORDS              U:LO0037
         STW,R3   M:LOG+DCBAR                                           U:LO0039
         B        INQUIRE           RETRY LOG-ON
*
* MAINTAIN AND TEST THE RETRY COUNT.
*
TRIES    LW,R2    ERRTRY            PICK-UP ACCUMULATED RETRY COUNT
         AI,R2    1                 KICK IT UP
         STW,R2   ERRTRY            SAVE IT
         CI,R2    TRYERR            AND TEST FOR LIMIT
         BL       *SR4              NOT REACHED
TRIES1   RES      0
         LI,R3    0
         STW,R3   M:LOG+DCBER       ZERO ANY ERR/ABN WORDS              U:LO0041
         STW,R3   M:LOG+DCBAR                                           U:LO0043
         TYPE     NEWLINE,SORRY
         LI,R6    0                 CLEAR FOR EXIT CAL
         DO       FORUTS
         CAL1,9   1                 DITCH USER - HE BLEW IT
         ELSE
         B        EXITOFF
         FIN
*
* PUT OUT INVALID PASSWORD MESSAGE
*
NOACCESS BAL,SR4  TRIES
         TYPE     PASSWORD
ACT1     RES      0
         TYPE     QUEST
         B        SYNPRINT
         PAGE
************************************************************************
* THE FOLLOWING IS ENTERED AS A RESULT OF AN I/O ERROR DURING THE READ
* OF THE LOGIN FILE. THE CURRENT IMPLEMENTATION NOTIFIES THE USER THAT
* AN UNRECOVERABLE I/O ERROR HAS OCCURED DURING THE LOG-ON PROCESS AND
* HE CANNOT CONTINUE. A LATER IMPLEMENTATION WOULD BE TO INITIATE
* MONITOR RECOVERY PROCEEDURES, IF AND WHEN AVAILABLE.
*
*
IOERROR  RES      0
         CAL1,1   NORETURN          IGNORE ERROR RETURNS
         CAL1,1   CLOSE             CLOSE LOGON FILE
         LB,R2    SR3               RIGHT JUSTIFY ERROR CODE IN R2
         DO       FORBTM
         CI,R2    X'43'             SEE IF NO RECORD WITH THIS KEY
         BE       BUMMER            IF SO, SIMULATE UTS ACTION
         FIN
         SETERROR R2                BUILD ERROR CODE MESSAGE
         TYPE     NEWLINE,DOWN      TELL USER
         SEND     RDLOGONM,ERRCODEM   TELL OPERATOR
         B        TRIES1            AND CLEAN-UP LOG-ON FOR EXIT.
         PAGE
************************************************************************
* THE FOLLOWING CODE IS ENTERED AS A RESULT OF AN ABNORMAL CONDITION ON
* THE READ OF THE LOGIN FILE-PROBABLY FILE NOT PRESENT. THE USER IS
* NOTIFIED AND THE LOG-ON PROCESS IS TERMINATED.
* IF THE USER IS THE MANAGMENT ACCOUNT AND THE ERROR IS 'FILE NOT
* PRESENT', LOGON WILL AUTOMATICALLY CREATE THE FILE WITH THE SPECIAL
* KEY AND ANY PASSWORD GIVEN. THIS DONE, SUPER MAY THEN BE INVOKED
* TO CREATE THE OTHER ACCOUNT ENTRIES.
*
*
OOPS     RES      0
         LB,R2    SR3               PUT ERROR CODE IN R2
         CAL1,1   NORETURN          IGNORE ERROR RETURNS
         CAL1,1   CLOSE             CLOSE LOGON FILE
         CI,R2    3
         BNE      OOPS1             MUST BE ANOTHER ABNORMAL
         CW,D3    SYS               TEST ACCOUNT (IN D3,D4) TO SEE IF
         BNE      BUMMER1              IT'S THE MANAGEMENT ACCOUNT      U:LO0045
         CW,D4    SYS+1
         BNE      BUMMER1                                               U:LO0047
         LW,R2    ACCOUNT           ACCOUNT'S OK, TEST NAME
         CW,R2    SYSUSR
         BNE      BUMMER1                                               U:LO0049
         LW,R2    ACCOUNT+1
         CW,R2    SYSUSR+1
         BNE      BUMMER1                                               U:LO0051
         LW,R2    ACCOUNT+2
         CW,R2    SYSUSR+2
         BNE      BUMMER1                                               U:LO0053
         LCI      2                 ITS THE BOSS-CREATE A LOGIN RECORD
         LM,R2    UPASSWD           FOR HIM WITH PASSWORD, IF ANY
         STM,R2   LR:PW+RECORD
         LCI      2                 STORE ACCOUNT INTO LOGON RECORD AND
         STM,D3   J:JIT+JACCN          JIT
         STM,D3   LR:ACC+RECORD
         STM,D3   UACCOUNT
         LCI      3                 STORE USER NAME INTO LOGON RECORD
         LM,R0    ACCOUNT
         STM,R0   LR:USR+RECORD
         LI,R0    X'C0C0'           SET PRIV. LEVEL TO 'C0' FOR BATCH AND ON-LIN
         STH,R0   LR:PRIV+RECORD
         LCI      7                 SET UP FPT FOR OPENING LOGON FILE IN
         LM,R0    OPNLOGON             OUTIN MODE
         STM,R0   LIST
         LI,R0    8                 CREATE AS OUTIN
         LCI       13
         LM,R1    OPNLOGON+8
         LCI      14
         STM,R0   LIST+7
         CAL1,1   LIST              DO THE OPEN
         LCI      6                 AND SET UP A WRITE
         LM,R0    LOGFILE
         OR,R0    L(X'1000000')     CHANGE TO A WRITE
         AI,R1    X'20'             PUT IN NEW KEY OPTION
         LCI      6
         STM,R0   LIST
         LI,R3    KEYBUFF
         CAL1,1   LIST              AND WRITE SUPERVISORY RECORD
         CAL1,1   CLOSE             CLOSE LOGON FILE
         B        LOGIT             FINISH LOGGING ON
OOPS1    RES      0
         CI,R2    X'14'             CHECK FOR FILE BUSY
         BE       BUSY
         CI,R2    X'2E'
         BE       BUSY
         CI,R2    X'4C'
         BE       BUSY
         SETERROR R2                BUILD ERROR CODE MESSAGE
         TYPE     NOTHERE,NEWLINE   TELL USER
         SEND     NOTHERE,ERRCODEM     TELL OPERATOR
         B        TRIES1            DITCH USER
         PAGE
*
*        GOT AN ABNORMAL FROM THE M:UC DCB
*
RES:ERR  EQU      %
RES:ABN  EQU      %
         LB,R1    10                GET I.O ERROR CODE
         CI,R1    X'49'             IS RESOURCE ERROR
         BE       NO:RES            CANT GET THHE RESOURCE
         SEND     RAS:USR           TELL OPERATOR COUNDNT GET RESOURCE
         CAL1,9   1                 AND EXIT
NO:RES   EQU      %
         SEND     RAS:RES           TELL OPERATOR COUNDT DO IT
         CAL1,9   1                 AND EXIT
RAS:RES  TEXTC    '**LOGON:  CANNOT ACCQUIRE RESOURCE'
RAS:USR  TEXTC    '**LOGON:  CANNOT LOGON RESOURCE REQUESTED'
         PAGE
* THE FOLLOWING CODE IS ENTERED AS THE RESULT OF AN ERROR DURING THE
* KEYED READ OF THE LOGIN FILE. THIS HAS THE IMPLICATION OF THE USER
* SUBMITTING AN INVALID OR GARBLED ID AND/OR ACCOUNT. IT IS NOT POSSIBLE
* TO DETERMINE WHICH PART IS BAD SO A MESSAGE REPEATING BOTH INPUT
* FIELDS IS RETURNED TO THE USER.
*
*
*
BUMMER   RES      0
         CAL1,1   NORETURN          IGNORE ERROR RETURNS
         CAL1,1   CLOSE             CLOSE LOGON FILE
BUMMER1  BAL,SR4  TRIES             PERFORM ERROR LIMIT CHECK           U:LO0055
         TYPE     NAMACT            TYPE 'ACCOUNT/ID' FOLLOWED BY ECHO  U:LO0057
         LI,R3    8                    OF USER ACCOUNT AND NAME         U:LO0059
         TYPES    UACCOUNT                                              U:LO0061
         TYPE     SLASH
         LI,R3    12                                                    U:LO0063
         TYPES    UNME
         B        ACT1
*
* COME HERE IF LOGON FILE IS BUSY
*
BUSY     RES      0
         DO1      FORUTS
         CAL1,8   WAIT1             WAIT FOR ONE SECOND AND TRY AGAIN
         B        OPENIT
         PAGE
* THE FOLLOWING CODE IS ENTERED AS THE RESULT OF ERRORS DURING THE WRITE
* OF THE ASSIGN-MERGE RECORD. USER IS NOTIFIED THAT THE SYSTEM IS UNABLE
* TO WRITE AN A/M RECORD AND IS UNABLE TO LOG HIM ON.
*
*
AMWERR   RES      0
         TYPE     NEWLINE,AMERRMSG  NOTIFY USER
         LI,R2    0                 INDICATE TO LOGOFF THAT IT'S AN A/M
         STB,R2   J:JIT+JUNAME      ERROR.
         B        TRIES1            TELL USER YOU CAN'T LOG HIM ON, EXIT.
         PAGE
*
*        PARAMETER LISTS
*
WAIT1    RES      0
         GEN,8,24 X'F',1            WAIT CAL PLIST - TIME = 1 SEC
WAIT5    GEN,8,24 X'F',2
*
* PLIST FOR WRITING NULL MSG TO M:UC TO SET BDT TO ZERO
*
NOMSG    GEN,8,24 X'11',UC          WRITE TO UC
         DATA     X'34000000'       P3,P4,P6
         DATA     CARRRTRN          BUFFER
         DATA     1                 SIZE
         DATA     0                 BTD TO ZERO FOR TELL
CARRRTRN DATA     X'15000000'       CR TO GET FIRST TOP OF PAGE
*
* PLIST FOR OUTPUT MESSAGES TO USER CONSOLE.
*
ERIDMSG  GEN,8,24 X'11',UC          WRITE TO USER TERMINAL
         DATA     X'34000000'       P3,P4,P6
         GEN,1,31 1,R2              BUFFER POINTER IN R2
         GEN,1,31 1,R3              SIZE IN R3
         DATA     1                 BYTE DISPLACEMENT
*
* PLIST FOR OUTPUTTING TEXT MESSAGES TO USER CONSOLE
*
ERIDMSGS GEN,8,24 X'11',UC          WRITE TO USER CONSOLE
         DATA     X'34000000'       P3,P4,P6
         GEN,1,31 1,R2              BUFFER ADDRESS IN R2
         GEN,1,31 1,R3              BUFFER SIZE IN R3
         DATA     0                 BYTE DISPLACEMENT
*
* PLIST TO OBTAIN DATE/TIME
*     TIME RETURNED BOTH IN EBCDIC AND BINARY FORM
*
TIMER    GEN,8,1,23   X'10',1,TIMBUF
*
*  PLIST FOR READING THE LOG-ON RESPONSE FROM THE UC DEVICE
*
INMSG    GEN,8,24 X'10',UC          READ FROM USER TERMINAL
         DATA     X'74000000'       P2,P3,P4,P6
         DATA     SYNTAX            ABNORMAL RETURN
         DATA     RECORD            BUFFER ADDRESS
         DATA     72                MAX SIZE = 72 CHARACTERS
         DATA     0                 BYTE DISPLACEMENT
*
* PLIST FOR OPENING LOGON FILE
*
OPNLOGON GEN,8,24 X'14',M:LOG       OPEN 'USERS' LOGON FILE             U:LO0067
         DO1      FORUTS
         DATA     X'CF480219'       P1,2,5,6,7,8,10,13  F3,8,9,12
         DO1      FORBTM
         DATA     X'CF480009'       NO PASSWORD, READ ACCNTS FOR BTM
         DATA     BUMMER            ERROR RETURN ADDRESS
         DATA     OOPS              ABNORMAL RETURN ADDRESS
         DATA     10                MAX RECOVERY TRIES
         DATA     2                 ORGANIZATION KEYED
         DATA     2                 DIRECT ACCESS
         DATA     1                 IN MODE
         DATA     2                 SAVE
         DATA     21                MAX KEY LENGTH = 21
         GEN,8,8,8,8  1,0,2,2       FILE NAME
         TEXTC    ':USERS'
         GEN,8,8,8,8  2,0,2,2       ACCOUNT NUMBER
SECAT    RES      0
         DO       FORUTS
         TEXT     SYSACCNT
         DATA     X'03000202'       PASSWORD
         DATA     X'DFEF803F',X'AFC0BF9F'
         DATA     X'05010101'       READ ACCOUNT NUMBERS
         TEXT     'NONE'
         ELSE
         TEXT     BTMACCN
         DATA     X'03010000'       VARIABLE PARAMETER TERMINATOR
         FIN
*
* PLIST TO ECHO AN UNCLEAR MESSAGE BACK TO THE SENDER
*
ECHOWTE  GEN,8,24 X'11',UC          WRITE TO USER TERMINAL
         DATA     X'30000000'       P3,P4
         DATA     RECORD            BUFFER ADDRESS
         GEN,1,31 1,R2              SIZE IN R2
*
*  PLIST FOR CLOSING THE LOGIN FILE.
*
CLOSE    GEN,8,24 X'15',M:LOG       CLOSE 'USERS' LOGON FILE
         GEN,1,31  1,0              P1
         DATA    2                  SAVE
*
* PLIST FOR IGNORING ERROR RETURNS
*
NORETURN GEN,8,24 X'06',M:LOG       SETDCB FOR LOGON, RATE FILES        U:LO0069
         DATA     X'C0000000'       P1,P2
         DATA     RETURN            ERROR RETURN
         DATA     RETURN            ABNORMAL RETURN
*
* PLIST FOR WRITING ASSIGN/MERGE TABLE.
*
AMR      GEN,8,24 X'2E',M:EO        WRITE ASSIGN-MERGE TABLE            U:LO0071
         GEN,8,24 X'30',0           P3,P4
         DATA     MERTAB            BUFFER ADDRESS
         DATA     4*512             BUFFER SIZE
*
*  PLIST FOR READING THE LOGIN FILE.
*
LOGFILE  GEN,8,24 X'10',M:LOG       READ LOGON FILE RECORD
         DATA     X'B8000010'       P1,P3,P4,P5,F8
         DATA     IOERROR           ERROR RETURN ADDRESS
         DATA     RECORD            BUFFER ADDRESS
         DATA     4*LOGRECSZ        RECORD SIZE
         GEN,1,31 1,R3              KEY ADDRESS IN R3
*
* PLIST FOR OPENING 'MAILBOX'
*
OPNMAIL  GEN,8,24 X'14',M:X1        OPEN MAILBOX FILE
         DATA     X'C5400001'       P1,P2,P6,P8,P10,F12
         DATA     NOMAIL            ERROR RETURN ADDRESS
         DATA     NOMAIL            ABNORMAL RETURN ADDRESS
         DATA     2                 KEYED
         DATA     1                 IN MODE
         DATA     2                 SAVE
         DATA     X'01000202'       FILE NAME
         TEXTC    'MAILBOX'
         DATA     X'02010002'       ACCOUNT
         DATA     0
         DATA     0
*
* PLIST FOR CLOSING 'MAILBOX'
*
CLSMAIL  GEN,8,24 X'15',M:X1        CLOSE MAILBOX FILE
         GEN,1,31 1,0               P1
         DATA     2                 SAVE
*
* PLIST FOR SETTING ERR/ABN ADDRESSES
*
SETEABN  GEN,8,24 X'06',M:EO
         GEN,2,30 3,0
         GEN,1,31 1,D4              ERROR
         GEN,1,31 1,D4              ABNORMAL
         PAGE
*
*        COME HERE IF ABNORMAL OR ERROR WHILE OPENING 'MAILBOX'
*
NOMAIL   RES      0
         LB,SR3   SR3               RIGHT JUSTIFY ERROR CODE
         CI,SR3   X'2E'             IF FILE IS BUSY, GO AHEAD AND TELL
         BE       RETREQ               USER THAT MAIL HAS BEEN DELIVERED
         CI,SR3   X'14'
         BE       RETREQ
         CI,SR3   X'4C'
         BE       RETREQ
         B        AUTOCALL
*
*        COME HERE IF ERRORS ARE TO BE IGNORED
*
RETURN   RES      0
         B        *SR1              RETURN TO CAL + 1
         PAGE
* THE PARSE SUB-ROUTINE WILL PLACE THE USER ID INTO TEMP STORAGE/JIT
* HAVING THE THREE PARTS AS SEPERATE ENTITIES. SYNTAX CHECKING IS
* PERFORMED AND ERROR ACTIONS ARE TAKEN IN THE EVENT OF SYNTACTICAL
* ERRORS ARE PRESENT.
*   ON ENTRY, R3 = SIZE OF INPUT MESSAGE IN BYTES
*   MESSAGE BEGINS IN LOCATION RECORD
*
*
PARSE    RES      0
         DO       FORBTM                                                U:LO0073
         AI,R3    1                 INCREMENT BYTE COUNT FOR BTM        U:LO0074
         FIN                                                            U:LO0075
         LI,D1    0                 LEFT PAREN FLAG
         LI,D2    0                 RIGHT PAREN. FLAG
         LI,R2    0                 R2 MAINTAINS FIELD POSITION
         LI,R5    J:JIT+JACCN                                           U:LO0077
         LI,R4    UACCOUNT                                              U:LO0079
         BAL,SR3  SCAN              GET ACCOUNT                         U:LO0081
         CI,R7    8                                                     U:LO0083
         BG       SYNTAXA
         LI,R5    ACCOUNT                                               U:LO0085
         LI,R4    UNME
         BAL,SR3  SCAN              GET NAME                            U:LO0089
         CI,R7     0                TEST TO INSURE DATA SUPPLIED
         BE       SYNTAXB
         CI,R7    12                                                    U:LO0091
         BG       SYNTAX
         CI,D1    0
         BE       %+4               NO EXT. ACC. FIELD PRESENT
         LI,R5    0                 DISABLE STORING IN SCAN
         LI,R4    UEXTACC           FOR STORING ,DATA DEFED IN ACCTSUM
         BAL,SR3  SCAN              GET EXT. ACC. FIELD
         LI,R5    0                 DISABLE UNNEC. STORING IN SCAN
         LI,R4    UPASSWD
         CW,D2    D1
         BE       %+2
         B        SYNTAXC           LEFT OR RIGHT PAREN. MISSING
         LI,D1    0                 RESET
         LI,D2    0                 RESET
         BAL,SR3  SCAN              GET PASSWORD
         CI,R7    8
         BG       SYNTAX
         B        *SR4
         PAGE
* THE SUB-ROUTINE SCAN FORMS A TWO WORD DATA ELEMENT IN *R4 AND *R5
* IT PROVIDES THE NECESSARY BOOKKEEPING TO MAINTAIN THE PLACE WITHIN
* THE INPUT BUFFER.
*
*
SCAN     RES      0
         LI,SR1   0
         LI,R7    0                 R7 IS THE REGISTER BYTE DISPLACEMENT
LOOP     BDR,R3   %+2               THIS TEST MAY BE DONE
         B        *SR3              FIRST BECAUSE
         LB,R6    RECORD,R2         THIS EOM IS COUNTED AS A CHARACTER
         AI,R2    1                 BUMP TO NEXT POSITION
         CI,R6    ' '               IS THIS A BLANK
         BE       YBLK
         CI,R6    X'05'             OR A TAB-TREATED AS BLANK
         BNE      COMMA
YBLK     CI,D1    0                 ALLOW BLANKS IN EXPRESSION
         BNE      COMMA             FOR EXT. ACCT.
         CI,R7    0
         BEZ      LOOP              IGNORE LEADING BLANKS
         AI,SR1   1                 YES-SET BLANK FLAG
         B        LOOP              SUPPRESS TRAILING BLANKS
COMMA    CI,R6    ','               HOW ABOUT A COMMA
         BE       *SR3              FIELD COMPLETE-RETURN
         CI,R6    '('               LEFT PAREN IS A FIELD TERMINATOR
         BNE      PCA
         AI,D1    1                 ALSO INDICATES THE PRESENCE OF EXTACC FIELD

         B        *SR3
PCA      CI,R6    ')'               IN EXTACC,PARENS AND TRAILING BLNKS NOT ALLO
         BNE      BKCHCK
         AI,D2    1                 RIGHT PARENTHESIS PRESENT
         B        LOOP              RIGHT PAREN DOES NOT NEC. TERM. FIELD
BKCHCK   CI,SR1   0                 TEST BLANK FLAG
         BE       CHAROK            JUMP IF OK
         AI,R3    1                 RESET POSITION TO START OF FIELD
         AI,R2    -1
         B        *SR3
CHAROK   CI,R7    24                MAX LENGH OF ANY FIELD
         BGE      SYNTAX            TOO MANY CHARACTERS IN FIELD.
         CI,R4    0                 AVOID UNNEC. STORING
         BE       %+2
         STB,R6   *R4,R7            STORE
         CI,R5    0                 AVOID UNNEC. STORING
         BE       %+2
         STB,R6   *R5,R7            STORE
         AI,R7    1
         B        LOOP
         PAGE
* THE ROUTINE CONCAT IS USED TO CONCATINATE NAME TO ACCOUNT AND PROVIDE
* A BYTE COUNT. THIS CODE IS USED TO GENERATE A KEYWORD TO READ THE
* LOGIN FILE.
*   FOR ENTRY, R2=INPUT FIELD ADDRESS(EIGHT BYTE MAX)
*              R3=KEY BUFFER ADDRESS
*   FOR EXIT,  R4=ACCUMULATED BYTE COUNT - SHOULD BE ZERO ON ENTRY
*              R5=USED FOR BYTE POSITIONING - R6 CONTAINS LAST CHAR.
*   ENTRY AND RETURN ARE MADE ON SR4.
*
*
CONCAT   LI,R5    0
DOIT     LB,R6    *R2,R5            PICK UP CHARACTER.
         AI,R5    1                 BUMP POSITION.
         CI,R6    0
         BE       *SR4              DONE
         AI,R4    1                 COUNT CHARACTER
         STB,R6   *R3,R4            STORE IN KEYBUFFER
         CW,R5    R7                THIS FIELD AT MAXIMUM
         BE       *SR4              DONE
         B        DOIT              NO.
         PAGE
*DRIVE TABLES FOR LIMIT DEFAULT STORING
*THE POSITION OF ENTRY WITHIN THE TABLE IS KEYED DIRECTLY TO TABLE SL:NAME
LIM      COM,2,6,24 CF(2),AF(1),AF(2)
LIMSTORE RES      0
         STS,R6   *R5,R2
         STB,R6   *R5,R2
         STH,R6   *R5,R2
         BAL,SR1  0,R2
LIMINFO  RES      1
         RES      1                 TIME
         LIM,WORD 17,MPPO           LO
         LIM,WORD 17,MPO            PO
         LIM,WORD 17,MDPO           DO
         LIM,WORD 17,MUPO           UO
LIMINFOA EQU      %-LIMINFO
         LIM,WORD 0,PRDCRM          PSTORE
         LIM,SPEC 0,TSTST           TSTORE
         LIM,BYTE 0,JB:NFPOOL-BA(J:JIT) FPOOL
         LIM,SPEC 0,TSTDI           TDISK
         LIM,WORD 0,PRDPRM          PDISK
WORD     EQU      0
HALF     EQU      2
BYTE     EQU      1
SPEC     EQU      3
TSTST    STW,R6   TMDCRM,R5         TEMP DISC SPACE
         STW,R6   TMPDCPK,R5        PEAK TEMP RAD SPACE USED
         B        *SR1
TSTDI    STW,R6   TMDPRM,R5         TEMP DISC PACK SPACE
         STW,R6   TMPDPPK,R5        PEAK TEMP PACK SPACE USED
         B        *SR1
         PAGE
* THE SETLDCF ROUTINE AUTHORIZES ACCESS TO LOGICAL DEVICE PERIPHERALS
* BY SETTING PERTINENT BITS IN JIT (JH:LDCF) FOR THOSE PERIPHERALS
* SPECIFIED IN THE :USERS FILE.
*        ENTER    BAL,SR4  SETLDCF
*        INPUT    R7=0 - AUTHORIZE DEVICES FOR BATCH.
*                 R7=1 - AUTHORIZE DEVICES FOR ON-LINE.
*                 R7=2 - AUTHORIZE DEVICES FOR GHOST.
*                 R4= - ADDRESS OF :UNMP TABLE IN :USERS FILE.
*                 R5= - ADDRESS OF :UPFLGS TABLE IN :USERS FILE.
*        ENTER    BAL,SR4  SETLDCF
*                 REG.USED R1,R2,R3,R6
*
SETLDCF  RES      0
         LI,R1    SV:FTYM           GET LOGICAL DEVICE LIMIT TABLE SIZE.
         STB,R7   SR4               SAVE FLAG TEMPORARILY
SETLDCF2 LH,R2    SH:SYMT,R1        GET PERIPHERAL DEVICE NAME
         LI,R3    LMTSZE
SETLDCF4 CH,R2    *R4,R3            WAS DEVICE NAME IN :USERS FILE
         BE       SETLDCF6          YES, SET FLAG
         BDR,R3   SETLDCF4
         B        SETLDCF8          NO, GET NEXT DEVICE NAME
*
SETLDCF6 LB,R6    *R5,R3            GET PERIPHERAL FLAF FROM :USERS
         AI,R7    8
         SLS,R6   0,R7              SHIFT SPEC. FLAG(BATCH,O/L,GHOST) TO
*                                   BIT 16
         LCW,R3   R1                SHIFT MASK FOR PERIPHERAL FLAG
         LI,R7    X'8000'
         SLS,R7   0,R3
         SLS,R6   0,R3              SHIFT PERIPHERAL FLAG
*
         LI,R2    JH:LDCF           GET LOGICAL DEVICE CONTROL FLAGS
         LH,R3    0,R2
         STS,R6   R3
         STH,R3   0,R2
         LB,R7    SR4               RESTORE FLAG
SETLDCF8 BDR,R1   SETLDCF2          GET NEXT DEVICE NAME
         B        *SR4
         PAGE
************************************************************************
*                                                                      *
*        ENDJOB/LOGOFF PROCESSOR                                       *
*                                                                      *
************************************************************************
*
LTO      TEXTC    'LINE TIMED OUT'
*
LOGOFF   RES      0
         LB,SR3   J:JIT+JUNAME      IF AREA IN JIT RESERVED FOR THE
         CI,SR3   0                    USER NAME HAS BLANKS OR ZEROS
         BE       LOGOFFX              IN IT, THE USER WAS IN THE
         CI,SR3   X'40'
         BE       LOGOFFX
         STW,SR1  TIMBUF+4          (SR1)=YY,DD FROM TIME CALL
         LI,SR3   0
         STB,SR3  J:JIT+JRNST       ERR/ABN RETURNED IN SR3 IF J:RNST=0
         STW,SR3  RATEFLAG          SET RATE FILE INDICATOR TO 'IN'
         CAL1,1   ORATE             OPEN RATE FILE
         CAL1,1   RRATE             READ RECORD INTO 'RECORD'
         CAL1,1   CRATE             CLOSE RATE FILE
RATEIN   BAL,SR4  ACCNTSUM          COMPUTE, DISPLAY, LOG ACCOUNTING INFO
         DO       FORUTS
         B        LOGOFFX1
LOGOFFX  EQU      %
         LC       J:JIT             HERE WITH NO UNAME
         BCR,8    LOGOFFX1          AVOID IF NOT ON-LINE
         CI,SR3   0
         BE       LOGOFFX1          A/M WRITE ERROR
         TYPE     NEWLINE,LTO       HE PROBABLY TIMED OUT
LOGOFFX1 EQU      %
         CAL1,9   6                 CLOSE COOPERATIVE FILES  L.L.
         LW,R6    =X'00200000'
         CW,R6    M:LL              M:LL OPEN
         BAZ      %+2               NO
         CAL1,1   FPTCLSLL          CLOSE M:LL
         LI,R6    0                 CLEAR FOR EXIT CAL                  U:LO0095
         CAL1,9   1                 EXIT
         ELSE
LOGOFFX  B        EXITOFF
         FIN
*
FPTCLSLL GEN,8,7,17  X'15',0,M:LL
         DATA     X'80000000'
         DATA     2                 SAVE
*
*        COME HERE ON OPEN OR READ ERROR OF RATE FILE
*
RATEERR  RES      0
         LB,SR3   SR3               RIGHT JUSTIFY ERROR CODE
         CI,SR3   3                 BRANCH TO 'NORATE' IF FILE DOESN'T
         BE       NORATE               EXIST
         CI,SR3   X'14'             BRANCH TO 'RATEBUSY' IF THE FILE
         BE       RATEBUSY             IS BUSY
         CI,SR3   X'2E'
         BE       RATEBUSY
         CI,SR3   X'4C'
         BE       RATEBUSY
         CI,SR3   X'75'             THIS IS TO SEE IF THE ERROR WAS DUE
         BE       FDERROR1             TO A BAD FILE DIRECTORY
         SETERROR SR3               BUILD ERROR CODE MESSAGE
         SEND     OPNRFMSG,ERRCODEM
*
*        COME HERE IF COULDN'T GET A RATE FILE
*
NORATE   RES      0
         CAL1,1   NORETURN          IGNORE ERROR RETURNS FOR CLOSE
         CAL1,1   CRATE             CLOSE RATE FILE
         LI,SR3   -1                INDICATE TO DISPLAY NO RATE FILE
         STW,SR3  RATEFLAG          WAS READ
         B        RATEIN            CONTINUE PROCESSING
*
*        COME HERE IF THE FILE WAS BUSY
*
RATEBUSY RES      0
         DO1      FORUTS
         CAL1,8   WAIT1             WAIT FOR 1 SECOND AND THEN TRY
         B        LOGOFF               AGAIN
*
*        COME HERE IF THERE IS AN ERROR IN THE :SYS ACCOUNT DIRECTORY
*
FDERROR1 RES      0
         SETERROR SR3
         SEND     ARFMSG,ERRCODEM   TELL OPERATOR
         B        NORATE            PROCEED AS IF NO RATE FILE
*
*        COME HERE IF THERE IS AN ERROR READING RATE FILE
*
RDRATERR RES      0
         LB,R2    SR3               BUILD ERROR CODE MESSAGE
         SETERROR R2
         SEND     RRFMSG,ERRCODEM
         B        NORATE            PROCEED AS IF NO RATE FILE
         PAGE
*
*        RATE FILE PARAMETER LISTS
*
ORATE    RES      0
         GEN,8,24 X'14',M:RATE      OPEN RATE FILE                      U:LO0097
         DATA     X'FF400009'       P1,P2,P3,P4,P5,P6,P7,P8,P10,F9,F12
         DATA     RATEERR           ERROR RETURN ADDRESS
         DATA     RATEERR           ABNORMAL RETURN ADDRESS
         DATA     RECORD            BUFFER AREA
         DATA     288               MAX SIZE EQUALS 72 WORDS
         DATA     10                RECOVERY TRIES
         DATA     1                 CONSECUTIVE
         DATA     1                 SEQUENTIAL ACCESS
         DATA     1                 INPUT MODE
         DATA     2                 SAVE
         DATA     X'07000000'       NULLIFY SN THAT MIGHT BE CARRIED
         DATA     X'08000000'       OVER FROM PREV. ACT. THGH M:EO DCB
         DATA     X'01000202'       FILE NAME
         TEXTC    ':RATE'
         DATA     X'02010202'       ACCOUNT
         DO       FORUTS
         TEXT     SYSACCNT
         ELSE
         TEXT     BTMACCN
         FIN
*
*        READ RATE FILE
*
RRATE    RES      0
         GEN,8,24 X'10',M:RATE      READ RATE FILE                      U:LO0099
         DATA     X'C0000000'       P1,P2
         DATA     RDRATERR          ERROR RETURN ADDRESS
         DATA     RDRATERR          ABNORMAL RETURN ADDRESS
*
*        FPT TO SET ERR/ABN FOR IMPLICIT OPEN OF M:UC
*
SETRES   GEN,8,24 6,M:UC
         GEN,8,24   X'C0',0
         DATA     RES:ERR,RES:ABN
*
*        CLOSE RATE FILE
*
CRATE    RES      0
         GEN,8,24 X'15',M:RATE      CLOSE RATE FILE                     U:LO0101
         DATA     0
         END      LOGON

