<< LINES .001/.009 ARE RESERVED FOR SYSTEMS INTEGRATION>>               00000001
$CONTROL ADR, MAP             <<CODE IS USELESS>>                       01000000
                                                                        01002000
<< STORE/RESTORE -- MODULE 06 >>                                        01004000
<< HP32002 MPE SOURCE C.01.00 >>                                        01006000
                                                                        01008000
$CONTROL ERRORS = 50                                                    01010000
$CONTROL SEGMENT=MAIN                                                   01012000
$CONTROL PRIVILEGED                                                     01014000
$CONTROL DEFINE                                                         01015000
$THIRTY                                                                 01016000
                                                                        01018000
$COPYRIGHT "COPYRIGHT (C)  HEWLETT-PACKARD CO. 1981 ",&                 01020000
$  "THIS PROGRAM MAY BE USED WITH ONE COMPUTER SYSTEM AT A ",&          01022000
$  "TIME AND SHALL NOT OTHERWISE BE RECORDED, TRANSMITTED OR ",&        01024000
$  "STORED IN A RETRIEVAL SYSTEM.  COPYING OR OTHER REPRODUCTION ",&    01026000
$  "OF THIS PROGRAM EXCEPT FOR ARCHIVAL PURPOSES IS PROHIBITED ",&      01028000
$  "WITHOUT THE PRIOR WRITTEN CONSENT OF HEWLETT-PACKARD COMPANY."      01030000
                                                                        01032000
BEGIN                                                                   01034000
                                                                        01036000
<<-------------------------------------------------------------         01038000
                                                                        01040000
                                                                        01042000
     xxxxx   xxxxx   xxxxx   xxxx    xxxxx              x               01044000
     x         x     x   x   x   x   x                 x                01046000
     x         x     x   x   x   x   x                x                 01048000
     xxxxx     x     x   x   xxxx    xxxxx           x                  01050000
         x     x     x   x   x  x    x              x                   01052000
         x     x     x   x   x   x   x             x                    01054000
     xxxxx     x     xxxxx   x   x   xxxxx        x                     01056000
                                                                        01058000
                                                                        01060000
     xxxx    xxxxx   xxxxx   xxxxx   xxxxx   xxxx    xxxxx              01062000
     x   x   x       x         x     x   x   x   x   x                  01064000
     x   x   x       x         x     x   x   x   x   x                  01066000
     xxxx    xxxxx   xxxxx     x     x   x   xxxx    xxxxx              01068000
     x  x    x           x     x     x   x   x  x    x                  01070000
     x   x   x           x     x     x   x   x   x   x                  01072000
     x   x   xxxxx   xxxxx     x     xxxxx   x   x   xxxxx              01074000
                                                                        01076000
                                                                        01078000
   Written by:                                                          01080000
                                                                        01082000
      Stan Sieler    (1980 --> November 1981)                           01084000
                                                                        01086000
   RESTORE written by:                                                  01088000
                                                                        01090000
      Lou Bershad    (1981 --> )                                        01092000
                                                                        01094000
                                                                        01096000
   (Inspired, slightly, by the original STORE in module 52.)            01098000
---------------------------------------------------------->>            01100000
$PAGE "SELECT COMPILER OPTIONS"                                         01102000
                                                                        01104000
<<-----------------------------------------------------                 01106000
                                                                        01108000
Compiler ($) options used by this source:                               01110000
                                                                        01112000
   X1   flag that, when ON, compiles debugging code                     01114000
        into the resultant USL/PROG file.                               01116000
        NOTE: resultant program file should NOT be                      01118000
              given to users!...it is dangerous!                        01120000
                                                                        01122000
   X2   flag that, when on, compiles code that allows the user to       01124000
        use a default tapename.  In order to parse this correctly       01126000
        indirect files will be referenced by  !filename instead of      01128000
        *filename.                                                      01130000
                                                                        01132000
   X3   flag that, when ON, compiles some special                       01134000
        testing code into the resultant USL/PROG,                       01136000
        this code is designed to be used by Stan Sieler                 01138000
        and includes such things as: opening and using                  01140000
        a file called STORECAT.SIELER.MPE (or, if not                   01142000
        present, STORECAT.PUB.SYS) instead of using the                 01144000
        system message catalog for generating messages.                 01146000
        Also added are new STORE/RESTORE keyword                        01148000
        options:                                                        01150000
                                                                        01152000
           ATTIO ... force, if possible, STORE to use                   01154000
                     the ATTACHIO method of writing to                  01156000
                     tape instead of the FWRITE method,                 01158000
                     for all non-labelled tapes.                        01160000
                                                                        01162000
           LOCK ...  add keyword to control how files                   01164000
                     get locked during scanning phase.                  01166000
                     ***caution***                                      01168000
                                                                        01170000
           UPDATE... when any file is locked for storing,               01172000
                     this keyword will update its                       01174000
                     last access & modification dates to                01176000
                     today's date ... i.e: update the file.             01178000
------------------------------------------------------------>>          01180000
                                                                        01182000
$SET X1 = OFF   << ON = DEBUGGING CODE COMPILED IN          >>          01184000
                                                                        01186000
$SET X2 = ON  << ALLOW DEFAULT TAPEFILE NAME                >>          01188000
                                                                        01190000
$SET X3 = OFF   << ON = COMPILE IN STAN'S DEBUGGING STUFF   >>          01192000
                                                                        01194000
$SET X9 = ON    << ON = COMPILE RESTORE CODE >>                <<LB.RS>>01196000
$SET X5 = OFF   << ON = PRINT STATISTICS                    >>          01198000
<<$CONTROL HARDWARN   >>     <<if on, treat all warnings as errors>>    01200000
                                                                        01202000
<<$CONTROL NOLISTIF >>       <<if on, don't list $IF lines>>            01204000
                                                                        01206000
<<CONTROL NOLISTOMIT >>     <<if on, don't list lines omitted by $IF>>  01208000
$PAGE "STORE PHILOSOPHY"                                                01210000
                                                                        01212000
<<--------------------------------------------------------------        01214000
                                                                        01216000
Notes on error handling:                                                01218000
                                                                        01220000
   All error messages are generated and printed by this program.        01222000
   After a "fatal" error occurs, this program will (perhaps) inform     01224000
   the caller (either via MAIL or a jcw) and then terminates.           01226000
                                                                        01228000
   None of the error messages now in the CI message set of the          01230000
   system catalog are used by this program.  They should be removed     01232000
   when the old STORE/RESTORE procedures are completely phased out.     01234000
                                                                        01236000
                                                                        01238000
Philosophy (some...more is distributed throughout the source):          01240000
                                                                        01242000
   1) NO calls to SUDDENDEATH.  Period!                                 01244000
                                                                        01246000
   2) All errors (and their messages) are handled as closely            01248000
      as possible to the source of the error.  If a procedure           01250000
      detects an error, it calls SENDMESSAGE to print the               01252000
      error, and typically returns a FAILED result to its               01254000
      caller.                                                           01256000
                                                                        01258000
   3) Few "magic" numbers appear anywhere other than in global          01260000
      equates/defines.                                                  01262000
                                                                        01264000
   4) It is considered an "error" if a call to STORE or                 01266000
      RESTORE of valid syntax results in an empty set of                01268000
      files to store or restore.  This is becaue we assume              01270000
      that the reason STORE or RESTORE is being called is               01272000
      to actually move/get one or more files...if zero are              01274000
      selected, then the "reason" was not fulfilled, hence              01276000
      an error.                                                         01278000
                                                                        01280000
------------------------------------------------------------>>          01282000
$PAGE "GLOBAL DEBUGGING DECLARATIONS"                                   01284000
$SET X8=OFF                                                             01284100
$SET X6=OFF                                                             01284150
$INCLUDE INCLLDT5                                                       01284200
$INCLUDE INCLLPDT                                                       01284300
$INCLUDE INCLPXG                                                        01284400
$CONTROL ADR                                                            01284900
                                                                        01286000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        01288000
                                                                        01290000
LOGICAL                                                                 01292000
   DEBUGGING  :=0;                                                      01294000
                                                                        01296000
REAL                                                                    01298000
   DEBUGPAUSE:=1.0;                                                     01300000
                                                                        01302000
DEFINE                                                                  01304000
                                                                        01306000
   STORE'CATALOG'TITLE = "STORECAT.PUB.SYS " #,                         01308000
   STORE2'CATALOG'TITLE = "STORECAT.BERSHAD.MPE " #,                    01310000
                                                                        01312000
      <<don't use switch 2 until the HELP call is taken                 01314000
        out of MPE-IV!!!>>                                              01316000
                                                                        01318000
   DEBUG'PARMS       = TEST'SWITCH (01) AND DEBUGGING #,                01320000
   DEBUG'STEPIT      = TEST'SWITCH (02) AND DEBUGGING #,                01322000
   DEBUG'SIRS        = TEST'SWITCH (03) AND DEBUGGING #,                01324000
   DEBUG'SENDMESSAGE = TEST'SWITCH (04) AND DEBUGGING #,                01326000
   DEBUG'IRESTORE    = TEST'SWITCH (05) AND DEBUGGING #,                01328000
   DEBUG'LAB'TAPE    = TEST'SWITCH (06) AND DEBUGGING #,                01330000
   DEBUG'DIR         = TEST'SWITCH (07) AND DEBUGGING #,                01332000
   DEBUG'SEND'END    = TEST'SWITCH (10) AND DEBUGGING #,                01334000
   DEBUG'THUNK'STORE = TEST'SWITCH (11) AND DEBUGGING #,                01336000
   DEBUG'WRITE'TAPE  = TEST'SWITCH (12) AND DEBUGGING #,                01338000
   DEBUG'DISK        = TEST'SWITCH (13) AND DEBUGGING #,                01340000
   DEBUG'ERRORS      = TEST'SWITCH (14) AND DEBUGGING #,                01342000
   DEBUG'FSTORE      = TEST'SWITCH (15) AND DEBUGGING #;                01344000
                                                                        01346000
      << *** Declarations for debugging output *** >>                   01348000
                                                                        01350000
LOGICAL ARRAY                                                           01352000
   OUTPUTBUFFER (0:65);                                                 01354000
                                                                        01356000
BYTE ARRAY                                                              01358000
   OUTPUTBUFFER' (*) = OUTPUTBUFFER (0);                                01360000
                                                                        01362000
BYTE POINTER                                                            01364000
   POUT;                                                                01366000
                                                                        01368000
DEFINE                                                                  01370000
   ENDSAY =                                                             01372000
      ,2;                                                               01374000
      @POUT:=TOS;                                                       01376000
      END #,                                                            01378000
   SAY =                                                                01380000
      BEGIN                                                             01382000
      MOVE POUT:=  #;                                                   01384000
                                                                        01386000
$IF                           <<DEBUGGING CODE>>                        01388000
$PAGE "INCLUDE FILES"                                                   01390000
                                                                        01392000
   DEFINE                                                               01394000
      READf    = 10:01 #,                                               01396000
      APPENDf  = 11:01 #,                                               01398000
      WRITEf   = 12:01 #,                                               01400000
      LOCKf    = 13:01 #,                                               01402000
      EXECUTEf = 14:01 #,                                               01404000
      SAVEf    = 15:01 #;                                               01406000
                                                                        01408000
EQUATE                                                                  01410000
   MAX'NUM'EXTENTS   = 32 ;  <<maximum number of extents>>              01412000
EQUATE                                                                  01414000
   ON    = 1,                                                           01416000
   OFF   = 0;                                                           01418000
EQUATE                                                                  01420000
   DELETE    = 4,                                                       01422000
   PERM      = 1,                                                       01424000
   LDTDSTN     = %16,      <<LDT DST # >>                               01426000
   SECTORSIZE = 128;                                                    01428000
DEFINE                                                                  01430000
   DEBUG'RAF = TEST'SWITCH (13) AND DEBUGGING #,                        01432000
   BLANKS'8   = "        "#;                                            01434000
LOGICAL ARRAY                                                           01440000
   LDT (*) = DB + 0;                                           <<LB.RS>>01442000
DEFINE                                                                  01444000
   LPDT1    = LPDT' ( SUB'LDN & LSL(1) + 1)   #;                        01446000
$PAGE "GLOBAL DECLARATIONS"                                             01448000
INTEGER                                                                 01450000
   MAX'XDS'SIZE   := %40000,  <<maximum usable XDS>>      <<32640>>     01452000
   NUM'XDS        := 3;       <<number of XDS buffers to use>>  <<2>>   01454000
LOGICAL                                                                 01456000
   FREEZE'AND'LOCK'XDS := TRUE; <<should we freeze/lock xds>> <<TRUE>>  01458000
INTEGER                                                                 01460000
   INFO'ADDRESS   = Q-5,      <<used for INFO= byte pointer>>           01462000
   INFO'LENGTH    = Q-6,      <<used for INFO= length>>                 01464000
   PARM           = Q-4,      <<used for PARM= >>                       01466000
   STAR                       := [8/"*", 8/" "],                        01468000
   STORE'CATALOG  := 0;       <<file number of STORE msg catalog>>      01470000
                                                                        01472000
LOGICAL                                                                 01474000
   USING'DRIVER := FALSE;     <<if using driver then do not allow >>    01476000
                              <<SYSDUMP or DBSTORE                >>    01478000
$PAGE "GLOBAL EQUATES"                                                  01480000
EQUATE                                                                  01482000
   FILE'PART'SIZE = 8,        <<number of chars in a file part>>        01484000
   FILE'PART'WORDS= 4,        <<number of words in a file part>>        01486000
   FILE'2'PART'WORDS = 2*FILE'PART'WORDS,                               01488000
   FILE'3'PART'WORDS = 3*FILE'PART'WORDS,                               01490000
   MAX'STD'LEN    = ( 10  <<overhead>> <<max len of std-form title>>    01492000
                     + 2 + FILE'PART'SIZE    <<file part>>              01494000
                     + 1 + FILE'PART'SIZE    <<lock part>>              01496000
                     + 1 + FILE'PART'SIZE    <<group part>>             01498000
                     + 1 + FILE'PART'SIZE    <<acct part>>              01500000
                   <<+ 1 + FILE'PART'SIZE>>  <<family part>>            01502000
                   <<+ 1 + FILE'PART'SIZE>>  <<host part>>              01504000
                   <<+ 10 >>  ),       <<expansion!>>                   01506000
   MAX'STD'LEN'WORDS=((MAX'STD'LEN+1)/2),                               01508000
   MAX'TITLE'LEN  = (  1 + FILE'PART'SIZE    <<"*" & file part len>>    01510000
                     + 1 + FILE'PART'SIZE    <</lockword>>              01512000
                     + 1 + FILE'PART'SIZE    <<.group>>                 01514000
                     + 1 + FILE'PART'SIZE    <<.account>>               01516000
                     + 1 ),            <<trailing blank>>               01518000
   MAX'TITLE'LEN'WORDS = ((MAX'TITLE'LEN+1)/2),                         01520000
   MAX'TITLE'LEN2 = (MAX'TITLE'LEN                                      01522000
                     + 1 + FILE'PART'SIZE    <<-file>>                  01524000
                     + 1 + FILE'PART'SIZE  <<.group...no lockword!>>    01526000
                     + 1 + FILE'PART'SIZE    <<.account>>               01528000
                     + 0 );            <<trailing blank added above>>   01530000
$PAGE "GLOBAL DEFINES -- MISCELLANEOUS"                                 01532000
DEFINE                                                                  01534000
                                                                        01536000
         <<Miscellaneous defines...(alphabetical) ...>>                 01538000
                                                                        01540000
   ALL'FILES      = -1D #,    <<UNLOCK all files>>                      01542000
                                                                        01544000
   ALLOCATE'STACK'SPACE =                                               01546000
      ASSEMBLE (ADDS 0) #,                                              01548000
                                                                        01550000
   ALLOW'EMPTY'FILESET = TRUE #,                                        01552000
                                                                        01554000
   ATTIO'STATUSf  = (13:03) #,<<status field for ATTACHIO>>             01556000
                                                                        01558000
   BUILD'TAPE'BUFFER =        <<allocate tape buffer on stack>>         01560000
      BEGIN                                                             01562000
      PUSH(S);                                                          01564000
      @TDBUF:=TOS;                                                      01566000
      TOS:=TAPE'RECSIZE;                                                01568000
      ASSEMBLE (ADDS 0);                                                01570000
      FILL (TDBUF, TAPE'RECSIZE, 0);                                    01572000
      END #,                                                            01574000
                                                                        01576000
   CANDIDAT'FSIZE       = 128D #,                                       01578000
                                                                        01580000
   CANDIDAT'RECSIZE     = (LOOK'PATTERNS'LENGTH +              <<LB.RS>>01582000
                           FILE'PART'WORDS + 1) #,             <<LB.RS>>01583000
                                                               <<LB.RS>>01583010
   CANDIDAT'USED        = CANDIDAT'BUF (0) #,                  <<LB.RS>>01583100
                                                                        01584000
   CHECK'BREAK    =                                                     01586000
      BEGIN                                                             01588000
      IF REQUESTSERVICE THEN                                            01590000
         FAIL (SR'BREAK'SENSED);                                        01592000
      END #,                                                            01594000
                                                                        01596000
   DEFAULT'G'NUM'FSIZE =        <<def recsize for GOOD file>>  <<04965>>01598000
      (IF SYSDUMPING THEN 16000D ELSE 4000D) #,                <<04965>>01598100
                                                                        01600000
   DISABLE'ARITHMETIC'TRAPS =                                           01602000
      BEGIN                                                             01604000
      PUSH (STATUS);                                                    01606000
      TOS.(2:1):=0;           <<disable arithmetic traps>>              01608000
      SET (STATUS);                                                     01610000
      END #,                                                            01612000
                                                                        01614000
   DEVTYPEf       = (08:08) #,<<DEVINFO field for device type>>         01616000
                                                                        01618000
   DUPLICATIVEbit = (14:01)#, <<bit in MODE returned by WHO>>           01620000
                                                                        01622000
   ENABLE'ARITHMETIC'TRAPS =                                            01624000
      BEGIN                                                             01626000
      PUSH (STATUS);                                                    01628000
      TOS.(2:1):=1;           <<enable arithmetic traps>>               01630000
      TOS.(4:1):=0;           <<turn off overflow indicator>>           01632000
      SET (STATUS);                                                     01634000
      END #,                                                            01636000
                                                                        01638000
   FILE'VTAB =                                                          01640000
      VTABINX (FILE'LDEV, PVMVTABX) .(08:08)  #,                        01642000
                                                                        01644000
   FLAB'CHECKSUM  =                                                     01646000
      BEGIN                                                             01648000
      X:=127;                                                           01650000
      TOS:=-1;                                                          01652000
      DO                                                                01654000
         BEGIN                                                          01656000
         IF X <> FLCHECKSUMX THEN                                       01658000
            IF X <> FLMISCX THEN                                        01660000
               IF X <> FLCLIDX THEN                                     01662000
                  TOS:=TOS XOR FLAB'L(X);                               01664000
         X:=X-1;                                                        01666000
         END                                                            01668000
      UNTIL < ;                                                         01670000
      FLCHECKSUM:=TOS;                                                  01672000
      END #,                                                            01674000
                                                                        01676000
   INTERACTIVEbit = (15:01) #,<<bit in MODE returned by WHO>>           01678000
                                                                        01680000
   IS             = = #,                                                01682000
                                                                        01684000
   ISNT           = <> #,                                               01686000
                                                                        01688000
                                                                        01734000
   MOVE'FROM'TAPE'BUFF'TO'FLAB =                                        01736000
      IF USING'ATTIO THEN                                               01738000
         MOVE'DATA'IN (BUFFER'XDS (CURR'WAIT'BUFFER),          <<LB.RS>>01740000
                       BUFFER'OFFSET (CURR'WAIT'BUFFER),       <<LB.RS>>01741000
                       FLAB,                                   <<LB.RS>>01742000
                       FILE'LABEL'SIZE )                       <<LB.RS>>01743000
      ELSE                                                              01744000
         MOVE FLAB := TDBUF , (FILE'LABEL'SIZE) #,                      01746000
                                                               <<LB.RS>>01746090
   MOVE'TO'TAPE'LABEL          =                               <<LB.RS>>01746100
      IF USING'ATTIO THEN                                      <<LB.RS>>01746200
         MOVE'DATA'IN (BUFFER'XDS (CURR'WAIT'BUFFER),          <<LB.RS>>01746300
                       BUFFER'OFFSET (CURR'WAIT'BUFFER),       <<LB.RS>>01746310
                       TAPE'LABEL,                             <<LB.RS>>01746400
                       TAPE'LABEL'SIZE )                       <<LB.RS>>01746410
      ELSE                                                     <<LB.RS>>01746500
         MOVE TAPE'LABEL := TDBUF , (TAPE'LABEL'SIZE) #,       <<LB.RS>>01746600
                                                               <<LB.RS>>01746700
   MOVE'TO'TDBUF               =                               <<LB.RS>>01746800
      IF USING'ATTIO THEN                                      <<LB.RS>>01746900
         MOVE'DATA'IN (BUFFER'XDS (CURR'WAIT'BUFFER),          <<LB.RS>>01747000
                       BUFFER'OFFSET (CURR'WAIT'BUFFER),       <<LB.RS>>01747100
                       TDBUF,                                  <<LB.RS>>01747200
                       3 * FILE'PART'WORDS) #,                 <<LB.RS>>01747300
                                                               <<LB.RS>>01747600
                                                                        01748000
   MVTABXf        = (8:8) #,  <<GLINKAGE ????>>                         01750000
                                                                        01752000
   NONSYSTEM'VS   = GROUP'ENTRY(GLINKAGE).(PVF) = PV#,                  01754000
                                                                        01756000
   OLD'VTAB       = VTABINX (OLD'LDEV, PVMVTABX) #,                     01758000
                                                                        01760000
   OPT'FORWARD         =                                                01762000
$IF X9=ON THEN                                                          01764000
      OPTION FORWARD, UNCALLABLE                                        01766000
$IF                                                                     01768000
$IF X9=OFF THEN                                                         01770000
      OPTION UNCALLABLE;                                                01772000
      BEGIN                                                             01774000
      END                                                               01776000
$IF                                                                     01778000
           #,                                                           01780000
                                                                        01782000
   OPT'FORWARD'VARI    =                                                01784000
$IF X9=ON THEN                                                          01786000
      OPTION FORWARD, UNCALLABLE, VARIABLE                              01788000
$IF                                                                     01790000
$IF X9=OFF THEN                                                         01792000
      OPTION UNCALLABLE, VARIABLE;                                      01794000
      BEGIN                                                             01796000
      END                                                               01798000
$IF                                                                     01800000
         #,                                                             01802000
                                                                        01804000
   OPT'FORWARD'PRIV    =                                                01806000
$IF X9=ON THEN                                                          01808000
      OPTION FORWARD, UNCALLABLE, PRIVILEGED                            01810000
$IF                                                                     01812000
$IF X9=OFF THEN                                                         01814000
      OPTION UNCALLABLE, PRIVILEGED;                                    01816000
      BEGIN                                                             01818000
      END                                                               01820000
$IF                                                                     01822000
         #,                                                             01824000
                                                                        01826000
   POUT'OFFSET    = (@POUT-@OUTPUTBUFFER') #,                           01828000
                                                                        01830000
   PVf            = 0:1 #,                                              01832000
                                                                        01834000
   PV'FILESIZE    = 2048D #,                                            01836000
                                                                        01838000
   READ'GOOD'FILE =                                                     01840000
      BEGIN                                                             01842000
      FREAD (G'NUM, GBUF, G'RECSIZE);                                   01844000
      IF < THEN                                                         01846000
         FILE'FAIL (G'NUM, SR'G'READ'FAIL);                             01848000
      END #,                                                            01850000
   RECSIZE'FLAG   = (01:01)#, <<FEQ option bit for recsize>>            01852000
                                                                        01854000
   REWIND'GOOD'FILE=                                                    01856000
      BEGIN                                                             01858000
      IF FKONTROL (G'NUM, REWIND) = FAILED THEN                         01860000
         FILE'FAIL (NO'FILE, SR'G'NUM'REWIND); <<msg printed>>          01862000
      END #,                                                            01864000
                                                                        01866000
   SEND           = SEND'  #,                                           01868000
                                                                        01870000
   SETXPXFIXED    =                                                     01872000
      PUSH(DL);                                                         01874000
      X:=TOS-PS0(-2) #,       <<set X to point to PXFIXED area>>        01876000
                                                                        01878000
   SHRINK'STACK   =           <<restores original Z>>                   01880000
      BEGIN                                                             01882000
      IF OLD'ZSIZE <> 0 THEN                                            01884000
         ZSIZE (OLD'ZSIZE);                                             01886000
      END #,                                                            01888000
                                                                        01890000
   SUBTYPEf       = (05:03) #,<<DEVINFO field for subtype>>    <<06164>>01892000
                                                                        01894000
   TAPE'TYPEf     = (05:11) #,<<tape type field in device info>>        01896000
                                                               <<04726>>01898000
   TAPE'CLOSE'DISP= (IF LABELED THEN 1 ELSE 3)  #,             <<04726>>01900000
                                                                        01902000
   UNREAD'TAPE    = READ'WAS'ALREADY'DONE :=TRUE  #,                    01904000
                                                                        01906000
   UPDATE'GOOD'FILE =                                                   01908000
      BEGIN                                                             01910000
      FUPDATE (G'NUM, GBUF, G'RECSIZE);                                 01912000
      IF < THEN                                                         01914000
         FILE'FAIL (G'NUM, SR'G'UPDATE'FAIL);                           01916000
      END #,                                                            01918000
                                                                        01920000
                                                                        01924000
   WANT'JCW       = WANTS.(15:01) #,                                    01926000
                                                                        01928000
   WANT'MAIL      = WANTS.(14:01) #;                                    01930000
$PAGE "GLOBAL EQUATES -- MISCELLANEOUS"                                 01932000
EQUATE                                                                  01934000
   A'AGIPNTR      =  4  ,     <<ACCT-GROUP INDX PTR offset>>   <<LB.RS>>01934500
   A'AUIPNTR      =  5  ,                                      <<LB.RS>>01934600
   ATTIO'BSF      = 8  ,                                       <<LB.RS>>01935000
   ATTIO'BSR      = 12 ,                                       <<LB.RS>>01935100
   ATTIO'EOF      = 2  ,      <<ATTACHIO eof found         >>           01936000
   ATTIO'GOOD     = 1  ,                                                01938000
   ATTIO'PRIOR'ERROR = %43,                                    <<LB.RS>>01939000
   ATTIO'READ     = 0  ,      <<ATTACHIO read function code>>           01940000
   ATTIO'WRITE    = 1  ,      <<ATTACHIO write function code>>          01942000
   ATTIO'WTM      = 6  ,      <<ATTACHIO write tape mark func code>>    01944000
   ATTIO'FSF      = 7  ,      <<ATTACHIO file skip forward func code>>  01946000
                                                                        01948000
   BOTH'TRUE      = %(2)11  , <<2 TRUES >>                              01950000
   bufstat'EMPTY     = 0  ,   <<non-allocated XDS>>                     01952000
   bufstat'ALLOCATED = 1  ,   <<XDS has been allocated>>                01954000
   bufstat'LOCKED    = 2  ,   <<XDS has been locked>>                   01956000
   bufstat'FROZEN    = 3  ,   <<XDS has been frozen>>                   01958000
                                                                        01960000
   CALLER'FOPEN      = 1  ,                                             01962000
   CALLER'FCLOSE     = 2  ,                                             01964000
   CANDIDAT'BLOCKFACTOR = 16  ,                                         01966000
   CANDIDAT'EXTENTS     = 1    ,                                        01968000
   CCG            = 0  ,                                                01970000
   CCL            = 1  ,                                                01972000
   CCE            = 2  ,                                                01974000
   COLDLOADIDN    = %1075  ,  <<absolute address of coldload id>>       01976000
   COMMAND'TEXT'LEN    = 128 , <<one word shorter than we ...        >> 01978000
   COMMAND'TEXT''LEN   = 256 , <<allocated, to serve as overflow area>> 01980000
   CONDDISMOUNT'BIND = -3  ,                                            01982000
   CONDMOUNT'BIND    = -3  ,                                            01984000
   CTULv          = 1  ,      <<left tape cartridge>>                   01986000
   CTURv          = 2  ,      <<right tape cartridge>>                  01988000
                                                                        01990000
   D'BLOCKFACTOR  = 32 ,      <<direc file blockfactor>>                01992000
   D'RECSIZE      = 12 ,      <<direc file record size>>                01994000
   D'BLOCKSIZE    = D'RECSIZE * D'BLOCKFACTOR,                 <<LB.RS>>01995000
   DEFAULT'TAPE'RECSIZE=4096 ,<<default recsize for normal tape>>       01996000
   DATA'AREA'B    =  1  ,     <<For DIRREAD and DIRWRITE>>     <<LB.RS>>01997000
   DEN'OPTION     = 46  ,     <<FFILEINFO option for DENSITY>>          01998000
   DENVIOL        = 42  ,     <<file system err: density violation>>    02000000
   DIREC'MAX'RECSIZE= 4096  , <<max size for directory records>>        02002000
   DIRDST         = 20  ,     <<Directory Data Segment #>>     <<LB.RS>>02003000
                                                                        02004000
   EOTCODE        = 23  ,     <<error code signifying End Of Tape>>     02006000
   ERR'BAD'TAPE   = 1  ,      <<returned by TAPE'SWITCH, START'VOLUME>> 02008000
   ERR'CCL        = 1  ,                                                02010000
   ERR'CCG        = 2  ,                                                02012000
   ERR'WRONG'TAPE = 2  ,      <<returned by TAPE'SWITCH, START'VOLUME>> 02014000
                                                                        02016000
   FAILED         = 0      ,  <<Ret by various logical procs>> <<LB.RS>>02018000
   FILE'STORING   = 2                   , << File is being stored>>     02020000
   FILE'RESTORING = 3                   , << File is being restored>>   02022000
   FILE'LABEL'SIZE = 128  ,   <<size, in words, of a file label>>       02024000
   FILE'SIZE'MINv = 1  ,      <<find actual number of in-use sectors>>  02026000
   FILE'SIZE'MAXv = 2  ,      <<find number of allocated sectors>>      02028000
   FLABIO'HARD'ERR= 1  ,      <<FLABIO "hard error" return>>            02030000
   FLABIO'SOFT'ERR= 2  ,      <<FLABIO "soft error" return>>            02032000
   FLABIO'OK      = 0  ,      <<FLABIO "ok" return value>>              02034000
   FS'ACCT'DISC                               = 50,                     02036000
   FS'DEV'UNAVAIL                             = 55,                     02038000
   FS'DUP'PERM'FILE                           = 100,                    02040000
   FS'DUP'TEMP'FILE                           = 101,                    02042000
   FS'ERR'RECOVERED                           = 39,            <<04102>>02043000
   FS'FILE'ACCESSED                           = 90,                     02044000
   FS'FILE'EXCL'ACC                           = 91,                     02046000
   FS'GROUP'DISC                              = 61,                     02048000
   FS'LAB'END'OF'VOLUME'SET                   = 123,           <<LB.RS>>02048100
   FS'LOCKWORD'VIOL                           = 92,                     02050000
   FS'NO'ACCT                                 = 50,                     02052000
   FS'NO'FILE                                 = 52,                     02054000
   FS'NO'GROUP                                = 51,                     02056000
   FS'NO'UV'CAP                               = 112,                    02058000
   FS'OUT'OF'DISC'SPACE                       = 46,                     02060000
   FS'SECURITY'VIOL                           = 93,                     02062000
   FS'VS'NOT'MOUNTED                          = 113,                    02064000
                                                                        02066000
   GOOD           = 1     ,   <<  GOOD <==> NOT(FAILED)  >>    <<LB.RS>>02068000
   GOOD'SKIPFILE  = 3     ,   <<  GOOD but skipfile used >>    <<LB.RS>>02068100
   GOOD'SKIPRECORD= 5     ,   <<  GOOD but skiprecord used>>   <<LB.RS>>02068200
   GOT'SIR        = TRUE  ,   <<Passed to the file label procs>>        02070000
                                                                        02072000
   ITEM'DEVTYPE   = 41    ,   <<Item number for FFILEINFO >>            02074000
   ITEM'DEVSUBTYPE= 42    ,   <<Item number for FFILEINFO >>            02076000
   ITEM'LABADDR   = 19    ,   <<Item number for FFILEINFO >>            02078000
   ITEM'LDEV      = 50    ,   <<Item number for FFILEINFO >>            02078100
   ITEM'VIRT      = 51    ,   <<Item number for FFILEINFO >>            02078200
                                                                        02080000
   JCW'RESTORE'FAIL=1091  ,   <<value for CIERROR>>                     02082000
   JCW'STORE'FAIL = 1090  ,   <<value for CIERROR>>                     02084000
                                                                        02086000
   LOCK'FILE         = 1  ,   <<Passed to LOCK'UNLOCK'FILE>>            02088000
   LOCK'NOWv         = 0  ,   <<lock files at start...normal way>>      02090000
   LOCK'DELAYv       = 1  ,   <<lock files when needed, if we can>>     02092000
   LOCK'WAITv        = 2  ,   <<as above, but wait if needed to lock>>  02094000
   LOCK'NONEv        = 3  ,   <<never lock...let user beware!>>         02096000
                                                                        02098000
   MAGTAPE           = 24  ,  <<device tape of "mag tape">>             02100000
   MAX'7970'RECSIZE  = 4096  ,<<maximum recsize for normal tape>>       02102000
   MAX'7976'RECSIZE  = 8192  ,<<maximum for 7976 tape>>                 02104000
   MAX'ERROR'LEVEL   = 10,                                              02106000
   MAX'IO            = 10  ,     <<maximum   of pending IOs to tape>>   02108000
   MAX'NUM'XDS       = 12,    <<Must be greater than NUM'XDS>>          02110000
   MAX'TAPE'BUF'SIZE = MAX'7976'RECSIZE , <<maximum size of TDBUF>>     02112000
   MAX'PAT'LEN       = 9 ,    <<maximum length of encoded pattern>>     02114000
      MAX'PAT'LEN'2     = 2 * MAX'PAT'LEN ,                             02116000
      MAX'PAT'LEN'3     = 3 * MAX'PAT'LEN ,                             02118000
      MAX'PAT'LEN'4     = 4 * MAX'PAT'LEN ,                             02120000
      MAX'PAT'LEN'5     = 5 * MAX'PAT'LEN ,                             02122000
      LOOK'PATTERNS'LENGTH = 6 * MAX'PAT'LEN,                           02124000
   MAX'PAUSE'LOOPS= 200  ,    <<max   of PAUSE loops in CXSTORE>>       02126000
   MAX'SDISC'RECSIZE = 8192  ,<<maximum recsize for serial disc>>       02128000
   MAX'SYNCH'FILES= 10  ,     <<max files to be skipped >>     <<LB.RS>>02129000
   MIN'STACK'SIZE = 4096   ,  <<minimum size of stack excluding TDBUF>> 02130000
   MY'STACK       = 0  ,      <<denotes original stack/DB>>             02132000
                                                                        02134000
   NO'FILE        = -1  ,     <<used to call FAIL subroutines>>         02136000
   NOCREATE       = -3  ,     <<return from CHECK'DIREC >>              02138000
                                                                        02140000
   PARM'RESTORE   = 2  ,      <<PARM meaning RESTORE>>                  02142000
   PARM'STORE     = 1  ,      <<PARM meaning STORE>>                    02144000
   PARM'DBSTORE   = 3  ,      <<PARM meaning DBSTORE>>                  02146000
   PARM'SYSDUMP   = 4  ,      <<PARM meaning SYSDUMP>>                  02148000
   PARM'DBRESTORE = 5  ,      <<PARM meaning DBRESTOR>>                 02150000
   PARM'RELOAD    = 6  ,      <<PARM meaning RELOAD>>                   02152000
   PPR'LEN        = 31 ,                                                02154000
   PROCINFO'RET'SIZE = 28,                                     <<04870>>02156000
   PV             = 1  ,      <<GLINKAGE ????>>                         02158000
   PV'AOPTIONS    = %104  ,   <<EXC, read/write>>                       02160000
   PV'BLOCKFACTOR = 4  ,                                                02162000
   PV'BUFFERS     = 1  ,                                                02164000
   PV'EXTENTS'INITIAL = 1  ,                                            02166000
   PV'EXTENTS'MAX = 32  ,                                               02168000
   PV'FOPTIONS    = %2000  ,  <<noFEQ, fixed, filename, bin, new>>      02170000
   PV'RECSIZE     = 9  ,      <<group+acct=4 wds, mvtabinx = 1 wd>>     02172000
   pvinx'ACCT     = 4  ,      <<index of acct info in PV records>>      02174000
   pvinx'GROUP    = 0  ,      <<index of group info in PV records>>     02176000
   pvinx'PVINFO   = 8  ,      <<index of PVINFO in PV records>>         02178000
   PXFWCONT       = 33  ,     <<offset in PXFIXED of continue flag>>    02180000
                                                                        02182000
   RESTORINGv     = 2  ,      <<we are doing a RESTORE>>                02184000
                                                                        02186000
   SDISC          = 31  ,     <<device type of serial disc>>            02188000
   SOFTWARE'ABORT = 32  ,     <<filesys error caused by ABORTIO>>       02190000
   STORINGv       = 1  ,      <<we are doing a STORE>>                  02192000
   STDLIST'NUM    = 2  ,      <<usual file number of $STDLIST>>         02194000
   SUBTYPE'7970   = 0  ,      <<subtype for HP7970 tape>>               02196000
   SUBTYPE'7976   = 1  ,      <<subtype for HP7976 tape>>               02198000
   SYSDUMPINGv    = 3  ,      <<we are doing a SYSDUMP>>                02200000
   SYSDUMP'FIRST'RECORD'SIZE=32, <<size of 1st rec of 1st SYSDUMP reel>>02202000
                                                                        02204000
   TAPE'DIR'RECSIZE = 12  ,   <<  of words in tape directory recs>>     02206000
   TAPE'LABEL'SIZE  = 40  ,   <<  of words in tape label>>              02208000
   TEMP'REWIND    = 2  ,      <<FCLOSE disposition>>                    02210000
   TYPE'7970      = %030  ,   <<subtype/type from device info>>         02212000
   TYPE'7976      = %430  ,   <<subtype/type from device info>>         02214000
                                                                        02216000
   UNLOCK'FILE    = 0  ,      <<Passed to LOCK'UNLOCK'FILE>>            02218000
                                                                        02220000
   VERSION'1      = 1  ,      <<pre-MPE-2B STORE/RESTORE tape>>         02222000
   VERSION'2      = 2  ,      <<MPE2B-->MPE4 (MIT ?) STORE tape>>       02224000
   VERSION'3      = 3  ,      <<MPE4 (MIT ?+) STORE tape>>              02226000
   VMAX           = 8  ,      <<volume membership maximum>>             02228000
                                                                        02230000
   XDS'OVERHEAD   = 0   ;     <<communication area in XDS>>             02232000
$PAGE "GLOBAL EQUATES -- MISCELLANEOUS"                                 02234000
EQUATE                                                                  02236000
                                                                        02238000
      <<SIRs...>>                                                       02240000
                                                                        02242000
   DSIR           =  8,       <<directory SIR>>                         02244000
   FISIR          = 37,       <<file integrity SIR>>                    02246000
                                                                        02248000
      <<MAIL equates...>>                                               02250000
                                                                        02252000
   MAIL'OVERALL   = 0,        <<overall result= GOOD/FAILED>>           02254000
   MAIL'WHY       = 1,        <<WHY error code (see below)>>            02256000
   MAIL'BAD       = 2,        <<mail message index>>                    02258000
   MAIL'GOOD      = 3,        <<# of files STOREd/RESTOREd>>            02260000
                                                                        02262000
   MAIL'LENGTH    = 4,        <<number of words in MAIL message>>       02264000
                                                                        02266000
   WHY'GOOD       = 0,        <<no error found>>                        02268000
   WHY'SYNTAX     = 1,        <<parsing syntax>>                        02270000
   WHY'OPENING'FILES=2,       <<opening utility files>>                 02272000
   WHY'INDIRECT   = 3,        <<opening indirect file>>                 02274000
   WHY'OPENING'TAPE=4,        <<opening tape file>>                     02276000
   WHY'SCANNING   = 5,        <<scanning files to STORE/RESTORE>>       02278000
   WHY'DOING      = 6,        <<doing actual STORE/RESTORE>>            02280000
                                                                        02282000
      <<FCONTROL equates...>>                                           02284000
                                                                        02286000
   REWIND         =  5,                                                 02288000
   WEOF           =  6,                                                 02290000
   FSF            =  7,                                                 02292000
   BSF            =  8,                                                 02294000
   REWIND'UNLOAD  =  9,                                                 02296000
                                                                        02298000
                                                                        02300000
      <<Account entry equates..>>                                       02302000
   A'SEC'INX      = 26,                                                 02304000
   A'SIZE         = 29,                                                 02306000
                                                                        02308000
      <<Lock equates - FLSTORERESTORE..>>                               02310000
   NO'LOCKv       = 0,                                                  02312000
   STORE'LOCKv    = 2,                                                  02314000
   RESTORE'LOCKv  = 3,                                                  02316000
                                                                        02318000
      <<Group entry equates..>>                                         02320000
                                                                        02322000
   NAMESIZE       = 4,                                                  02324000
   GROUP'INX      = 0,                 <<name>>                         02326000
   GFIPNTR        = GROUP'INX+NAMESIZE,<<file index pointer>>           02328000
   GPASS          = GFIPNTR+1,         <<password>>                     02330000
   GDFSCOUNT      = GPASS+NAMESIZE,    <<disc file space>>              02332000
   GDFSLIMIT      = GDFSCOUNT+2,                                        02334000
   GCPUCOUNT      = GDFSLIMIT+2,       <<cpu time>>                     02336000
   GCPULIMIT      = GCPUCOUNT+2,                                        02338000
   GCONTIMECOUNT  = GCPULIMIT+2,                                        02340000
   GCONTIMELIMIT  = GCONTIMECOUNT+2,                                    02342000
   G'SEC          = GCONTIMELIMIT+2,                                    02344000
   GPURGEFLAGW    = G'SEC,                                              02346000
   GCAP           = G'SEC+2,                                            02348000
   GLINKAGE       = GCAP+1,                                             02350000
   GVSDIPNTR      = GLINKAGE+1,        <<VS def index pointer>>         02352000
   GHVSNAME       = GVSDIPNTR+1,       <<home VS name>>                 02354000
   GHVSANAME      = GHVSNAME,          << "   "  ACCT name>>            02356000
   GHVSGNAME      = GHVSANAME+NAMESIZE,<< "   "  GRP  name>>            02358000
   GHVSVSNAME     = GHVSGNAME+NAMESIZE,<< "   "  VS   name>>            02360000
   GHVSVSNAME'    = GHVSVSNAME * 2,    << "   "  "    "   >>            02362000
   GSAVEFIPNTR    = GHVSVSNAME+NAMESIZE,<<saves GFIPNTR>>               02364000
   GMOUNTREFCNTR  = GSAVEFIPNTR+1,     <<mount use counter>>            02366000
   GSPARE         = GMOUNTREFCNTR+1,                                    02368000
   GSIZE          = GSPARE+1,                                           02370000
   GSIZE'D        = (GSIZE+1)/2,       <<used to declare double arr>>   02372000
                                                                        02374000
                                                                        02376000
      <<CALLERs of CXSTORE/CXRESTORE...>>                               02378000
                                                                        02380000
   CALLER'CI      = 0,        <<caller is the CI>>                      02382000
   CALLER'CI'COMMAND = 1,     <<caller is the CI, from COMMAND int>>    02384000
   CALLER'SYSDUMP = 2,        <<caller is SYSDUMP>>                     02386000
   CALLER'DBSTORE = 3,        <<caller is DBSTORE>>                     02388000
                                                                        02390000
                                                                        02392000
      <<ONERROR Equates...>>                                            02394000
                                                                        02396000
   ONERR'QUIT     = 0,        <<terminate upon error>>                  02398000
   ONERR'SKIPFILE = 1,                                                  02400000
   ONERR'SKIPRECORD=2,                                                  02402000
   ONERR'REDO     = 3,                                                  02404000
   ONERR'SKIP     = 4,                                                  02406000
                                                                        02408000
      <<PARSE'NAME Equates...>>                                         02410000
                                                                        02412000
   PN'NAME'TOO'LONG         = 1,                                        02414000
   PN'EMPTY'NAME            = 2,                                        02416000
   PN'BACK'ILLEGAL          = 3,                                        02418000
   PN'MUST'START'WITH'ALPHA = 4,                                        02420000
   PN'ILLEGAL'CHARACTER     = 5,                                        02422000
   PN'WILDCARDS'ILLEGAL     = 6,                                        02424000
                                                                        02426000
      <<RECOVER'ERROR Equates...>>                                      02428000
   SKIPPINGv                = 0,                                        02430000
   READINGv                 = 1;                                        02432000
                                                                        02434000
$PAGE "GLOBAL DEFINES -- DIRECSCAN"                                     02436000
DEFINE                                                                  02438000
                                                                        02440000
         <<defines for TYPE parameter to DIRECSCAN...>>                 02442000
                                                                        02444000
   ALLFLAG        = (09:1) #,                                           02446000
   ENDLEVELF      = (10:3) #,                                           02448000
   ENDLEVELFX     = (09:4) #,                                           02450000
   HITFLAG        = (05:1) #,                                           02452000
   STARTLEVELF    = (13:3) #,                                           02454000
   TOLEVELF       = (06:3) #,                                           02456000
                                                                        02458000
         <<defines for starting a direcscan...>>                        02460000
                                                                        02462000
   START'ACCT     = 1 #,                                                02464000
   START'GROUP    = 2 #,                                                02466000
   START'ROOT     = 0 #,                                                02468000
                                                                        02470000
         <<endlevel defines...>>                                        02472000
                                                                        02474000
   FILELEVEL      = 0 #,                                                02476000
   GROUPLEVEL     = 1 #,                                                02478000
   ACCTLEVEL      = 2 #,                                                02480000
   USERLEVEL      = 3 #,                                                02482000
                                                                        02484000
         <<defines for terminating a DIRECSCAN...>>                     02486000
                                                                        02488000
   SKIPNODE       = 2 #,                                                02490000
   SKIPTREE       = 2 #,                                                02492000
   RC'STOP        = 4 #;                                                02494000
$PAGE "GLOBAL DEFINES -- SCANNER DEFINES"                               02496000
EQUATE                                                                  02498000
                                                                        02500000
      <<Scanner equates...>>                                            02502000
                                                                        02504000
         <<ICLASS/STEPIT values...>>                                    02506000
                                                                        02508000
   ENDLINEv       = -1,       <<end-of-line encountered>>               02510000
   TOKENv         = -2,       <<token (identifier) found>>              02512000
   NUMBERv        = -3,       <<integer number found>>                  02514000
   SPECIALv       = -4,       <<special character found>>               02516000
   STRINGv        = -5,       <<quoted string found>>                   02518000
   DNUMBERv       = -6,       <<double precision number found>>         02520000
   UNKNOWNv       = -7;       <<STEPIT not yet done, or did UNSTEPIT>>  02522000
                                                                        02524000
DEFINE                                                                  02526000
                                                                        02528000
         <<defines to simplify using the scanner...>>                   02530000
                                                                        02532000
   DEBUG'SCANNER  = DEBUG'SCANNER' #,                                   02534000
   STEPIT         = STEPIT' #,                                          02536000
   UNSTEPIT       =                                                     02538000
      BEGIN                                                             02540000
      ILEN:=0;                                                          02542000
      ICLASS:=UNKNOWNv;                                                 02544000
      SUBCLASS'D:=0D;                                                   02546000
      ILEFT:=INPUTLEN-ITEMP'OFFSET;                                     02548000
      END #;                                                            02550000
$PAGE "GLOBAL DEFINES -- FILE LABEL DEFINES"                            02552000
DEFINE                                                                  02554000
         <<FLAB   (file label) defines...>>                             02556000
                                                                        02558000
   FL'GROUP''INX  = 8 #,               <<byte inx of group name>>       02560000
   FL'ACCT''INX   = 16 #,              <<byte inx of acct name>>        02562000
   FL'SR'RELEASE'INX = 22 #,           <<security status word index>>   02564000
   FLMISCX        = 28 #,              <<misc word index>>              02566000
   FLCHECKSUMX    = 34 #,              <<checksum index>>               02568000
   FLCLIDX        = 35 #,              <<cold load index>>              02570000
                                                                        02572000
   FLLOCNAME      = FLAB  #,                                            02574000
   FLLOCNAME'     = FLAB' #,                                            02576000
   FLGRPNAME      = FLAB   (4) #,                                       02578000
   FLGRPNAME'     = FLAB'  (8) #,                                       02580000
   FLACCTNAME     = FLAB   (8) #,                                       02582000
   FLACCTNAME'    = FLAB'  (16) #,                                      02584000
   FLUSERID       = FLAB   (12) #,                                      02586000
   FLUSERID'      = FLAB'  (24) #,                                      02588000
   FLLOCKWORD     = FLAB   (16) #,                                      02590000
   FLLOCKWORD'    = FLAB'  (32) #,                                      02592000
   FLSECMX        = FLAB'D (10) #,                                      02594000
   FLSECMX1       = FLAB   (20) #,                                      02596000
   FLSECMX2       = FLAB   (21) #,                                      02598000
   FLSECWORD      = FLAB'L (22) #,                                      02600000
   FLSECURE       = FLSECWORD.(15:01) #, <<1=SECUREd, 0=RELEASEd>>      02602000
   FL'SR'RELEASE  = FLSECWORD.(14:01) #, << 1 = ;RELEASEd on tape>>     02604000
   FL'SR'RELEASE'BIT =        (14:01) #,                                02606000
   FL'BAD'FILE    = FLSECWORD.(13:01) #, <<1=file isn't here! >>        02608000
   FL'BAD'FILE'BIT=           (13:01) #,                                02610000
   FLCREATE       = FLAB'L (23) #,                                      02612000
   FLLASTACC      = FLAB'L (24) #,                                      02614000
   FLLASTMOD      = FLAB'L (25) #,                                      02616000
   FLFILECODE     = FLAB   (26) #,                                      02618000
   FLPVINFO       = FLAB   (27) #,                             <<LB.36>>02620000
   FLUSAGE        = FLAB'L (28) #,                                      02622000
   FLSTORE        = FLUSAGE.(00:01) #, <<file being STOREd>>            02624000
   FLRESTORE      = FLUSAGE.(01:01) #, <<file being RESTOREd>>          02626000
   FLSTORERESTORE = FLUSAGE.(00:02) #, <<file being STOREd/RESTOREd>>   02628000
   FLLOADED       = FLUSAGE.(02:01) #, <<file is loaded>>               02630000
   FLSRL          = FLUSAGE.(00:03) #, <<Store/Restore/Loaded>>         02632000
   FLSRLX         = FLUSAGE.(00:04) #, <<Store/Restore/Loaded/Xeq>>     02634000
   FLDEVTYPE      = FLUSAGE.(08:06) #, <<device type>>                  02636000
   FLDEVSUBTYPE   = FLUSAGE.(04:04) #, <<device subtype>>               02638000
   FLWRITE        = FLUSAGE.(14:01) #, <<file open for writing>>        02640000
   FLREAD         = FLUSAGE.(15:01) #, <<file open for reading>>        02642000
   FLRW           = FLUSAGE.(14:02) #, <<file open>>                    02644000
   FLUSERLBL      = FLAB'L (29) #,                                      02646000
   FLUSERLBL'AVAIL= FLUSERLBL.(08:08) #,                                02648000
   FLFLIM         = FLAB'D (15) #,                                      02650000
   FLFCBVECT      = FLAB'D (16) #,                             <<LB.36>>02651000
   FLCHECKSUM     = FLAB   (34) #,                                      02652000
   FLCLID         = FLAB   (35) #,                                      02654000
   FLFOPTIONS     = FLAB   (36) #,                                      02656000
   FLRECSIZE      = FLAB   (37) #,                                      02658000
   FLBLKSIZE      = FLAB   (38) #,                                      02660000
   FLLAYOUT       = FLAB   (39) #,                                      02662000
   FLSECTOFF      = FLLAYOUT.(00:08) #, <<sector offset>>               02664000
   FLDFLAGS       = FLLAYOUT.(08:04) #, <<disk flags>>                  02666000
   FLNUMEXTS      = FLLAYOUT.(11:05) #, <<number of extents>>           02668000
   FLLASTEXTSIZE  = FLAB   (40) #,                                      02670000
   FLLASTEXTSIZE'D= DOUBLE (LOGICAL (FLLASTEXTSIZE)) #,                 02672000
   FLEXTSIZE      = FLAB   (41) #,                                      02674000
   FLEXTSIZE'L    = FLAB'L (41) #,                                      02676000
   FLEXTSIZE'D    = DOUBLE (FLEXTSIZE'L) #,                             02678000
   FLEOF          = FLAB'D (21) #,                                      02680000
   EXTMAP'INX     = 44          #,                                      02682000
   FLEXTMAP       = FLAB   (44) #,                                      02684000
   EXTMAP'INX'D   = 22          #,                                      02686000
   FLEXTMAP'D     = FLAB'D (22) #,                                      02688000
   FLEXTMAP'D'1   = FLAB'D (23) #,                                      02690000
   FLALLOCTIME    = FLAB'D (54) #,                                      02692000
   FLALLOCDATE    = FLAB   (110) #,                                     02694000
   FLALLOCDATE'L  = FLAB'L (110) #,                                     02696000
   FLCLASS        = FLAB   (124) #,                                     02698000
   FLCLASS'       = FLAB'  (248) #;                                     02700000
                                                                        02702000
                                                                        02704000
DEFINE                                                                  02706000
   OLD'LOCKWORD'      = OLD'FLAB'   (32)           #,                   02708000
   OLD'FLSECMX        = OLD'FLAB'D  (10)           #,                   02710000
   OLD'SECURE         = OLD'FLAB'L (22).(15:01)    #,          <<LB.RS>>02711000
   OLD'FCODE          = OLD'FLAB    (26)           #,                   02712000
   OLD'USAGE          = OLD'FLAB'L  (28)           #,                   02714000
   OLD'FLSTORERESTORE = OLD'USAGE.(00:02)          #,                   02716000
   OLD'FLSRLX         = OLD'USAGE.(00:04)          #,                   02718000
   OLD'LOADED         = OLD'USAGE.(02:01)          #,          <<LB.RS>>02720000
   OLD'EXCL'ACC       = OLD'USAGE.(03:01)          #,          <<LB.RS>>02722000
   OLD'FLRW           = OLD'USAGE.(14:02)          #,                   02724000
   OLD'WRITING        = OLD'FLRW = 1               #,                   02726000
   OLD'READING        = OLD'FLRW = 2               #,                   02728000
   OLD'RW             = OLD'FLRW = 3               #,                   02730000
   OLD'FLCLID         = OLD'FLAB (35)              #,                   02732000
   OLD'NUMEXTS        = OLD'FLAB (39).(11:05)      #,                   02734000
   OLD'LASTEXTSIZE    = OLD'FLAB'L (40)            #,                   02736000
   OLD'LASTEXTSIZ'D   = DOUBLE (OLD'LASTEXTSIZE)   #,                   02738000
   OLD'EXTSIZE        = OLD'FLAB'L (41)            #,                   02740000
   OLD'EXTSIZE'D      = DOUBLE (OLD'EXTSIZE)       #,                   02742000
   OLD'EXTMAPD        = OLD'FLAB'D (22)            #;                   02744000
$PAGE "GLOBAL DEFINES -- STANDARD FORM FILE TITLES"                     02746000
DEFINE                                                                  02748000
         <<standard form title defines...>>                             02750000
                                                                        02752000
   STD'LEN'TOTAL  = ISTD (00) #, <<integer: length in bytes, inclu>>    02754000
   STD'VERSION    = PSTD (02) #,       <<std-form version id (=1) >>    02756000
   STD'INFO       = PSTD (03) #,       <<info bits:               >>    02758000
   STD'BACKREF    = STD'INFO.(13:1) #, <<  1 = back referenced    >>    02760000
   STD'DOLLAR     = STD'INFO.(14:1) #, <<  1 = dollar sign        >>    02762000
   STD'WILD       = STD'INFO.(15:1) #, <<  1 = wildcards in title >>    02764000
   STD'FILE'INX   = PSTD (04) #,       <<byte index of file part  >>    02766000
   STD'LOCK'INX   = PSTD (05) #,       <<byte index of lock part  >>    02768000
   STD'GROUP'INX  = PSTD (06) #,       <<byte index of group part >>    02770000
   STD'ACCT'INX   = PSTD (07) #,       <<byte index of acct part  >>    02772000
   STD'FAMILY'INX = PSTD (08) #,       <<byte index of family part>>    02774000
   STD'HOST'INX   = PSTD (09) #,       <<byte index of host part  >>    02776000
                                                                        02778000
   STD'FILE'PARTS = PSTD (STD'FILE'INX-1)#,  <<# file parts  (:=1)>>    02780000
   STD'FILE'INFO  = PSTD (STD'FILE'INX) #,   <<file info bits:    >>    02782000
   STD'FILE'WILD  = STD'FILE'INFO.(8:1) #,   << 1 = wildcards     >>    02784000
   STD'FILE'LEN   = STD'FILE'INFO.(9:7) #,   << length (0 to 8)   >>    02786000
   STD'PART'LENf  = (9:7) #,                                            02788000
   STD'FILE'      = PSTD (STD'FILE'INX+1) #, <<pointer to file txt>>    02790000
                                                                        02792000
   STD'LOCK'INFO  = PSTD (STD'LOCK'INX) #,   <<lock info bits:    >>    02794000
   STD'LOCK'WILD  = STD'LOCK'INFO.(8:1) #,   << 1 = wildcards     >>    02796000
   STD'LOCK'LEN   = STD'LOCK'INFO.(9:7) #,   << length (0 to 8)   >>    02798000
   STD'LOCK'      = PSTD (STD'LOCK'INX+1) #, <<pointer to lock txt>>    02800000
                                                                        02802000
   STD'GROUP'INFO = PSTD (STD'GROUP'INX) #,  <<group info bits:    >>   02804000
   STD'GROUP'WILD = STD'GROUP'INFO.(8:1) #,  << 1 = wildcards     >>    02806000
   STD'GROUP'LEN  = STD'GROUP'INFO.(9:7) #,  << length (0 to 8)   >>    02808000
   STD'GROUP'     = PSTD (STD'GROUP'INX+1) #,<<pointer to group txt>>   02810000
                                                                        02812000
   STD'ACCT'INFO  = PSTD (STD'ACCT'INX) #,   <<acct info bits:    >>    02814000
   STD'ACCT'WILD  = STD'ACCT'INFO.(8:1) #,   << 1 = wildcards     >>    02816000
   STD'ACCT'LEN   = STD'ACCT'INFO.(9:7) #,   << length (0 to 8)   >>    02818000
   STD'ACCT'      = PSTD (STD'ACCT'INX+1) #, <<pointer to acct txt>>    02820000
                                                                        02822000
   STD'FAMILY'INFO= PSTD (STD'FAMILY'INX) #, <<family info bits:  >>    02824000
   STD'FAMILY'WILD= STD'FAMILY'INFO.(8:1) #, << 1 = wildcards     >>    02826000
   STD'FAMILY'LEN = STD'FAMILY'INFO.(9:7) #, << length (0 to 8)   >>    02828000
   STD'FAMILY'    = PSTD (STD'FAMILY'INX+1)#,<<pntr to family txt >>    02830000
                                                                        02832000
   STD'HOST'INFO  = PSTD (STD'HOST'INX) #,   <<host info bits:    >>    02834000
   STD'HOST'WILD  = STD'HOST'INFO.(8:1) #,   << 1 = wildcards     >>    02836000
   STD'HOST'LEN   = STD'HOST'INFO.(9:7) #,   << length (0 to 8)   >>    02838000
   STD'HOST'      = PSTD (STD'HOST'INX+1) #, <<pointer to host txt>>    02840000
                                                                        02842000
                                                                        02844000
   ALLOW'IMBEDDED'BLANKS'bit  = (00:01) #,                              02846000
   ALLOW'LEAD'BLANKS'bit      = (01:01) #,                              02848000
                                                                        02850000
   ALLOW'BACKREF'bit          = (06:01) #,                              02852000
   ALLOW'DOLLAR'bit           = (07:01) #,                              02854000
   ALLOW'WILD'bit             = (08:01) #,                              02856000
 <<ALLOW'FILE'bit             = (09:01) #,   always true!!>>            02858000
   ALLOW'MULTI'FILE'PARTS'bit = (10:01) #,                              02860000
   ALLOW'LOCK'bit             = (11:01) #,                              02862000
   ALLOW'GROUP'bit            = (12:01) #,                              02864000
   ALLOW'ACCT'bit             = (13:01) #,                              02866000
   ALLOW'FAMILY'bit           = (14:01) #,                              02868000
   ALLOW'HOST'bit             = (15:01) #;                              02870000
$PAGE "GLOBAL DEFINES -- PATTERN MATCHING"                              02872000
DEFINE                                                                  02874000
                                                                        02876000
   PAT'MAX'FIRM      = 8 #,    <<max number of firm chars>>             02878000
   PAT'MAX'PART      = 8 #,    <<max number of pattern parts>>          02880000
                                                                        02882000
   PATCHARf          = (8:8) #,                                         02884000
   PATLENf           = (2:6) #,                                         02886000
   PATTYPEf          = (0:2) #;                                         02888000
                                                                        02890000
EQUATE                                                                  02892000
                                                                        02894000
      <<values found in the PATTYPEf field...>>                         02896000
                                                                        02898000
   ANYONECHARACTERp  = 0,     <<a CASE statement in SUB'MATCH >>        02900000
   ANYCHARACTERSp    = 1,     <<depends                       >>        02902000
   DIGITONLYp        = 2,     <<        on this               >>        02904000
   EXACTp            = 3,     <<                ordering!     >>        02906000
                                                                        02908000
      <<PATTERN'BUILD errors...>>                                       02910000
                                                                        02912000
   PB'ERR'MANY'FIRM  = 1,     <<more than 8 'firm' chars were found>>   02914000
   PB'ERR'MANY'PARTS = 2;     <<more than 8 parts were found>>          02916000
$PAGE "GLOBAL EQUATES -- GOOD FILE RECORDS"                             02918000
                                                                        02920000
<<The following is the layout of every record in the GOOD               02922000
  file (whose file number is G'NUM)...                                  02924000
                                                                        02926000
   Byte  Integer  Double     Contents                                   02928000
   Index Index    Index      of array...                                02930000
   ----- -------  ------    ----------------------------------          02932000
      -       -       0     ! File # (from 1 to #of file to be          02934000
                            ! STOREd/RESTOREd)...is a double            02936000
                            ! integer.                                  02938000
                            !---------------------------------          02940000
      -       2       -     ! reel number file is STOREd on ...         02942000
                            ! zero for RESTORE.                         02944000
                            !---------------------------------          02946000
      -       3       -     ! SR flag bits:                             02948000
                            ! 15:01  1 = file is locked.                02950000
                            !        0 = file is unlocked.              02952000
                            !---------------------------------          02954000
      -       4       -     ! PVINFO and flags.                         02956000
                            ! (as returned by MOUNT routine)            02958000
                            ! is 0 if not a private volume.             02960000
                            !---------------------------------          02962000
      -       5       -     ! ldev # of the file's label.               02964000
                            !---------------------------------          02966000
      -       -       3     ! address of file label (is a double        02968000
                            ! integer sector address).                  02970000
                            !---------------------------------          02972000
      16      8       4     ! file part (8 bytes, left justified,       02974000
                            ! blank filled).                            02976000
                            !---------------------------------          02978000
      24      12      6     ! group part (8 bytes...)                   02980000
                            !---------------------------------          02982000
      32      16      8     ! acct part (8 bytes...)                    02984000
                            !---------------------------------          02986000
                                                                        02988000
   The equates used to access byte items end with:  INX'                02990000
   Those used to access integer items end with:     INX                 02992000
   Those used for doubles:                          INX'D               02994000
                                                                        02996000
   ------------------------------------------------------------>>       02998000
                                                                        03000000
EQUATE                                                                  03002000
   G'ACCT'INX     = 16,                                                 03004000
   G'ACCT'INX'    = 32,                                                 03006000
   G'ADDRESS'INX'D=  3,                                                 03008000
   G'EXTSIZE'INX'D= 11,                                                 03010000
   G'FILE'INX     =  8,                                                 03012000
   G'FILE'INX'    = 16,                                                 03014000
   G'FILE'SECTORS'INX'D = 10,                                           03016000
   G'FILENUM'INX'D=  0,                                                 03018000
   G'FLAGS'INX    =  3,                                                 03020000
   G'GROUP'INX    = 12,                                                 03022000
   G'GROUP'INX'   = 24,                                                 03024000
   G'LDEV'INX     =  5,                                                 03026000
   G'PVINFO'INX   =  4,                                                 03028000
   G'REEL'INX     =  2,                                                 03030000
   G'TITLE'INX    =  8,                                                 03032000
   G'TITLE'INX'   = G'FILE'INX',                                        03034000
                                                                        03036000
      <<------>>                                                        03038000
                                                                        03040000
   G'RECSIZE      = 24;                                                 03042000
                                                                        03044000
DEFINE                                                                  03046000
   G'LOCKED'bit   = GBUF (G'FLAGS'INX).(15:01) #,                       03048000
   G'IGNORE'bit   = GBUF (G'FLAGS'INX).(14:01) #,                       03050000
   G'PURGE'bit    = GBUF (G'FLAGS'INX).(13:01) #;                       03050100
$PAGE "ATTACHIO DCL'S"                                                  03052000
$IF X9=ON THEN                                                          03054000
      DOUBLE ARRAY                                                      03056000
         IO'QUEUE'D    (0:MAX'IO*MAX'NUM'XDS);                          03058000
      DOUBLE ARRAY                                             <<LB.RS>>03060000
         IOQ'FSF'D      (0:1);                                 <<LB.RS>>03062000
                                                               <<LB.RS>>03063000
      INTEGER ARRAY                                            <<LB.RS>>03063100
         IOQ'FSF (*)   = IOQ'FSF'D;                            <<LB.RS>>03063200
                                                                        03064000
      INTEGER                                                           03066000
         CURR'READ'BUFFER,                                     <<LB.RS>>03068000
         CURR'WAIT'BUFFER,                                     <<LB.RS>>03069000
         NUM'BUFFERS,                                                   03072000
         FSF'SEQ;                                                       03074000
                                                                        03076000
      INTEGER ARRAY                                                     03078000
         IO'QUEUE      (*)     = IO'QUEUE'D,                            03080000
         IO'LEN        (0:MAX'IO*MAX'NUM'XDS),                          03082000
         BUFFER'XDS    (0:MAX'IO*MAX'NUM'XDS),                          03084000
         BUFFER'OFFSET (0:MAX'IO*MAX'NUM'XDS),                          03086000
         XDS'NUM       (0:MAX'NUM'XDS),                        <<LB.RS>>03087000
         XDS'STATUS    (0:MAX'NUM'XDS);                        <<LB.RS>>03088000
$IF                                                                     03090000
$PAGE "DCL'S"                                                           03092000
INTEGER ARRAY                                                           03094000
   COMMAND'TEXT (0:COMMAND'TEXT'LEN),                                   03096000
   CURR'ACCT    (0:FILE'PART'WORDS-1),                                  03098000
   CURR'GROUP   (0:FILE'PART'WORDS-1),                                  03100000
   CURR'FILE    (0:FILE'PART'WORDS-1),                                  03102000
   DEVICEINFO   (0:1+SIZE'OF'LDT'ENTRY+SIZE'OF'LPDT'ENTRY),    <<LB.RS>>03104000
   FLAB         (0:FILE'LABEL'SIZE+1),                                  03106000
   GROUP'ENTRY  (0:GSIZE),                                              03108000
   HOME'GROUP   (0:FILE'PART'WORDS-1),                                  03110000
   LAST'ACCT    (0:FILE'PART'WORDS - 1),                                03112000
   LAST'USER   (0:FILE'PART'WORDS - 1),                        <<LB.RS>>03113000
   LAST'GROUP   (0:FILE'PART'WORDS - 1),                                03114000
   LAST'RES'USER  (0:FILE'PART'WORDS - 1),                     <<LB.RS>>03115000
   LOOK'LOCK    (0:FILE'PART'WORDS - 1),                                03116000
   LOGON'ACCT   (0:FILE'PART'WORDS - 1),                                03118000
   LOGON'GROUP  (0:FILE'PART'WORDS - 1),                                03120000
   LOGON'USER   (0:FILE'PART'WORDS - 1),                                03122000
   LOOK'PATTERNS(0:6*MAX'PAT'LEN),                                      03124000
   LOOK'ACCT    (0:FILE'PART'WORDS - 1),                                03126000
   LOOK'ACCT'PAT (*) = LOOK'PATTERNS (MAX'PAT'LEN'2),                   03128000
   LOOK'FILE    (0:FILE'PART'WORDS - 1),                                03130000
   LOOK'FILE'PAT (*) = LOOK'PATTERNS (0),                               03132000
   LOOK'GROUP   (0:FILE'PART'WORDS - 1),                                03134000
   LOOK'GROUP'PAT(*) = LOOK'PATTERNS (MAX'PAT'LEN),                     03136000
   NOT'ACCT'PAT  (*) = LOOK'PATTERNS (MAX'PAT'LEN'5),                   03138000
   NOT'GROUP'PAT (*) = LOOK'PATTERNS (MAX'PAT'LEN'4),                   03140000
   NOT'FILE'PAT  (*) = LOOK'PATTERNS (MAX'PAT'LEN'3),                   03142000
   OLD'FLAB     (0:FILE'LABEL'SIZE),                                    03144000
   RES'TITLE    (0:4*FILE'PART'WORDS),                                  03146000
   RES'ACCT     (*) = RES'TITLE (FILE'2'PART'WORDS),                    03148000
   RES'CREATOR  (*) = RES'TITLE (FILE'3'PART'WORDS),                    03150000
   RES'FILE     (*) = RES'TITLE ,                                       03152000
   RES'GROUP    (*) = RES'TITLE (FILE'PART'WORDS),                      03154000
   TAPE'LABEL  (0:TAPE'LABEL'SIZE),                                     03156000
   TAPE'NAME   (0:FILE'PART'WORDS);                                     03158000
LOGICAL ARRAY                                                           03160000
   DEVICE     (0:FILE'PART'WORDS),                                      03162000
   FLAB'L     (*) = FLAB,                                               03164000
   OLD'FLAB'L (*) = OLD'FLAB,                                           03166000
   TAPE'LABEL'L (*) = TAPE'LABEL;                                       03168000
DOUBLE ARRAY                                                            03170000
   FLAB'D      (*) = FLAB,                                              03172000
   GROUP'ENTRY'D (*) = GROUP'ENTRY,                                     03174000
   OLD'FLAB'D  (*) = OLD'FLAB;                                          03176000
BYTE ARRAY                                                              03178000
   COMMAND'TEXT' (*) = COMMAND'TEXT,                                    03180000
   CURR'ACCT'    (*) = CURR'ACCT,                                       03182000
   CURR'GROUP'   (*) = CURR'GROUP,                                      03184000
   CURR'FILE'    (*) = CURR'FILE,                                       03186000
   CURR'TITLE'   (0:MAX'STD'LEN),                                       03188000
   DEVICE' (*)   = DEVICE,                                              03190000
   FLAB'   (*)   = FLAB,                                                03192000
   FLAB'LOCK'(*) = FLLOCKWORD',                                         03194000
   GROUP'ENTRY'(*) = GROUP'ENTRY,                                       03196000
   HOME'GROUP' (*) = HOME'GROUP,                                        03198000
   LAST'ACCT'  (*) = LAST'ACCT,                                         03200000
   LAST'USER' (*) = LAST'USER,                                 <<LB.RS>>03201000
   LAST'GROUP' (*) = LAST'GROUP,                                        03202000
   LAST'RES'USER' (*) = LAST'RES'USER,                         <<LB.RS>>03203000
   LAST'TITLE' (0:MAX'STD'LEN),                                <<04871>>03204000
   LOOK'LOCK'  (*) = LOOK'LOCK,                                         03206000
   LOGON'ACCT' (*) = LOGON'ACCT,                                        03208000
   LOGON'GROUP'(*) = LOGON'GROUP,                                       03210000
   LOGON'USER' (*) = LOGON'USER,                                        03212000
   LOOK'ACCT'  (*) = LOOK'ACCT,                                         03214000
   LOOK'FILE'  (*) = LOOK'FILE,                                         03216000
   LOOK'GROUP' (*) = LOOK'GROUP,                                        03218000
   LOOK'TITLE' (0:MAX'STD'LEN),                                <<04871>>03220000
   NOT'TITLE'  (0:MAX'STD'LEN),                                <<04871>>03222000
   OLD'FLAB'   (*) = OLD'FLAB,                                          03224000
   RES'ACCT'   (*) = RES'ACCT,                                          03226000
   RES'CREATOR'(*) = RES'CREATOR,                                       03228000
   RES'FILE'   (*) = RES'FILE,                                          03230000
   RES'GROUP'  (*) = RES'GROUP,                                         03232000
   TAPE'LABEL' (*) = TAPE'LABEL,                                        03234000
   TAPE'NAME'  (*) = TAPE'NAME;                                         03236000
$PAGE "ZERO BUF"                                                        03238000
INTEGER                                                                 03240000
   FIRST'ZEROED;                                                        03242000
DOUBLE                                                                  03244000
   BAD'FILE'COUNT             := 0D,                                    03246000
   C'REC'COUNT                := 0D,                                    03248000
   CAPABILITY                 := 0D,                                    03250000
   CURR'FILENO                := 0D,                                    03252000
   FAILED'FILE'COUNT          := 0D,                                    03254000
   FILE'ADDRESS               := 0D,                                    03256000
   FILE'INDEX'PTR             := 0D,                           <<LB.RS>>03257000
   FILE'MAX'SECTORS           := 0D,                                    03258000
   FILE'NUMBER                := 0D,                                    03260000
   FILE'SECTORS               := 0D,                                    03262000
   FILES'ON'TAPE              := 0D,                                    03264000
   FILES'REJECTED             := 0D,                                    03266000
   FILES'REJ'ACCESS           := 0D,                                    03268000
   FILES'REJ'RELOAD           := 0D,                                    03270000
   FILES'REJ'TITLE            := 0D,                                    03272000
   FILES'SELECTED             := 0D,                                    03274000
   FILES'TO'HANDLE            := 0D,                                    03276000
   FIRST'FILE'SELECTED        := 0D,                                    03278000
   G'NUM'FSIZE                := 0D,                                    03280000
   G'SECURITY                 := 0D,                                    03282000
   GOOD'FILE'COUNT            := 0D,                                    03284000
   LAST'FILE'UNLOCKED         := 0D,                                    03286000
   LINKAGE                    := 0D,                                    03288000
   OLD'ADDRESS                := 0D,                                    03290000
   OLD'SECTORS                := 0D,                                    03292000
   PARMS'TEMPD'1              := 0D,                                    03294000
   PARMS'TEMPD'2              := 0D,                                    03296000
   RESTORED'COUNT             := 0D,                                    03298000
   START'CLOCK'TIME           := 0D,                                    03300000
   START'CPU'TIME             := 0D,                                    03302000
   SUBCLASS'D                 := 0D;                                    03304000
INTEGER                                                                 03306000
   A'SECURITY                 := 0,                                     03308000
   ALLOC'EXTS                 := 0,                                     03310000
   BUFNO                      := 0,                                     03312000
   CANDIDAT                   := 0,                                     03314000
   CART'NUM                   := 0,                                     03316000
   COLD'LOAD'ID               := 0,                                     03318000
   COUNT'REWRITES'COLD'LOAD'ID:= 0,                                     03320000
   D'NUM                      := 0,                                     03322000
   DBSTORE'HIGH               := 0,                            <<04870>>03324000
   DBSTORE'LOW                := 0,                            <<04870>>03326000
   DENSITY                    := 0,                                     03328000
                                                               <<LB.RS>>03330000
                                                               <<LB.RS>>03332000
                                                               <<LB.RS>>03334000
                                                               <<LB.RS>>03336000
   DSIR'INFO                  := 0,                                     03338000
   E'NUM                      := 0,                                     03340000
   ERROR'CODE                 := 0,                                     03342000
   ERROR'INFO                 := 0,                                     03344000
   F'NUM                      := 0,                                     03346000
   FILE'ADDR'1                =  FILE'ADDRESS,                          03348000
   FILE'ADDR'2                =  FILE'ADDRESS + 1,                      03350000
   FILE'INDX'1                =  FILE'INDEX'PTR,               <<LB.RS>>03350100
   FILE'INDX'2                =  FILE'INDEX'PTR + 1,           <<LB.RS>>03350200
   FILE'LDEV                  := 0,                                     03352000
   FILECODE'HIGH              := 0,                                     03354000
   FILECODE'LOW               := 0,                                     03356000
   FILESET'INX                := 0,                                     03358000
   FILESET'NUMBER             := 0,                                     03360000
   FISIR'INFO                 := 0,                                     03362000
   G'NUM                      := 0,                                     03364000
   I'NUM                      := 0,                                     03366000
   I'NUM'CHARS                := 0,                                     03368000
   I'NUM'RECSIZE              := 0,                                     03370000
   ICLASS                     := 0,                                     03372000
   ILEFT                      := 0,                                     03374000
   ILEN                       := 0,                                     03376000
   INPUTLEN                   := 0,                                     03378000
   ITEMP'OFFSET               := 0,                                     03380000
   LAST'GROUP'ERROR           := 0,                            <<LB.RS>>03381000
   LINKAGE'1                  =  LINKAGE,                               03382000
   LINKAGE'2                  =  LINKAGE + 1,                           03384000
   LOCKING'TYPE               := 0,                                     03386000
   MOUNTED'VOLUME'INFO        := 0,                                     03388000
   OFFLINE'NUM                := 0,                                     03390000
   OFFLINE'RECSIZE            := 0,                                     03392000
   OLD'ADDR'1                 =  OLD'ADDRESS,                           03394000
   OLD'FNUM                   := 0,                                     03396000
   OLD'LDEV                   := 0,                                     03398000
   OLD'ZSIZE                  := 0,                                     03400000
   OPTIONS'INX                := 0,                                     03402000
   OUTSTANDING'IOS            := 0,                            <<LB.RS>>03403000
   PARMS'VERSION              := 0,                                     03404000
   PARMS'TEMPD'1'1            =  PARMS'TEMPD'1,                         03406000
   PARMS'TEMPD'1'2            =  PARMS'TEMPD'1 + 1,                     03408000
   PARMS'TEMPD'2'1            =  PARMS'TEMPD'2,                         03410000
   PARMS'TEMPD'2'2            =  PARMS'TEMPD'2 + 1,                     03412000
   PARMS'TEMPI'1              := 0,                                     03414000
   PARMS'TEMPI'2              := 0,                                     03416000
   PV'NUM                     := 0,                                     03418000
   PV'INFO                    := 0,                                     03420000
   READ'TAPE'LEN              := 0,                                     03422000
   RC'CALLS                   := 0,                                     03424000
   RC'ERROR'CODE              := 0,                                     03426000
   RC'ERROR'DETAIL            := 0,                                     03428000
   RECSIZE'INIT               := 0,                                     03430000
   S'R'STATUS                 := 0,                                     03432000
   SP'PV                      := 0,                                     03434000
   SUBCLASS                   =  SUBCLASS'D,                            03436000
   SYSLIST'NUM                := 0,                                     03438000
   SYSLIST'RECSIZE            := 0,                                     03440000
   T'NUM                      := 0,                                     03442000
   TAPE'LDEV                  := 0,                                     03444000
   TAPE'RECSIZE               := 0,                                     03446000
   TAPE'REEL                  := 0,                                     03448000
   TAPE'VERSION               := 0,                                     03450000
   TODAYS'DATE                := 0;                                     03452000
LOGICAL                                                                 03454000
   ADATE'HIGH                 := 0,                                     03456000
   ADATE'LOW                  := 0,                                     03458000
   CAPABILITY'1               =  CAPABILITY,                            03460000
   CAPABILITY'2               =  CAPABILITY + 1,                        03462000
   CARTRIDGE                  := 0,                                     03464000
   CDATE'HIGH                 := 0,                                     03466000
   CDATE'LOW                  := 0,                                     03468000
   G'SECURITY'1               =  G'SECURITY,                            03470000
   G'SECURITY'2               =  G'SECURITY + 1,                        03472000
   GROUP'INDEX'PTR            := 0,                            <<LB.RS>>03473000
   MDATE'HIGH                 := 0,                                     03474000
   MDATE'LOW                  := 0,                                     03476000
   MODE                       := 0,                                     03478000
                                                               <<LB.RS>>03480000
   PARMS'BYTE'ADDRESS         := 0,                                     03482000
   QP'TYPE                    := 0,                                     03484000
   S'R'FLAGS1                 := 0,                                     03486000
   S'R'FLAGS2                 := 0,                                     03488000
   S'R'FLAGS3                 := 0,                                     03490000
   S'R'FLAGS4                 := 0,                                     03492000
   S'R'FLAGS5                 := 0,                                     03494000
   S'R'FLAGS6                 := 0,                                     03496000
   TAPE'AOPTIONS              := 0,                                     03498000
   TAPE'DENSITY               := 0,                                     03500000
   TAPE'DEVINFO               := 0,                                     03502000
   TAPE'FOPTIONS              := 0,                                     03504000
   TAPE'INX                   := 0,                            <<LB.RS>>03506000
   USER'INDEX'PTR             := 0;                            <<LB.RS>>03507000
INTEGER                                                                 03508000
   LAST'ZEROED;                                                         03510000
INTEGER ARRAY                                                           03512000
   ZERO'BUF (*) = FIRST'ZEROED;                                         03514000
$PAGE "GLOBAL DEFINES -- BASED ON FIELDS OF GLOBAL VARIABLES"           03516000
DEFINE                                                                  03518000
         <<Pointers into the command>>                                  03520000
      ITEMP       = COMMAND'TEXT' (ITEMP'OFFSET) #,                     03522000
      ITEMP'1     = COMMAND'TEXT' (ITEMP'OFFSET+1)#,                    03524000
                                                                        03526000
         <<capabilities>>                                               03528000
      CAP'SM      = CAPABILITY'1.(0:1)          #,                      03530000
      CAP'AM      = CAPABILITY'1.(1:1)          #,                      03532000
      CAP'AL      = CAPABILITY'1.(2:1)          #,                      03534000
      CAP'GL      = CAPABILITY'1.(3:1)          #,                      03536000
      CAP'DI      = CAPABILITY'1.(4:1)          #,                      03538000
      CAP'OP      = CAPABILITY'1.(5:1)          #,                      03540000
      CAP'SF      = CAPABILITY'1.(15:1)         #,                      03542000
      CAP'BA      = CAPABILITY'2.(7:1)          #,                      03544000
      CAP'IA      = CAPABILITY'2.(8:1)          #,                      03546000
      CAP'PM      = CAPABILITY'2.(9:1)          #,                      03548000
                                                                        03550000
         <<save security bits>>                                         03552000
      SAVE'ANY                   = G'SECURITY'2.(11:1)      #,          03554000
      SAVE'ACCOUNT               = G'SECURITY'2.(12:1)      #,          03556000
      SAVE'ACCT'LIB              = G'SECURITY'2.(13:1)      #,          03558000
      SAVE'GROUP                 = G'SECURITY'2.(14:1)      #,          03560000
      SAVE'GROUP'LIB             = G'SECURITY'2.(15:1)      #,          03562000
                                                                        03564000
         <<others>>                                                     03566000
      INTERACTIVE = MODE.INTERACTIVEbit         #,                      03568000
      PVMVTABX    =    PV'INFO.(08:08)           #,                     03570000
$PAGE "GLOBAL FLAGS"                                                    03572000
      IGNORE'PRIV'CHECK'FLAG =S'R'FLAGS1.(15:01)#,                      03574000
      NOSOFT'FLAG    = S'R'FLAGS1.(14:01)       #,                      03576000
      KEEP'FLAG      = S'R'FLAGS1.(13:01)       #,                      03578000
      BACKUP'FLAG    = S'R'FLAGS1.(12:01)       #,                      03580000
      OLDDATE'FLAG   = S'R'FLAGS1.(11:01)       #,                      03582000
      ZERO'DEV'FLAG  = S'R'FLAGS1.(10:01)       #,                      03584000
      SHOW'FLAG      = S'R'FLAGS1.(09:01)       #,                      03586000
         SHOW'SHORT'FLAG   = S'R'FLAGS1.(08:01) #,                      03588000
         SHOW'DATES'FLAG   = S'R'FLAGS1.(07:01) #,                      03590000
         SHOW'SECURITY'FLAG= S'R'FLAGS1.(06:01) #,                      03592000
         SHOW'OFFLINE'FLAG = S'R'FLAGS1.(05:01) #,                      03594000
         SHOW'LONG'FLAG    = S'R'FLAGS1.(04:01) #,                      03596000
      LOCAL'FLAG     = S'R'FLAGS1.(03:01)       #,                      03598000
      RELEASE'FLAG   = S'R'FLAGS1.(02:01)       #,                      03600000
      SEEN'SHOW'LONG = S'R'FLAGS1.(01:01)       #,                      03602000
      SEEN'SHOW'SHORT= S'R'FLAGS1.(00:01)       #,                      03604000
                                                                        03606000
      SEEN'ACCT      = S'R'FLAGS2.(15:01)       #,                      03608000
      SEEN'DATE      = S'R'FLAGS2.(14:01)       #,                      03610000
      SEEN'DEV       = S'R'FLAGS2.(13:01)       #,                      03612000
      SEEN'FILES     = S'R'FLAGS2.(12:01)       #,                      03614000
      SEEN'GROUP     = S'R'FLAGS2.(11:01)       #,                      03616000
      SEEN'KEEP      = S'R'FLAGS2.(10:01)       #,                      03618000
      SEEN'LOCAL     = S'R'FLAGS2.(09:01)       #,                      03620000
      SEEN'LOCK      = S'R'FLAGS2.(08:01)       #,                      03622000
      SEEN'NEWDATE   = S'R'FLAGS2.(07:01)       #,                      03624000
      SEEN'NOKEEP    = S'R'FLAGS2.(06:01)       #,                      03626000
      SEEN'OLDDATE   = S'R'FLAGS2.(05:01)       #,                      03628000
      SEEN'ONERR     = S'R'FLAGS2.(04:01)       #,                      03630000
      SEEN'RELEASE   = S'R'FLAGS2.(03:01)       #,                      03632000
      SEEN'SHOW      = S'R'FLAGS2.(02:01)       #,                      03634000
      SEEN'DENSITY   = S'R'FLAGS2.(01:01)       #,                      03636000
      SEEN'CREATOR   = S'R'FLAGS2.(00:01)       #,                      03638000
                                                                        03640000
      JCW'FLAG       = S'R'FLAGS3.(15:01)       #,                      03642000
      SEEN'RECSIZE   = S'R'FLAGS3.(14:01)       #,                      03644000
      DISC'EXISTS    = S'R'FLAGS3.(13:01)       #,                      03646000
      SYSLIST'SUPPLIED=S'R'FLAGS3.(12:01)       #,                      03648000
      NEED'TO'RESET'SM=S'R'FLAGS3.(11:01)       #,                      03650000
      SIMPLE'TOG     = S'R'FLAGS3.(10:01)       #,                      03652000
      WIDE'SYSLIST   = S'R'FLAGS3.(09:01)       #,                      03654000
      UPDATE'TOG     = S'R'FLAGS3.(08:01)       #,                      03656000
      TAPE'NULL'TOG  = S'R'FLAGS3.(07:01)       #,                      03658000
      TAPE'SDISC'TOG = S'R'FLAGS3.(06:01)       #,                      03660000
      TAPE'CARTRIDGE'TOG=S'R'FLAGS3.(05:01)     #,                      03662000
      SM'TOG         = S'R'FLAGS3.(04:01)       #,                      03664000
      GOT'DSIR       = S'R'FLAGS3.(03:01)       #,                      03666000
      GOT'FISIR      = S'R'FLAGS3.(02:01)       #,                      03668000
      THUNK'STORE'ERR= S'R'FLAGS3.(01:01)       #,                      03670000
      BREAK'MSG'SEEN = S'R'FLAGS3.(00:01)       #,                      03672000
                                                                        03674000
      SYNTAX'TOG     = S'R'FLAGS4.(15:01)       #,                      03676000
      USING'ATTIO    = S'R'FLAGS4.(14:01)       #,                      03678000
      USING'FILESYS  = S'R'FLAGS4.(13:01)       #,                      03680000
      A'7976         = S'R'FLAGS4.(12:01)       #,                      03682000
      USE'6250BPI    = S'R'FLAGS4.(11:01)       #,                      03684000
      NEED'DIRECTORY = S'R'FLAGS4.(10:01)       #,                      03686000
      SEEN'ATTIO     = S'R'FLAGS4.(09:01)       #,                      03688000
      OPERATOR'ABORT = S'R'FLAGS4.(08:01)       #,                      03690000
      MAIL'TOG       = S'R'FLAGS4.(07:01)       #,                      03692000
      DBSTORE'TOG    = S'R'FLAGS4.(06:01)       #,                      03694000
      FILE'WAS'OPENED= S'R'FLAGS4.(05:01)       #,                      03696000
      OLD'COPY'EXISTS= S'R'FLAGS4.(04:01)       #,                      03698000
      BLANK'CREATOR  = S'R'FLAGS4.(03:01)       #,                      03700000
      ON'ERR         = S'R'FLAGS4.(00:03)       #,                      03702000
                                                                        03704000
      BLANK'TAPE'NAME= S'R'FLAGS5.(15:01)       #,                      03706000
      DONT'CHK'GROUP = S'R'FLAGS5.(14:01)       #,                      03708000
      DONT'CHK'USER  = S'R'FLAGS5.(13:01)       #,                      03710000
      DONT'CHK'ACCT  = S'R'FLAGS5.(12:01)       #,                      03712000
      LAST'READ'WAS'EOF = S'R'FLAGS5.(11:01)       #,                   03714000
      MOUNTED'VS     = S'R'FLAGS5.(10:01)       #,                      03716000
      SEEN'CREATE    = S'R'FLAGS5.(09:01)       #,                      03718000
         CREATE'ACCT'FLAG  = S'R'FLAGS5.(08:01) #,                      03720000
         CREATE'GROUP'FLAG = S'R'FLAGS5.(07:01) #,                      03722000
         CREATE'USER'FLAG  = S'R'FLAGS5.(06:01) #,                      03724000
      REEL'1'MOUNTED = S'R'FLAGS5.(05:01)       #,                      03726000
      END'OF'TAPE'SET= S'R'FLAGS5.(04:01)       #,                      03728000
      KILL'RESTORE   = S'R'FLAGS5.(03:01)       #,                      03730000
      DIFFERENT'DEVICE= S'R'FLAGS5.(02:01)      #,                      03732000
      OLD'FILE'IS'OPEN = S'R'FLAGS5.(01:01)     #,                      03734000
      SEEN'TIME      = S'R'FLAGS5.(00:01)       #,                      03736000
      SEEN'STARTHERE = S'R'FLAGS6.(15:01)       #,                      03738000
      READ'WAS'ALREADY'DONE = S'R'FLAGS6.(14:01)#,                      03740000
      LAST'FILE      = S'R'FLAGS6.(13:01)       #,                      03742000
      EOF'WRITTEN    = S'R'FLAGS6.(12:01)       #,                      03744000
      LAST'STARTIO'WROTE'EOF  = S'R'FLAGS6.(11:01)  #,                  03746000
      READ'TAPE'EOF  = S'R'FLAGS6.(10:01)       #,                      03748000
      SEEN'HIGH      = S'R'FLAGS6.(09:01)       #,             <<04870>>03750000
      SEEN'LOW       = S'R'FLAGS6.(08:01)       #,             <<04870>>03752000
      TAPEMARK'WRITTEN = S'R'FLAGS6.(07:01)       #,           <<04996>>03754000
      DONT'DO'RECOVERY = S'R'FLAGS6.(06:01)       #,           <<04101>>03756000
      EOF'READ       = S'R'FLAGS6.(05:01)       #,             <<LB.RS>>03758000
      LAST'REEL'FINISHED = S'R'FLAGS6.(04:01)       #,         <<06361>>03760000
      VIRTDEV        = S'R'FLAGS6.(03:01)       #,                      03762000
      <<U N U S E D  = S'R'FLAGS6.(02:01)       #,  >>                  03764000
      <<U N U S E D  = S'R'FLAGS6.(01:01)       #,  >>                  03766000
      SEEN'PURGE     = S'R'FLAGS6.(00:01)       #,                      03768000
      RESTORING      = (S'R'STATUS = RESTORINGv)#,                      03770000
      STORING        = (S'R'STATUS = STORINGv LOR                       03772000
                        S'R'STATUS = SYSDUMPINGv) #,                    03774000
      SYSDUMPING     = (S'R'STATUS = SYSDUMPINGv) #,                    03776000
$PAGE "TAPE LABEL VARIABLES"                                            03778000
      LABELED     = TAPE'FOPTIONS.(6:1)         #,                      03780000
      LABELTEXT   = "STORE/RESTORE LABEL-HP/3000."#,  <<words 0..13>>   03782000
      TL'IIBID    = TAPE'LABEL'L  (14) #,                               03784000
      TL'IIBID'   = TAPE'LABEL'   (28) #,                               03786000
      TL'SPANTOG  = TAPE'LABEL'L  (16) #,                               03788000
      TL'CHKSUM   = TAPE'LABEL'L  (17) #,                               03790000
      TL'FILEINX  = TAPE'LABEL'L  (18) #,                               03792000
      TL'XFIELD   = TAPE'LABEL'L  (21) #,                               03794000
      TL'ZFIELD   = TAPE'LABEL'L  (22) #,                               03796000
      LAST'REEL   = ( TL'ZFIELD = 1 )  #,                               03798000
      TL'REELNUM  = TAPE'LABEL    (23) #,                               03800000
      TL'REELNUM' = TAPE'LABEL'   (46) #,                               03802000
      TL'DATE     = TAPE'LABEL'L  (24) #,                               03804000
      TL'DATE'    = TAPE'LABEL'   (48) #,                               03806000
      TL'DATE'INX'=   48#,                                              03808000
      TL'HHMM     = TAPE'LABEL'L  (25) #,                               03810000
      TL'HHMM'    = TAPE'LABEL'   (50) #,                               03812000
      TL'SSTT     = TAPE'LABEL'L  (26) #,                               03814000
      TL'SSTT'    = TAPE'LABEL'   (52) #,                               03816000
      TL'RECSIZE  = TAPE'LABEL    (27) #,                               03818000
      TL'TEXT'LEN'= 32#;                                                03820000
$PAGE "STATISTICS VARIABLES"                                            03822000
$IF X5=ON THEN                                                          03824000
DOUBLE                                                                  03826000
   NEW'DISC'READS,                                                      03828000
   NEW'TAPE'WRITES,                                                     03830000
   NEW'TOTAL'EXTENTS,                                                   03832000
   OLD'DISC'READS,                                                      03834000
   OLD'TAPE'WRITES,                                                     03836000
   OLD'TOTAL'EXTENTS;                                                   03838000
                                                                        03840000
DEFINE                                                                  03842000
   TAPE'WRITE'SECTORS = 32D#,                                           03844000
   DISC'READ'SECTORS  = 192D#;                                          03846000
$IF                                                                     03848000
$PAGE "GLOBAL ADDRESS-EQUATED VARIABLES"                                03850000
      <<ADDRESS EQUATED VARIABLES...>>                                  03852000
                                                                        03854000
LOGICAL                                                                 03856000
   PARMMASK       = Q-4;                                                03858000
                                                                        03860000
INTEGER POINTER                                                         03862000
   PS0            = S-0;                                                03864000
                                                                        03866000
INTEGER ARRAY                                                           03868000
   DB2(*)         = DB+2,                                               03870000
   DB11(*)        = DB+11;                                     <<LB.RS>>03872000
$PAGE "GLOBAL EQUATES -- CI ERROR MESSAGES"                             05000000
EQUATE          <<CI ERROR MESSAGE EQUATES>>                            05002000
                                                                        05004000
   FIRST'REAL'MSG               = 5000, <<first 'SEND'able message!>>   05006000
   SR'SD'ERROR'BASE             = 5000,                                 05008000
                                                                        05010000
                                                                        05012000
                                                                        05014000
   SR'TAPE'WRITE'FAIL           = 6000,                                 05016000
   SR'TAPE'SPECIAL'CHAR         = 6001, <<bad special chars>>           05018000
   SR'TAPE'MUST'START'WITH'ALPHA= 6002, <<it didnt!>>                   05020000
   SR'TAPE'NAME'TOO'LONG        = 6003, <<name > 8 chars>>              05022000
   SR'TAPE'BACK'REFERENCE'EXPECTED=6004,<<failed to find "*">>          05024000
   SR'TAPENAME'EXPECTED         = 6005, <<user omitted the name>>       05026000
   SR'SEMI'EXPECTED             = 6006, <<illegal delimiter>>           05028000
   SR'CANDIDAT'FULL             = 6007,                                 05030000
   SR'FILES'EQUAL               = 6008, <<need = after 'FILE'>>         05032000
   SR'FILE'COUNT'EXPECTED       = 6009, <<expect val after "FILES=">>   05034000
   SR'UNKOPTION                 = 6010, <<UNKNOWN KEYWORD>>             05036000
   SR'RESTORE'PATTERN'ERR       = 6012,                                 05038000
   SR'BADSYSLIST                = 6014, <<unable to open SYSLIST>>      05040000
   SR'INSUFSTACK                = 6015, <<too little STACK FOR STORE>>  05042000
   SR'TFILFOPTION               = 6016, <<BAD FOPTIONS ON TAPE>>        05044000
   SR'TFILAOPTION               = 6017, <<BAD AOPTIONS ON TAPE>>        05046000
   SR'XPCTTAPEDEV               = 6018, <<NOT A TAPE FILE>>             05048000
   SR'ATTIO'FAIL                = 6020, <<ATTIO ON FILE LABEL FAIL>>    05050000
   SR'PUBLIC'TAPE               = 6021,                                 05052000
   SR'STORE'VERSION             = 6022,                                 05054000
   SR'SECTORS'NOT'EQUAL'0       = 6023,                                 05056000
   SR'DIRECTORY'ERROR           = 6024,                                 05058000
   SR'DEV'CLASS'INVALID         = 6031,                                 05060000
   SR'DEV'NOT'DISC              = 6034,                                 05062000
   SR'CREATOR'EQUAL             = 6035, <<expectd '=' after CREATOR>>   05064000
   SR'CREATOR'INVNAME           = 6036, <<bad format for CREATOR>>      05066000
   SR'BAD'OPERATING'SYSTEM      = 6037, <<OP SYS - STORE CONF>><<LB.RS>>05067000
   RS'XPCTSEMIC                 = 6040, <<NEED ; BETWEEN OPTIONS>>      05068000
   SR'CREATOR'REDUNDANT         = 6041,                                 05070000
   SR'DEV'EQUAL                 = 6042,                                 05072000
   SR'DEV'NOT'FOUND             = 6043, <<EXPECTED DEV NAME>>           05074000
   SR'DEV'TOO'LONG              = 6044, << > 8 CHAR IN DEV ID>>         05076000
   SR'DEV'SPECIAL               = 6045, <<EMBEDDED SPECIAL IN DEV>>     05078000
   SR'NO'LABELED'DS             = 6058,                                 05080000
   SR'DATE'LTGT                 = 6059, <<;DATE EXPECT "<" OR ">">>     05082000
   SR'RECSIZEBAD                = 6060, <<USER-SPECIFIED RECSIZ BAD>>   05084000
   RS'UNKOPTION                 = 6062, <<UNKNOWN KEYWORD>>             05086000
   SR'BAD'PNUM                  = 6065, <<BAD PNUM PARAMETER>>          05088000
   SR'TAPE'WILDCARDS            = 6067, <<wildcards are illegal>>       05090000
   SR'IND'WILDCARDS             = 6068, <<wildcards are illegal>>       05092000
   SR'IND'SPECIAL'CHAR          = 6069, <<bad special chars>>           05094000
   SR'IND'MUST'START'WITH'ALPHA = 6070, <<it didnt!>>                   05096000
   SR'IND'NAME'TOO'LONG         = 6071, <<name > 8 chars>>              05098000
   SR'IND'IO'ERROR              = 6072, <<I/O error on INDIRECT>>       05100000
   SR'IND'NAME'EXPECTED         = 6073, <<INDIRECT name expected>>      05102000
   SR'SHOW'OPT'UNKNOWN          = 6074, <<unknown SHOW option>>         05104000
   SR'IND'OPEN'FAILED           = 6075, <<INDIRECT FOPEN failed>>       05106000
   SR'IND'FGETINFO              = 6076, <<INDIRECT FGETINFO err>>       05108000
   SR'IND'EMPTY                 = 6077, <<INDIRECT file empty>>         05110000
   SR'IND'RECSIZE'SMALL         = 6078, <<INDIRECT recsize small>>      05112000
   SR'IND'NOT'INPUT             = 6079, <<INDIRECT wasnt readable>>     05114000
   SR'BREAK'SENSED              = 6080, <<BREAK was hit>>               05116000
   SR'IND'NAME'NOT'ALONE        = 6082, <<indirect name not alone>>     05118000
   SR'TAPE'FGETINFO'FAIL        = 6086,                                 05120000
   SR'TAPE'REWIND'FAIL          = 6087,                                 05122000
   SR'G'NUM'REWIND              = 6089,                                 05124000
   SR'CANT'REOPEN'TAPE          = 6090, <<faild to reopen tape file>>   05126000
   SR'G'NUM'ERROR               = 6091, <<GOOD file error>>             05128000
   SR'BAD'OFFLINE               = 6092, <<OFFLINE File was bad>>        05130000
   SR'CANT'OPEN'TAPE            = 6093, <<TAPE FOPEN failed>>           05132000
   SR'SUDDENDEATH               = 6098, <<SUDDENDEATH in STORE>>        05134000
   RS'SUDDENDEATH               = 6099, <<SUDDENDEATH in RESTORE>>      05136000
   SR'LOCK'EQUAL                = 6101,                                 05138000
   SR'LOCK'EMPTY                = 6102,                                 05140000
   SR'LOCK'INTEGRITY            = 6103,                                 05142000
   SR'DATE'EQUAL                = 6104,                                 05144000
   SR'ONERR'EQUAL               = 6105,                                 05146000
   SR'ONERR'OPTION'UNKNOWN      = 6106,                                 05148000
   SR'GROUP'EQUAL               = 6107,                                 05150000
   SR'ACCT'EQUAL                = 6108,                                 05152000
   SR'GROUP'INVNAME             = 6109,                                 05154000
   SR'ACCT'INVNAME              = 6110,                                 05156000
   SR'NEED'AM                   = 6111,                                 05158000
   SR'NEED'SM                   = 6115,                                 05160000
   SR'DEV'MUST'START'WITH'ALPHA = 6116,                                 05162000
   SR'DEV'WILDCARDS             = 6117,                                 05164000
   SR'DEV'BACK'ILLEGAL          = 6118,                                 05166000
   RS'ONERR'OPTION'UNKNOWN      = 6119,                                 05168000
   SR'FILESET'LIST'EMPTY        = 6120,                                 05170000
   SR'G'NUM'FULL                = 6121,                                 05172000
   SR'DATE'ALL'0'OR'NON'0       = 6123,                                 05174000
   SR'INVALID'DAY               = 6124,                                 05176000
   SR'INVALID'MONTH             = 6125,                                 05178000
   SR'INVALID'YEAR              = 6126,                                 05180000
   SR'SLASH'MONTH'EXPECTED      = 6130,                                 05182000
   SR'SLASH'YEAR'EXPECTED       = 6131,                                 05184000
   SR'DAY'TOO'BIG               = 6132,                                 05186000
   SR'NUMBER'TOO'BIG            = 6133,                                 05188000
   SR'DNUMBER'TOO'BIG           = 6134,                                 05190000
   SR'COMMAND'TEXT'TOO'LONG     = 6135,                                 05192000
   SR'ONLY'0'DEV                = 6136,                                 05194000
   SR'BAD'GOOD'COUNT            = 6137,                                 05196000
   SR'SHOW'OPT'EXPECTED         = 6138,                                 05198000
   SR'WHAT'KIND                 = 6139,                                 05200000
   SR'CANDIDAT'ERROR            = 6140,                                 05202000
   SR'NO'DOLLAR'ALLOWED         = 6141,                                 05204000
   SR'NO'BACKREF'ALLOWED        = 6142,                                 05206000
   SR'FAILED'TO'BUILD'PATTERN   = 6143,                                 05208000
   SR'S'2'D'FAILED              = 6144,                                 05210000
   SR'PRODUCEPARMS'FAILED       = 6145,                                 05212000
   SR'D'2'S'FAILED              = 6146,                                 05214000
   SR'BAD'ACCT'IN'DIRECSCAN     = 6147,                                 05216000
   SR'BAD'FILE'IN'DIRECSCAN     = 6148,                                 05218000
   SR'BAD'GROUP'IN'DIRECSCAN    = 6149,                                 05220000
   SR'WARN'DIRECTORYSEARCH'ERR  = 6150,                                 05222000
   RS'FILESET'EXPECTED          = 6151,                                 05224000
   SR'ACCT'REDUNDANT            = 6152,                                 05226000
   SR'DATE'REDUNDANT            = 6153,                                 05228000
   SR'DEV'REDUNDANT             = 6154,                                 05230000
   SR'FILES'REDUNDANT           = 6155,                                 05232000
   SR'GROUP'REDUNDANT           = 6156,                                 05234000
   SR'KEEP'REDUNDANT            = 6157,                                 05236000
   SR'LOCAL'REDUNDANT           = 6158,                                 05238000
   SR'LOCK'REDUNDANT            = 6159,                                 05240000
   SR'NEWDATE'REDUNDANT         = 6160,                                 05242000
   SR'NOKEEP'REDUNDANT          = 6161,                                 05244000
   SR'OLDDATE'REDUNDANT         = 6162,                                 05246000
   SR'ONERR'REDUNDANT           = 6163,                                 05248000
   SR'RELEASE'REDUNDANT         = 6164,                                 05250000
   SR'SHOW'REDUNDANT            = 6165,                                 05252000
   SR'LOCAL'ACCT                = 6166,                                 05254000
   SR'LOCAL'GROUP               = 6167,                                 05256000
   SR'NOKEEP'KEEP               = 6168,                                 05258000
   SR'KEEP'NOKEEP               = 6169,                                 05260000
   SR'GROUP'LOCAL               = 6170,                                 05262000
   SR'ACCT'LOCAL                = 6171,                                 05264000
   SR'NEWDATE'OLDDATE           = 6172,                                 05266000
   SR'OLDDATE'NEWDATE           = 6173,                                 05268000
   RS'REWIND'CANDIDAT'FAIL      = 6174,                                 05270000
   RS'READ'CANDIDAT'FAIL        = 6175,                                 05272000
   RS'WRITE'CANDIDAT'FAIL       = 6176,                                 05274000
   RS'T'READ'DIR'FAIL           = 6177,                                 05276000
   RS'T'FGETINFO'FAIL           = 6178,                                 05278000
   RS'T'READ'SR'LABEL           = 6179,                                 05280000
   RS'T'BAD'RECSIZE             = 6180,                                 05282000
   RS'T'BAD'BLOCKSIZE           = 6181,                                 05284000
   RS'T'GOT'2'EOFS              = 6182,                                 05286000
   RS'T'BSF'FAIL                = 6183,                                 05288000
   RS'T'FSF'FAIL                = 6184,                                 05290000
   RS'T'OP'COULD'NOT'FIND'TAPE  = 6185,                                 05292000
   RS'T'NOT'SR'LABEL            = 6186,                                 05294000
   RS'T'GOT'EOF'NOT'SR'LABEL    = 6187,                                 05296000
   RS'T'BAD'SR'LABEL'RECSIZE    = 6188,                                 05298000
   RS'T'REWIND'FAIL             = 6189,                                 05300000
   SR'G'NUM'SEQUENCE            = 6190,                                 05302000
   SR'G'READ'FAIL               = 6191,                                 05304000
   SR'NO'FIRST'REEL             = 6192,                                 05306000
   SR'NO'NEXT'REEL              = 6193,                                 05308000
   SR'WT'DIRECTORY              = 6194,                                 05310000
   SR'WT'GET'STATUS             = 6195,                                 05312000
   SR'WT'TAPE'LABEL             = 6196,                                 05314000
   SR'WT'EOF                    = 6197,                                 05316000
   SR'WT'LABEL'TAPE             = 6199,                                 05318000
   SR'WILL'RE'STORE             = 6200,                                 05320000
   SR'CART'RECSIZE'BAD          = 6201,                                 05322000
   SR'DENSITY'REDUNDANT         = 6202,                                 05324000
   SR'DENSITY'EQUAL             = 6203,                                 05326000
   SR'DENSITY'EXPECTED          = 6205,                                 05328000
   SR'RECSIZE'REDUNDANT         = 6206,                                 05330000
   SR'RECSIZE'EQUAL             = 6207,                                 05332000
   SR'RECSIZE'0                 = 6208,                                 05334000
   SR'RECSIZE'EXPECTED          = 6209,                                 05336000
   SR'LONG'USED                 = 6210,                                 05338000
   SR'SHORT'USED                = 6211,                                 05340000
   SR'WT'WRITE1                 = 6212,                                 05342000
   RS'DISABLED                  = 6213,                                 05344000
   SR'WT'WRITE3                 = 6214,                                 05346000
   SR'BUFFER'ALLOCATE'FAIL      = 6215,                                 05348000
   SR'BUFFER'FREEZE'FAIL        = 6216,                                 05350000
   SR'BUFFER'LOCK'FAIL          = 6217,                                 05352000
   SR'CANT'RECOVER'LABELED'TAPES= 6218,                                 05354000
   SR'OPERATOR'ABORT            = 6220,                                 05356000
   SR'SENDMAIL'FAIL             = 6221,                                 05358000
   SR'NULL'CANT'RECOVER         = 6223,                                 05360000
   SR'LDEV'EQUAL                = 6224,                                 05362000
   SR'LDEV'EXPECTED             = 6225,                                 05364000
   SR'PV'OPEN'ERROR             = 6226,                                 05366000
   SR'PV'REWIND'FAIL            = 6227,                                 05368000
   SR'PV'WRITE'FAIL             = 6228,                                 05370000
   SR'WARN'AAA                  = 6229,                                 05372000
   SR'WARN'AA                   = 6230,                                 05374000
   SR'WARN'A                    = 6231,                                 05376000
   SR'WARN'STORE'A              = 6232,                                 05378000
   SR'HIGH'EQUAL                = 6233,                        <<04870>>05380000
   SR'HIGH'IS'LOWER'THAN'LOW    = 6234,                        <<04870>>05382000
   SR'HIGH'NO'EXPECTED          = 6235,                        <<04870>>05384000
   SR'HIGH'REDUNDANT            = 6236,                        <<04870>>05386000
   SR'LOW'EQUAL                 = 6237,                        <<04870>>05388000
   SR'LOW'IS'HIGHER'THAN'HIGH   = 6238,                        <<04870>>05390000
   SR'LOW'NO'EXPECTED           = 6239,                        <<04870>>05392000
   SR'LOW'REDUNDANT             = 6240,                        <<04870>>05394000
   SR'DBSTORE'WO'HIGH'AND'LOW   = 6241,                        <<04870>>05396000
   SR'INCORRECT'NUMBER'OF'FILES = 6242,                        <<04870>>05398000
   SR'CHECKING'FATHERS'NAME     = 6243,                        <<04870>>05400000
   SR'DBSTORE'CALLED'BY'ALIEN   = 6244,                        <<04870>>05402000
   SR'RESTART'TAPE              = 6245,                        <<04101>>05402010
   LAST'REAL'MSG                = 6232,                                 05404000
   RS'SYNCH'FSF                 = 9000,                                 05406000
   RS'ONERR'SKIPFILE            = 9001,                                 05408000
   RS'ONERR'SKIPRECORD          = 9002,                                 05410000
   RS'ONERR'QUIT                = 9003,                                 05412000
   RS'SYNCH'FAILED              = 9004,                                 05414000
   RS'D'FILE'ERROR              = 9005,                                 05416000
   RS'SYNCH'ERROR               = 9006,                                 05418000
   RS'SYNCH'EOF                 = 9007,                                 05420000
   RS'D'NUM'ERROR               = 9008,                                 05422000
   RS'EOF'D'FILE                = 9009,                                 05424000
   RS'CREATE'REDUNDANT          = 9010,                                 05426000
   RS'CREATE'SM'OR'AM           = 9011,                                 05428000
   RS'CREATE'SM                 = 9012,                                 05430000
   RS'CREATE'OPT'EXPECTED       = 9013,                                 05432000
   RS'CREATE'OPT'UNKNOWN        = 9014,                                 05434000
   RS'NEXTTAPEFILE              = 9015,                        <<LB.RS>>05436000
   RS'MOUNT'PREV'FAIL           = 9016,                                 05438000
   RS'LOOKING'FOR'EOF           = 9017,                                 05440000
   RS'READING'FIRST'RECORD      = 9018,                                 05442000
   SR'G'UPDATE'FAIL             = 9019,                                 05444000
   RS'NO'FILES'AFTER'HERE       = 9020,                                 05446000
   SR'BAD'TAPE                  = 9021,                                 05448000
   SR'TAKE'IT'OFF               = 9022,                                 05450000
   SR'NOT'PART'OF'TAPE'SET      = 9023,                                 05452000
   SR'MOUNT'NEXT'REEL           = 9024,                                 05454000
   SR'NOT'A'STORE'RESTORE'TAPE  = 9025,                                 05456000
   SR'TAPE'OF'SAME'SET          = 9026,                                 05458000
   SR'MOUNT'DIFFERENT'TAPE      = 9027,                                 05460000
   SR'TAPE'MOUNT'FAIL           = 9028,                                 05462000
   RS'DIR'FIND'OLD              = 9029,                                 05464000
   RS'UNABLE'TO'UNLOCK'OLD'FILE = 9030,                        <<LB.RS>>05464100
   RES'TOO'MANY'VOLUME'SETS     = 9037,                                 05466000
   RS'GOOD'FILE'FULL            = 9038,                                 05468000
   RS'T'TRLBL'IO'ERROR          = 9039,                                 05470000
   RS'EARLY'MOUNT'FAILED        = 9040,                                 05472000
   RS'T'IO'UNLAB'TAPE'READ      = 9042,                                 05474000
   RS'T'EOV'SET                 = 9043,                                 05476000
   RS'T'TAPE'DEV'UNAVAIL        = 9044,                                 05478000
   RS'T'EOF'TAPE                = 9046,                                 05480000
   RS'MESS'DISC'LOCK            = 9047,                                 05482000
   RS'MESS'TAPE'LOCK            = 9048,                                 05484000
   RES'WRITE'DISC'FAIL          = 9049,                                 05486000
   RS'FFILEINFO'FAILED          = 9050,                                 05488000
   SR'UNABLE'TO'START'REEL      = 9051,                                 05490000
   SR'TIM'START                 = 9052,                                 05490010
   SR'TIM'BEFORE'FOPEN          = 9053,                                 05490020
   SR'TIM'AFTER'FOPEN           = 9054,                                 05490030
   SR'TIM'AFTER'DIRECTORY       = 9055,                                 05490040
   SR'TIM'START'OF'TAPE         = 9056,                                 05490050
   SR'TIM'DONE                  = 9057,                                 05490060
   SR'TIM'BEFORE'REWIND         = 9058,                                 05490070
   RS'ATTIO'ERROR               = 9059,                                 05490080
   RS'2'EOFS                    = 9060,                        <<LB.RS>>05492000
   RS'IO'READ'UNLAB             = 9061,                        <<LB.RS>>05494000
   RS'IO'SKIP'UNLAB             = 9062,                        <<LB.RS>>05496000
   RS'ERROR'LEVEL'TOO'DEEP      = 9063,                        <<LB.RS>>05498000
   RS'D'READ'FAIL               = 9064,                        <<LB.RS>>05500000
   RS'DIRECSCAN'ERROR           = 9065,                        <<LB.RS>>05502000
   RS'FPOINT'ON'DIR             = 9066,                        <<LB.RS>>05504000
   RS'FREAD'ON'DIR              = 9067,                        <<LB.RS>>05506000
   RS'NOT'FOUND'ON'TAPE         = 9068,                        <<LB.RS>>05508000
   RS'SKIPPING'PARTIAL'FILE     = 9069,                        <<LB.RS>>05510000
   RS'IO'READ'LAB               = 9070,                        <<LB.RS>>05510010
   RS'OPERATOR'REJECT           = 9071,                        <<LB.RS>>05510020
   RS'BACKING'UP                = 9072,                        <<LB.RS>>05510030
   RS'UNABLE'TO'ALLOCATE'BUFFERS= 9073,                        <<LB.RS>>05510040
   RS'LOOK'FOR'EOF              = 9074,                        <<LB.RS>>05510050
   SR'DIR'BAD'LEVEL             = 10011,                       <<LB.RS>>05510060
   SR'DIR'LOCK'UNXPCTD          = 10012,                       <<LB.RS>>05510070
   RS'LOCKWORDS'DIFFERENT       = 9075,                                 05510080
   EQUATE'HOLDER                = -1;                                   05512000
$PAGE "GLOBAL EQUATES -- STORE/RESTORE RUNTIME MESSAGES"                06000000
EQUATE                                                                  06002000
      <<STORE/RESTORE message sets... >>                                06004000
                                                                        06006000
   IO'MESSAGE'SET   =  8,                                               06008000
   SR'MESSAGE'SET   = 29,                                      <<04975>>06010000
                                                                        06012000
      <<STORE/RESTORE runtime message equates...>>                      06014000
                                                                        06016000
      <<Note: all M'... numbers MUST be less than 1000!         >>      06018000
                                                                        06020000
      <<The M' equates are understood by SENDMESSAGE...they are         06022000
        NOT equates for accessing the message CATALOG!...since          06024000
        they are always accessed by name, the programmer need not       06026000
        not know what their actual "values" are!.  For ease of          06028000
        programming, they are declared below in alphabetic order.  >>   06030000
                                                                        06032000
   M'READ'ACCESS'FAILURE      = 0                        + 1,           06034000
   M'ACCESS'10'FAILURE        = M'READ'ACCESS'FAILURE    + 1,           06036000
   M'ACCT'DISC'SPACE          = M'ACCESS'10'FAILURE      + 1,           06038000
   M'ACCT'SAVE'ACCESS         = M'ACCT'DISC'SPACE        + 1,           06040000
   M'ADATE'NOT'IN'RANGE       = M'ACCT'SAVE'ACCESS       + 1,           06042000
   M'BAD'IRESTORE'TITLE       = M'ADATE'NOT'IN'RANGE     + 1,           06044000
   M'BLANK'LINE               = M'BAD'IRESTORE'TITLE     + 1,           06046000
   M'CANT'PURGE'DISC'FILE     = M'BLANK'LINE             + 1,           06048000
   M'CANT'READ'TAPE'FILE      = M'CANT'PURGE'DISC'FILE   + 1,           06050000
   M'CANT'RESTORE'THIS'FILE   = M'CANT'READ'TAPE'FILE    + 1,           06052000
   M'CDATE'NOT'IN'RANGE       = M'CANT'RESTORE'THIS'FILE + 1,           06054000
   M'CONTAINED'TAPE'ERROR     = M'CDATE'NOT'IN'RANGE     + 1,  <<LB.RS>>06055000
   M'CREATED'DIR'ENTRY        = M'CONTAINED'TAPE'ERROR   + 1,  <<LB.RS>>06056000
   M'DATELINE                 = M'CREATED'DIR'ENTRY      + 1,           06058000
   M'DIREC'NO'ROOM            = M'DATELINE               + 1,           06060000
   M'DIREC'UNXPECTED'ERROR    = M'DIREC'NO'ROOM          + 1,  <<LB.RS>>06062000
   M'DIRECSCAN'ERROR          = M'DIREC'UNXPECTED'ERROR  + 1,  <<LB.RS>>06064000
   M'DISK'READ'FAILED         = M'DIRECSCAN'ERROR        + 1,           06066000
   M'ERR'RESTORING'FILE       = M'DISK'READ'FAILED       + 1,           06068000
   M'ERR'STORING'FILE         = M'ERR'RESTORING'FILE     + 1,           06070000
   M'ERROR'ACCT'VALIDATION    = M'ERR'STORING'FILE       + 1,           06072000
   M'ERROR'GROUP'VALIDATION   = M'ERROR'ACCT'VALIDATION  + 1,           06074000
   M'ERROR'USER'VALIDATION    = M'ERROR'GROUP'VALIDATION + 1,           06076000
   M'FILE'EXCL'ACC            = M'ERROR'USER'VALIDATION  + 1,           06078000
   M'FILE'LOCKWORD'WRONG      = M'FILE'EXCL'ACC          + 1,           06080000
   M'FILECODE'NOT'IN'RANGE    = M'FILE'LOCKWORD'WRONG    + 1,           06082000
   M'FLAB'ADDRESS'MISMATCH    = M'FILECODE'NOT'IN'RANGE  + 1,           06084000
   M'FLAB'CHECKSUM            = M'FLAB'ADDRESS'MISMATCH  + 1,           06086000
   M'FLAB'TITLE'MISMATCH      = M'FLAB'CHECKSUM          + 1,           06088000
   M'GROUP'DISC'SPACE         = M'FLAB'TITLE'MISMATCH    + 1,           06090000
   M'GROUP'SAVE'ACCESS        = M'GROUP'DISC'SPACE       + 1,           06092000
   M'HEADING                  = M'GROUP'SAVE'ACCESS      + 1,           06094000
   M'KEEP'OLD'COPY            = M'HEADING                + 1,           06096000
   M'LOADED                   = M'KEEP'OLD'COPY          + 1,           06098000
   M'LOCKWORD'VIOL            = M'LOADED                  + 1,          06100000
   M'MDATE'NOT'IN'RANGE       = M'LOCKWORD'VIOL          + 1,           06102000
   M'MISSING'EOF              = M'MDATE'NOT'IN'RANGE     + 1,           06104000
   M'MOUNT'FAILED             = M'MISSING'EOF            + 1,           06106000
   M'NEGATIVE'FILECODE        = M'MOUNT'FAILED           + 1,           06108000
   M'NO'ACCT                  = M'NEGATIVE'FILECODE      + 1,           06110000
   M'NO'CREATE                = M'NO'ACCT                + 1,           06112000
   M'NO'CREATOR               = M'NO'CREATE              + 1,           06114000
   M'NO'FILE                  = M'NO'CREATOR             + 1,           06116000
   M'NO'GROUP                 = M'NO'FILE                + 1,           06118000
   M'NO'FILES'TO'RESTORE      = M'NO'GROUP               + 1,           06120000
   M'NO'FILES'TO'STORE        = M'NO'FILES'TO'RESTORE    + 1,           06122000
   M'NOLOCK'WRITE'FAILED      = M'NO'FILES'TO'STORE      + 1,           06124000
   M'NOT'ALL'SECTORS'WRITTEN  = M'NOLOCK'WRITE'FAILED    + 1,           06126000
   M'NOT'ON'TAPE              = M'NOT'ALL'SECTORS'WRITTEN+ 1,           06128000
   M'NOUNLOCK'WRITE'FAILED    = M'NOT'ON'TAPE            + 1,           06130000
   M'OPEN'FAIL                = M'NOUNLOCK'WRITE'FAILED  + 1,           06132000
   M'OPEN'FOR'READ            = M'OPEN'FAIL              + 1,           06134000
   M'OPEN'FOR'RESTORE         = M'OPEN'FOR'READ          + 1,           06136000
   M'OPEN'FOR'RW              = M'OPEN'FOR'RESTORE       + 1,           06138000
   M'OPEN'FOR'STORE           = M'OPEN'FOR'RW            + 1,           06140000
   M'OPEN'FOR'WRITE           = M'OPEN'FOR'STORE         + 1,           06142000
   M'OUT'OF'DISC'SPACE        = M'OPEN'FOR'WRITE         + 1,           06144000
   M'PRE'ACCROSS'ACCOUNTS     = M'OUT'OF'DISC'SPACE      + 1,           06146000
   M'PRE'NO'SAVE'ACCESS       = M'PRE'ACCROSS'ACCOUNTS   + 1,           06148000
   M'PREV'CATASTROPHIC        = M'PRE'NO'SAVE'ACCESS     + 1,           06150000
   M'PV'DISMOUNT'FAIL         = M'PREV'CATASTROPHIC      + 1,           06152000
   M'PV'MOUNT'PROBLEM         = M'PV'DISMOUNT'FAIL       + 1,           06154000
   M'READ'FILE'LABEL'FAILED   = M'PV'MOUNT'PROBLEM       + 1,           06156000
   M'REEL'SUPPLIED            = M'READ'FILE'LABEL'FAILED + 1,           06158000
   M'RES'ACCT'DOESNT'EXIST    = M'REEL'SUPPLIED          + 1,           06160000
   M'RES'ACCT'VERIFY          = M'RES'ACCT'DOESNT'EXIST  + 1,           06162000
   M'RES'GROUP'DOESNT'EXIST   = M'RES'ACCT'VERIFY        + 1,           06164000
   M'RES'GROUP'VERIFY         = M'RES'GROUP'DOESNT'EXIST + 1,           06166000
   M'RES'USER'DOESNT'EXIST    = M'RES'GROUP'VERIFY       + 1,           06168000
   M'RES'USER'VERIFY          = M'RES'USER'DOESNT'EXIST  + 1,           06170000
   M'RESTORE'PREVIEW          = M'RES'USER'VERIFY        + 1,           06172000
   M'RESTORE'SUMMARY          = M'RESTORE'PREVIEW        + 1,           06174000
   M'RESTORED                 = M'RESTORE'SUMMARY        + 1,           06176000
   M'SAVING'FILE              = M'RESTORED               + 1,           06178000
   M'SECURITY                 = M'SAVING'FILE            + 1,           06180000
   M'SETTING'EOF              = M'SECURITY               + 1,           06182000
   M'STORE'SUMMARY            = M'SETTING'EOF            + 1,           06184000
   M'SYNCHRONIZING            = M'STORE'SUMMARY          + 1,           06186000
   M'STORED                   = M'SYNCHRONIZING          + 1,           06188000
   M'T'EOF'TAPEREAD           = M'STORED                 + 1,           06190000
   M'T'NEXT'TAPE'FILE'ERROR   = M'T'EOF'TAPEREAD         + 1,           06192000
   M'T'TRLBL'ERROR            = M'T'NEXT'TAPE'FILE'ERROR + 1,           06194000
   M'TAPE'BAD'LOCKWORD        = M'T'TRLBL'ERROR          + 1,           06196000
   M'TAPE'DESIRED             = M'TAPE'BAD'LOCKWORD      + 1,           06198000
   M'TAPE'VERSION             = M'TAPE'DESIRED           + 1,           06200000
   M'TEXT                     = M'TAPE'VERSION           + 1,           06202000
   M'TIME'INFO                = M'TEXT                   + 1,           06204000
   M'TITLE                    = M'TIME'INFO              + 1,  <<06156>>06205000
   M'W'CREATOR'CHANGED        = M'TITLE                  + 1,  <<06156>>06206000
   M'DISK'WRITE'FAILED        = M'W'CREATOR'CHANGED      + 1,           06208000
   M'WRITE'FILE'LABEL'FAILED  = M'DISK'WRITE'FAILED      + 1,           06210000
   M'NOT'PURGED               = M'WRITE'FILE'LABEL'FAILED+ 1;           06210100
$PAGE "GLOBAL EQUATES -- MISCELLANEOUS ERROR NUMBERS"                   06500000
EQUATE                                                                  06502000
                                                                        06504000
      <<Bad file title error message equates...>>                       06506000
                                                                        06508000
   FILEXPINVMONTH    =  280,  <<BAD NO. FOR MONTH>>                     06510000
   FILEXPNOSLASHMD   =  281,  <<NO SLASH BETWEEN MONTH & DAY>>          06512000
   FILEXPINVDAY      =  282,  <<BAD NO. FOR DAY>>                       06514000
   FILEXPNOSLASHDY   =  284,  <<NO SLASH BETWEEN DAY & YEAR>>           06516000
   FILEXPXTRNDATA    =  286,  <<EXTRANEOUS DATA IN DATE>>               06518000
                                                                        06520000
      <<error numbers for standard form conversion...>>                 06522000
                                                                        06524000
         <<from standard to display...>>                                06526000
                                                                        06528000
   DE'STANDARD'TOO'LONG =  1, <<resultant display title too long>>      06530000
   DE'STANDARD'EMPTY    =  2, <<zero length file part in std title>>    06532000
                                                                        06534000
         <<from display to standard...>>                                06536000
                                                                        06538000
   SE'PART'TOO'LONG     =  1, <<part too long>>                         06540000
   SE'ZERO'PART         =  2, <<zero length part>>                      06542000
   SE'WILD'AND'DOLLAR   =  3, <<wildcard and $>>                        06544000
   SE'WILD'AND'STAR     =  4, <<wildcard and *>>                        06546000
   SE'FIRST'NOT'LETTER  =  5, <<first char must be letter>>             06548000
   SE'LOCKWORD'LOC      =  6, <<bad place for lockword>>                06550000
   SE'TOO'MANY'PERIODS  =  7, <<too many periods>>                      06552000
   SE'STAR'NOT'FIRST    =  8, <<"*" must be first character>>           06554000
   SE'DOLLAR'NOT'FIRST  =  9, <<"$" must be first character>>           06556000
   SE'ILLEGAL'CHARACTER = 10, <<invalid title character>>               06558000
   SE'MISSING'PARAMETERS= 11, <<needed parameters were omitted>>        06560000
         <<errors from various ALLOW bits ...>>                         06562000
   SE'FOUND'BACKREF     = 12, <<backref found but not allowed!>>        06564000
   SE'FOUND'DOLLAR      = 13, <<dollar found but not allowed!>>         06566000
   SE'FOUND'WILD        = 14, <<found wildcards!>>                      06568000
   SE'FOUND'MULTI       = 15, <<multiple file parts found>>             06570000
   SE'FOUND'LOCK        = 16, <<found a lockword>>                      06572000
   SE'FOUND'GROUP       = 17, <<found a group part>>                    06574000
   SE'FOUND'ACCT        = 18, <<found an acct>>                         06576000
   SE'FOUND'FAMILY      = 19, <<found a family part>>                   06578000
   SE'FOUND'HOST        = 20; <<found a host part>>                     06580000
                                                                        06582000
$PAGE "INTRINSICS DECLARATIONS"                                         07000000
INTRINSIC                                                               07002000
   ASCII,                                                               07004000
   BINARY,                                                              07006000
   CALENDAR,                                                            07008000
   CLOCK,                                                               07010000
   COMMAND,                                                             07012000
   DASCII,                                                              07014000
   DBINARY,                                                             07016000
   DEBUG,                                                               07018000
   FATHER,                                                     <<04870>>07020000
   FCHECK,                                                              07022000
   FCLOSE,                                                              07024000
   FCONTROL,                                                            07026000
   FERRMSG,                                                             07027000
   FFILEINFO,                                                           07028000
   FGETINFO,                                                            07030000
   FINDJCW,                                                             07032000
   FMTDATE,                                                             07034000
   FOPEN,                                                               07036000
   FPOINT,                                                              07038000
   FREAD,                                                               07040000
   FREADDIR,                                                   <<LB.RS>>07041000
   FREADLABEL,                                                          07042000
   FRENAME,                                                             07044000
   FSPACE,                                                              07046000
   FUPDATE,                                                             07048000
   FWRITE,                                                              07050000
   FWRITELABEL,                                                         07052000
   GENMESSAGE,                                                          07054000
   GETPRIVMODE,                                                         07056000
   GETUSERMODE,                                                         07058000
   MAIL,                                                                07060000
   PAUSE,                                                               07062000
   PRINT,                                                               07064000
   PRINTOP,                                                             07066000
   PRINTFILEINFO,                                                       07068000
   PROCTIME,                                                            07070000
   PUTJCW,                                                              07072000
   QUIT,                                                       <<LB.RS>>07073000
   READ,                                                                07074000
   READX,                                                               07076000
   RECEIVEMAIL,                                                         07078000
   SENDMAIL,                                                            07080000
   TIMER,                                                               07082000
   WHO,                                                                 07084000
   ZSIZE;                                                               07086000
$PAGE "EXTERNAL PROCEDURES DECLARATIONS"                                07088000
LOGICAL PROCEDURE ACCCHECK (LEVEL, ANAM, ASEC, GNAM, GSEC,              07090000
                            CREATOR, FSEC, USERINFO);                   07092000
         VALUE   LEVEL, ASEC, GSEC, FSEC;                               07094000
         INTEGER LEVEL;                                                 07096000
         LOGICAL        ASEC;                                           07098000
         DOUBLE               GSEC, FSEC;                               07100000
         BYTE ARRAY ANAM, GNAM, CREATOR, USERINFO;                      07102000
         OPTION EXTERNAL,                         VARIABLE;             07104000
                                                                        07106000
DOUBLE PROCEDURE ATTACHIO (LDEV, QMISC, DX, T, FUNC, CNT,               07108000
                           P1, P2, FLAGS);                              07110000
         VALUE   LDEV, QMISC, DX, T, FUNC, CNT, P1, P2, FLAGS;          07112000
         INTEGER LDEV, QMISC, DX, T, FUNC, CNT, P1, P2, FLAGS;          07114000
         OPTION EXTERNAL;                                               07116000
                                                                        07118000
PROCEDURE DATE'LINE (STRING);                                           07120000
         BYTE ARRAY STRING;                                             07122000
         OPTION EXTERNAL;                                               07124000
                                                                        07126000
DOUBLE PROCEDURE DIRECADJUST (NUMSECTS, DUMMY, A'NAME,                  07128000
                                 G'NAME, MVTABX);                       07130000
         VALUE  NUMSECTS, DUMMY, MVTABX;                                07132000
         DOUBLE NUMSECTS;                                               07134000
         INTEGER          DUMMY, MVTABX;                                07136000
         ARRAY A'NAME, G'NAME;                                          07138000
         OPTION EXTERNAL,                         VARIABLE;             07140000
                                                                        07142000
DOUBLE PROCEDURE DIRECFIND (TYPE, LINKAGE'INDEXP, A'NAME,               07144000
                            G'NAME, F'NAME, A);                         07146000
         VALUE   TYPE, LINKAGE'INDEXP;                                  07148000
         INTEGER TYPE;                                                  07150000
         DOUBLE        LINKAGE'INDEXP;                                  07152000
         INTEGER ARRAY A'NAME, G'NAME, F'NAME, A;                       07154000
         OPTION EXTERNAL;                                               07156000
                                                                        07158000
DOUBLE PROCEDURE DIRECFINDFILE (TYPE, LINKAGE'INDEXP, A'NAME,           07160000
                                G'NAME, F'NAME, PRETURN, MVTABX);       07162000
         VALUE   TYPE, MVTABX, LINKAGE'INDEXP;                          07164000
         INTEGER TYPE, MVTABX;                                          07166000
         DOUBLE                LINKAGE'INDEXP;                          07168000
         ARRAY A'NAME, G'NAME, F'NAME, PRETURN;                         07170000
         OPTION EXTERNAL,                         VARIABLE;             07172000
                                                                        07174000
DOUBLE PROCEDURE DIRECINSERT (TYPE, LINKAGE'INDEXP, A'NAME,             07176000
                              G'NAME, F'NAME, A, MVTABX);               07178000
         VALUE   TYPE, MVTABX, LINKAGE'INDEXP;                          07180000
         INTEGER TYPE, MVTABX;                                          07182000
         DOUBLE                LINKAGE'INDEXP;                          07184000
         INTEGER ARRAY A'NAME, G'NAME, F'NAME, A;                       07186000
         OPTION EXTERNAL,                         VARIABLE;             07188000
                                                                        07190000
DOUBLE PROCEDURE DIRECINSERTFILE (NUMSECTS, DUMMY, A'NAME,              07192000
                                  G'NAME, F'NAME, FADDR, MVTABX);       07194000
         VALUE  NUMSECTS, FADDR, DUMMY, MVTABX;                         07196000
         DOUBLE NUMSECTS, FADDR;                                        07198000
         INTEGER                 DUMMY, MVTABX;                         07200000
         ARRAY A'NAME, G'NAME, F'NAME;                                  07202000
         OPTION EXTERNAL,                         VARIABLE;             07204000
                                                                        07206000
DOUBLE PROCEDURE DIRECPURGEFILE (NUMSECTS, DUMMY, A'NAME, G'NAME,       07208000
                                 F'NAME, MVTABX);                       07210000
         VALUE  NUMSECTS, DUMMY, MVTABX;                                07212000
         DOUBLE NUMSECTS;                                               07214000
         INTEGER          DUMMY, MVTABX;                                07216000
         ARRAY A'NAME, G'NAME, F'NAME;                                  07218000
         OPTION EXTERNAL,                         VARIABLE;             07220000
                                                                        07222000
DOUBLE PROCEDURE DIRECRESETFLAG (TYPE, LINKAGE'INDEXP, A'NAME,          07224000
                                 G'NAME, F'NAME, MVTABX);               07226000
         VALUE   TYPE, MVTABX, LINKAGE'INDEXP;                          07228000
         LOGICAL TYPE, MVTABX;                                          07230000
         DOUBLE                LINKAGE'INDEXP;                          07232000
         ARRAY A'NAME, G'NAME, F'NAME;                                  07234000
         OPTION EXTERNAL,                         VARIABLE;             07236000
                                                                        07238000
DOUBLE PROCEDURE DIRECSCAN (TYPE, LINKAGE'INDEXP, A'NAME,               07240000
                     GROUPNAME, FILENAME, RECIP, PARAMS, MVTABX);       07242000
         VALUE   TYPE, MVTABX, LINKAGE'INDEXP;                          07244000
         INTEGER TYPE, MVTABX;                                          07246000
         DOUBLE                LINKAGE'INDEXP;                          07248000
         INTEGER ARRAY A'NAME, GROUPNAME, FILENAME, PARAMS;             07250000
         INTEGER PROCEDURE RECIP;                                       07252000
         OPTION EXTERNAL,                         VARIABLE;             07254000
                                                                        07256000
DOUBLE PROCEDURE DIRECSETFLAG (TYPE, LINKAGE'INDEXP, A'NAME,            07258000
                               G'NAME, F'NAME, MVTABX);                 07260000
         VALUE   TYPE, MVTABX, LINKAGE'INDEXP;                          07262000
         LOGICAL TYPE, MVTABX;                                          07264000
         DOUBLE                LINKAGE'INDEXP;                          07266000
         ARRAY A'NAME, G'NAME, F'NAME;                                  07268000
         OPTION EXTERNAL,                         VARIABLE;             07270000
                                                                        07272000
PROCEDURE DIRREAD (PNTR, WHICH, EXCOUNT, EEMISCWD);            <<LB.RS>>07272100
         VALUE PNTR, WHICH, EXCOUNT,EEMISCWD;                  <<LB.RS>>07272200
         LOGICAL PNTR, WHICH, EEMISCWD;                        <<LB.RS>>07272300
         INTEGER EXCOUNT;                                      <<LB.RS>>07272400
         OPTION EXTERNAL;                                      <<LB.RS>>07272500
                                                               <<LB.RS>>07272600
INTEGER PROCEDURE DIRMATCH (GENNAME, REALNAME);                         07274000
         VALUE        GENNAME, REALNAME;                                07276000
         BYTE POINTER GENNAME, REALNAME;                                07278000
         OPTION EXTERNAL;                                               07280000
                                                                        07282000
PROCEDURE DIRWRITE (WHICH);                                    <<LB.RS>>07282100
         VALUE WHICH;                                          <<LB.RS>>07282200
         LOGICAL WHICH;                                        <<LB.RS>>07282300
         OPTION EXTERNAL;                                      <<LB.RS>>07282400
                                                               <<LB.RS>>07282500
INTEGER PROCEDURE DISKALLOC (INDX, NUMEXT, SPACEDATA, PVINFO);          07284000
         VALUE   INDX, NUMEXT, PVINFO;                                  07286000
         INTEGER INDX, NUMEXT;                                          07288000
         LOGICAL               PVINFO;                                  07290000
         DOUBLE ARRAY SPACEDATA;                                        07292000
         OPTION EXTERNAL;                                               07294000
                                                                        07296000
INTEGER PROCEDURE DISKDEALLOC (EXTSIZE, LASTEXTSIZE, NUMEXTS, MAP);     07298000
         VALUE   NUMEXTS, EXTSIZE, LASTEXTSIZE;                         07300000
         INTEGER NUMEXTS, EXTSIZE, LASTEXTSIZE;                         07302000
         DOUBLE ARRAY MAP;                                              07304000
         OPTION EXTERNAL;                                               07306000
                                                                        07308000
INTEGER PROCEDURE DISKSPACE (LDEV, NSECT, DISKADDR);                    07310000
         VALUE   LDEV, NSECT;                                           07312000
         INTEGER LDEV;                                                  07314000
         DOUBLE        NSECT, DISKADDR;                                 07316000
         OPTION EXTERNAL;                                               07318000
                                                                        07320000
PROCEDURE DISMOUNT (VSNAME, VSGROUP, VSACCT, REQTYPE,                   07322000
                    PVINFO, SOME'OTHER'PIN);                            07324000
         VALUE   PVINFO, SOME'OTHER'PIN;                                07326000
         INTEGER PVINFO, SOME'OTHER'PIN, REQTYPE;                       07328000
         BYTE ARRAY VSNAME, VSGROUP, VSACCT;                            07330000
         OPTION EXTERNAL,                         VARIABLE;             07332000
                                                                        07334000
INTEGER PROCEDURE EXCHANGEDB (I);                                       07336000
         VALUE   I;                                                     07338000
         INTEGER I;                                                     07340000
         OPTION EXTERNAL;                                               07342000
                                                                        07344000
INTEGER PROCEDURE FLABIO (LDEV, SECTOR, FUNC, FILE'LABEL);              07346000
         VALUE   LDEV, SECTOR, FUNC;                                    07348000
         INTEGER LDEV,         FUNC;                                    07350000
         DOUBLE        SECTOR;                                          07352000
         INTEGER ARRAY FILE'LABEL;                                      07354000
         OPTION EXTERNAL;                                               07356000
                                                                        07358000
PROCEDURE FLABIOERR (FLAG,FILENUM,FGANAME);                             07360000
   VALUE FLAG,FILENUM,FGANAME;                                          07362000
   LOGICAL FLAG;                                                        07364000
   INTEGER FILENUM,FGANAME;                                             07366000
   OPTION EXTERNAL, VARIABLE;                                           07368000
                                                                        07370000
INTEGER PROCEDURE FORMSG (INBUFF, SETNO, MSGNO, MASK,                   07372000
            P1, P2, P3, P4, P5, OUTBUFF, OUTBUFFSIZE, OUTLEN,           07374000
            DEST, CONTROL);                                             07376000
         VALUE   SETNO, MSGNO, OUTBUFFSIZE, DEST,                       07378000
                 MASK, P1, P2, P3, P4, P5, CONTROL;                     07380000
         INTEGER SETNO, MSGNO, OUTBUFFSIZE, DEST, OUTLEN;               07382000
         LOGICAL MASK, P1, P2, P3, P4, P5, CONTROL;                     07384000
         BYTE ARRAY INBUFF, OUTBUFF;                                    07386000
         OPTION EXTERNAL;                                               07388000
                                                                        07390000
PROCEDURE FREEZE (EN, TEST, PINX);                                      07392000
         VALUE   EN, TEST, PINX;                                        07394000
         INTEGER EN, PINX;                                              07396000
         LOGICAL TEST;                                                  07398000
         OPTION EXTERNAL;                                               07400000
                                                                        07402000
LOGICAL PROCEDURE FREPLY (MESSAGE, LENGTH);                             07404000
         VALUE   LENGTH;                                                07406000
         INTEGER LENGTH;                                                07408000
         BYTE ARRAY MESSAGE;                                            07410000
         OPTION EXTERNAL;                                               07412000
                                                                        07414000
INTEGER PROCEDURE GENMSG (SETNO, MSGNO, MASK, A, B, C, D, E,            07416000
                          DEST, REPLY, BUFF, DST, IOTYPE);              07418000
         VALUE   SETNO, MSGNO, MASK, A, B, C, D, E, DEST, REPLY, BUFF,  07420000
               DST, IOTYPE;                                             07422000
         LOGICAL SETNO, MSGNO, MASK, A, B, C, D, E, DEST, REPLY, BUFF,  07424000
               DST, IOTYPE;                                             07426000
         OPTION EXTERNAL,                         VARIABLE;             07428000
                                                                        07430000
PROCEDURE GENMSGU (I, J);                                               07432000
         VALUE     I, J;                                                07434000
         INTEGER   I, J;                                                07436000
         OPTION EXTERNAL;                                               07438000
                                                                        07440000
PROCEDURE GET'FILEMNEMONIC (FILECODE, MNEMONIC, LEN);                   07442000
         INTEGER FILECODE, LEN;                                         07444000
         BYTE ARRAY MNEMONIC;                                           07446000
         OPTION EXTERNAL;                                               07448000
                                                                        07450000
INTEGER PROCEDURE GETDATASEG (MSIZE, VMSIZE);                           07452000
         VALUE   MSIZE, VMSIZE;                                         07454000
         INTEGER MSIZE, VMSIZE;                                         07456000
         OPTION EXTERNAL;                                               07458000
                                                                        07460000
INTEGER PROCEDURE GETDEVINFO (DEV, INFO);                               07462000
         BYTE ARRAY DEV;                                                07464000
         INTEGER ARRAY INFO;                                            07466000
         OPTION EXTERNAL;                                               07468000
                                                                        07470000
INTEGER PROCEDURE GETSIR (A);                                           07472000
         VALUE   A;                                                     07474000
         INTEGER A;                                                     07476000
         OPTION EXTERNAL;                                               07478000
                                                                        07480000
INTEGER PROCEDURE IOSTAT (STAT);                                        07482000
         VALUE   STAT;                                                  07484000
         INTEGER STAT;                                                  07486000
         OPTION EXTERNAL;                                               07488000
                                                                        07490000
LOGICAL PROCEDURE JOBSESSIONMAIN;                                       07492000
         OPTION EXTERNAL;                                               07494000
                                                                        07496000
INTEGER PROCEDURE LDEVTOSUBTYPE (LDEV);                                 07498000
         VALUE LDEV;                                                    07500000
         INTEGER LDEV;                                                  07502000
         OPTION EXTERNAL;                                               07504000
                                                                        07506000
INTEGER PROCEDURE LDEVTOTYPE (LDEV);                                    07508000
         VALUE LDEV;                                                    07510000
         INTEGER LDEV;                                                  07512000
         OPTION EXTERNAL;                                               07514000
                                                                        07516000
PROCEDURE LDEVTOVTAB (T, S, COUNT, LOCAL);                              07518000
         VALUE   COUNT, LOCAL;                                          07520000
         INTEGER COUNT;                                                 07522000
         LOGICAL        LOCAL;                                          07524000
         DOUBLE ARRAY T, S;                                             07526000
         OPTION EXTERNAL;                                               07528000
                                                                        07530000
LOGICAL PROCEDURE LDIRECTF (FNUM);                                      07532000
         VALUE   FNUM;                                                  07534000
         INTEGER FNUM;                                                  07536000
         OPTION EXTERNAL;                                               07538000
                                                                        07540000
PROCEDURE LOCKSEG (EN, TEST, PINX);                                     07542000
         VALUE   EN, TEST, PINX;                                        07544000
         INTEGER EN, PINX;                                              07546000
         LOGICAL TEST;                                                  07548000
         OPTION EXTERNAL;                                               07550000
                                                                        07552000
LOGICAL PROCEDURE LRELSW (FNUM);                                        07554000
         VALUE   FNUM;                                                  07556000
         INTEGER FNUM;                                                  07558000
         OPTION EXTERNAL;                                               07560000
                                                                        07562000
INTEGER PROCEDURE LUN (VTABINX, MVTABX);                                07564000
         VALUE   VTABINX, MVTABX;                                       07566000
         INTEGER VTABINX, MVTABX;                                       07568000
         OPTION EXTERNAL;                                               07570000
                                                                        07572000
PROCEDURE MOUNT (VSNAME, VSGROUP, VSACCNT, REQTYPE, GEN,                07574000
                 PVINFO, SOME'OTHER'PIN);                               07576000
         VALUE   GEN, SOME'OTHER'PIN;                                   07578000
         INTEGER GEN, SOME'OTHER'PIN, REQTYPE, PVINFO;                  07580000
         BYTE ARRAY VSNAME, VSGROUP, VSACCNT;                           07582000
         OPTION EXTERNAL,                         VARIABLE;             07584000
                                                                        07586000
INTEGER PROCEDURE NEXTTAPEFILE (FNUM);                                  07588000
         INTEGER FNUM;                                                  07590000
         OPTION EXTERNAL;                                               07592000
                                                                        07594000
PROCEDURE POST'ACB'ERROR (FILENUM, THEIRSTATUS, ERROR);                 07596000
         VALUE   FILENUM, THEIRSTATUS, ERROR;                           07598000
         INTEGER FILENUM, ERROR;                                        07600000
         LOGICAL THEIRSTATUS;                                           07602000
         OPTION EXTERNAL;                                               07604000
                                                                        07606000
PROCEDURE PROCINFO (ERROR1, ERROR2, PIN, OPTION1, ITEM1,       <<04870>>07608000
                                         OPTION2, ITEM2,       <<04870>>07610000
                                         OPTION3, ITEM3,       <<04870>>07612000
                                         OPTION4, ITEM4,       <<04870>>07614000
                                         OPTION5, ITEM5,       <<04870>>07616000
                                         OPTION6, ITEM6);      <<04870>>07618000
         VALUE PIN, OPTION1, OPTION2, OPTION3, OPTION4,        <<04870>>07620000
               OPTION5, OPTION6;                               <<04870>>07622000
         INTEGER ERROR1, ERROR2, PIN, OPTION1, OPTION2,        <<04870>>07624000
                 OPTION3, OPTION4, OPTION5, OPTION6;           <<04870>>07626000
         BYTE ARRAY ITEM1, ITEM2, ITEM3, ITEM4, ITEM5, ITEM6;  <<04870>>07628000
         OPTION VARIABLE, EXTERNAL;                            <<04870>>07630000
LOGICAL PROCEDURE PRODUCEPARMS (LEAFLEVEL, QNAME, PPRESULT,             07632000
                               DELIM, ERRNUM);                          07634000
         VALUE   LEAFLEVEL, QNAME;                                      07636000
         INTEGER LEAFLEVEL;                                             07638000
         BYTE POINTER       QNAME;                                      07640000
         ARRAY PPRESULT;                                                07642000
         BYTE POINTER DELIM;                                            07644000
         INTEGER ERRNUM;                                                07646000
         OPTION EXTERNAL;                                               07648000
                                                                        07650000
                                                                        07652000
INTEGER PROCEDURE REELSWITCH (LDEV, RDWR);                              07654000
         VALUE   LDEV, RDWR;                                            07656000
         LOGICAL LDEV;                                                  07658000
         INTEGER       RDWR;                                            07660000
         OPTION EXTERNAL;                                               07662000
                                                                        07664000
PROCEDURE RELDATASEG (EN);                                              07666000
         VALUE   EN;                                                    07668000
         INTEGER EN;                                                    07670000
         OPTION EXTERNAL;                                               07672000
                                                                        07674000
INTEGER PROCEDURE RETURN'DISC'SPACE (LDEV, DISC'ADDRESS,       <<LB.RS>>07674100
                                     NUMBER'OF'SECTORS);       <<LB.RS>>07674200
         VALUE LDEV, DISC'ADDRESS, NUMBER'OF'SECTORS;          <<LB.RS>>07674300
         INTEGER LDEV;                                         <<LB.RS>>07674400
         DOUBLE NUMBER'OF'SECTORS, DISC'ADDRESS;               <<LB.RS>>07674500
         OPTION EXTERNAL;                                      <<LB.RS>>07674600
                                                                        07676000
PROCEDURE RELSIR (A, B);                                                07678000
         VALUE   A, B;                                                  07680000
         INTEGER A, B;                                                  07682000
         OPTION EXTERNAL;                                               07684000
                                                                        07686000
LOGICAL PROCEDURE REQUESTSERVICE;                                       07688000
         OPTION EXTERNAL;                                               07690000
                                                                        07692000
PROCEDURE RESETCRITICAL (A);                                            07694000
         VALUE   A;                                                     07696000
         LOGICAL A;                                                     07698000
         OPTION EXTERNAL;                                               07700000
                                                                        07702000
LOGICAL PROCEDURE SETCRITICAL;                                          07704000
         OPTION EXTERNAL;                                               07706000
                                                                        07708000
PROCEDURE UNFREEZE (EN, TEST, PINX);                                    07710000
         VALUE   EN, TEST, PINX;                                        07712000
         INTEGER EN, PINX;                                              07714000
         LOGICAL TEST;                                                  07716000
         OPTION EXTERNAL;                                               07718000
                                                                        07720000
PROCEDURE UNLOCKSEG (EN, TEST, PINX);                                   07722000
         VALUE   EN, TEST, PINX;                                        07724000
         INTEGER EN, PINX;                                              07726000
         LOGICAL TEST;                                                  07728000
         OPTION EXTERNAL;                                               07730000
                                                                        07732000
INTEGER PROCEDURE VTABINX (LUN, LOCAL);                                 07734000
         VALUE   LUN, LOCAL;                                            07736000
         INTEGER LUN;                                                   07738000
         LOGICAL      LOCAL;                                            07740000
         OPTION EXTERNAL;                                               07742000
                                                                        07744000
PROCEDURE VTABTOLDEV (T, S, COUNT, MVTABX);                             07746000
         VALUE   COUNT, MVTABX;                                         07748000
         INTEGER COUNT, MVTABX;                                         07750000
         DOUBLE ARRAY T, S;                                             07752000
         OPTION EXTERNAL;                                               07754000
                                                                        07756000
DOUBLE PROCEDURE WAITFORIO (IOQX);                                      07758000
         VALUE   IOQX;                                                  07760000
         INTEGER IOQX;                                                  07762000
         OPTION EXTERNAL;                                               07764000
                                                                        07766000
INTEGER PROCEDURE XDISKSPACE (LDEV, NSECT, DISKADDR);                   07768000
         VALUE   LDEV, NSECT, DISKADDR;                                 07770000
         INTEGER LDEV;                                                  07772000
         DOUBLE        NSECT, DISKADDR;                                 07774000
         OPTION EXTERNAL;                                               07776000
                                                                        07778000
INTEGER PROCEDURE XRETPMASK (N1, N2, N3, PMASKHI, PMASKLO);             07780000
         LOGICAL PMASKHI, PMASKLO;                                      07782000
         BYTE ARRAY N1, N2, N3;                                         07784000
         OPTION EXTERNAL;                                               07786000
$PAGE "FORWARD PROCEDURE DECLARATIONS"                                  08000000
PROCEDURE CALL'SUDDENDEATH (ERR);                                       08002000
         VALUE ERR;                                                     08004000
         INTEGER ERR;                                                   08006000
         OPTION FORWARD,  UNCALLABLE;                                   08008000
                                                                        08010000
PROCEDURE CHANGE'JIT'ACCT (DSTNO, ACCTNAME);                            08012000
   VALUE DSTNO;                                                         08014000
   INTEGER DSTNO;                                                       08016000
   LOGICAL ARRAY ACCTNAME;                                              08018000
   OPT'FORWARD;                                                         08020000
                                                                        08038000
LOGICAL PROCEDURE CHECK'FOR'DISMOUNT (OLD'PVINFO, CURR'PVINFO,          08040000
                                  OLD'GBUF, ERR'CODE);                  08042000
         VALUE   OLD'PVINFO, CURR'PVINFO;                               08044000
         LOGICAL OLD'PVINFO, CURR'PVINFO;                               08046000
         INTEGER ERR'CODE;                                              08048000
         ARRAY   OLD'GBUF;                                              08050000
         OPTION FORWARD,  UNCALLABLE, PRIVILEGED;                       08052000
                                                                        08054000
LOGICAL PROCEDURE CHECK'STORE'RESTORE'LABEL;                            08056000
         OPTION FORWARD UNCALLABLE;                                     08058000
                                                                        08060000
LOGICAL PROCEDURE CHECK'USER(ACCTNAME,USERNAME,ERRCODE);       <<LB.RS>>08060100
         BYTE ARRAY ACCTNAME, USERNAME;                        <<LB.RS>>08060200
         INTEGER ERRCODE;                                      <<LB.RS>>08060300
         OPTION FORWARD;                                       <<LB.RS>>08060400
                                                               <<LB.RS>>08060500
LOGICAL PROCEDURE CHECKSUM (BUFFER, LEN);                               08062000
         VALUE   LEN;                                                   08064000
         INTEGER LEN;                                                   08066000
         LOGICAL ARRAY BUFFER;                                          08068000
         OPTION FORWARD,  UNCALLABLE;                                   08070000
                                                                        08072000
PROCEDURE CLOSE'FILES (NOSHUT);                                         08074000
         VALUE                NOSHUT;                                   08076000
         INTEGER              NOSHUT;                                   08078000
         OPTION FORWARD,  UNCALLABLE;                                   08080000
                                                                        08082000
INTEGER PROCEDURE CONVERT'SE'TO'CIERR (ERROR);                          08084000
         VALUE   ERROR;                                                 08086000
         INTEGER ERROR;                                                 08088000
         OPTION FORWARD,  UNCALLABLE;                                   08090000
                                                                        08092000
PROCEDURE CXSTORE'RESTORE (P, STDLISTNUM, WANTS);                       08094000
         VALUE   STDLISTNUM, WANTS;                                     08096000
         INTEGER STDLISTNUM;                                            08098000
         LOGICAL WANTS;                                                 08100000
         BYTE ARRAY P;                                                  08102000
         OPTION FORWARD,  UNCALLABLE, PRIVILEGED;                       08104000
                                                                        08106000
LOGICAL PROCEDURE DIREC'TO'TAPE (TDBUF);                                08108000
         INTEGER ARRAY TDBUF;                                           08110000
         OPTION FORWARD,  UNCALLABLE;                                   08112000
                                                                        08114000
LOGICAL PROCEDURE DIRECTORYSEARCH (THUNK);                              08116000
         LOGICAL PROCEDURE THUNK;                                       08118000
         OPTION FORWARD,  UNCALLABLE;                                   08120000
                                                                        08122000
PROCEDURE DISMOUNT'PRIVATE'VOLUMES;                                     08124000
         OPTION FORWARD,  UNCALLABLE;                                   08126000
                                                                        08128000
LOGICAL PROCEDURE DISPLAY'TO'STANDARD (PDIS, PSTD, ERROR, CHAR'INX,     08130000
                                       DELIMS', ALLOWED'ITEMS);         08132000
         VALUE        PDIS, PSTD, DELIMS', ALLOWED'ITEMS;               08134000
         LOGICAL ALLOWED'ITEMS;                                         08136000
         BYTE POINTER PDIS, PSTD, DELIMS';                              08138000
         INTEGER      ERROR, CHAR'INX;                                  08140000
         OPTION FORWARD,  UNCALLABLE,             VARIABLE;             08142000
                                                                        08144000
PROCEDURE DISPLAY'3'TO'DISPLAY (TARGET,LEN,FILENAME,           <<LB.RS>>08144100
                                GROUPNAME,ACCTNAME);           <<LB.RS>>08144110
         INTEGER LEN;                                          <<LB.RS>>08144200
         BYTE ARRAY TARGET, FILENAME, GROUPNAME, ACCTNAME;     <<LB.RS>>08144300
         OPT'FORWARD;                                          <<LB.RS>>08144400
LOGICAL PROCEDURE DISPLAY'3'TO'STANDARD (F', G', A',                    08146000
                                         PSTD, ERROR);                  08148000
         VALUE PSTD;                                                    08150000
         INTEGER ERROR;                                                 08152000
         BYTE POINTER PSTD;                                             08154000
         BYTE ARRAY F', G', A';                                         08156000
         OPTION FORWARD,  UNCALLABLE;                                   08158000
                                                                        08160000
PROCEDURE FILL (A, COUNT, WHAT);                                        08162000
         VALUE   COUNT, WHAT;                                           08164000
         LOGICAL COUNT, WHAT;                                           08166000
         INTEGER ARRAY A;                                               08168000
         OPTION FORWARD,  UNCALLABLE;                                   08170000
                                                                        08172000
PROCEDURE FILL' (A', COUNT, WHAT);                                      08174000
         VALUE WHAT, COUNT;                                             08176000
         BYTE  WHAT;                                                    08178000
         LOGICAL     COUNT;                                             08180000
         BYTE ARRAY A';                                                 08182000
         OPTION FORWARD,  UNCALLABLE;                                   08184000
                                                                        08186000
INTEGER PROCEDURE FIND'BLOCK'FACTOR (ERROR);                            08188000
         INTEGER ERROR;                                                 08190000
         OPTION FORWARD,  UNCALLABLE;                                   08192000
                                                                        08194000
DOUBLE PROCEDURE FIND'FILE'SIZE (TYP, EXTENT'SIZES'D);                  08196000
         VALUE   TYP;                                                   08198000
         INTEGER TYP;                                                   08200000
         DOUBLE ARRAY EXTENT'SIZES'D;                                   08202000
         OPTION FORWARD,  UNCALLABLE;                                   08204000
                                                                        08206000
LOGICAL PROCEDURE FINISH'REEL (TDBUF, MOREDATA);                        08208000
         VALUE   MOREDATA;                                              08210000
         LOGICAL MOREDATA;                                              08212000
         INTEGER ARRAY TDBUF;                                           08214000
         OPTION FORWARD,  UNCALLABLE;                                   08216000
                                                                        08218000
LOGICAL PROCEDURE FKONTROL (FID, WHAT);                                 08220000
         VALUE   WHAT;                                                  08222000
         INTEGER WHAT, FID;                                             08224000
         OPTION FORWARD,  UNCALLABLE;                                   08226000
                                                                        08228000
LOGICAL PROCEDURE FRESTORE (TDBUF);                                     08230000
         INTEGER ARRAY TDBUF;                                           08232000
         OPT'FORWARD'PRIV;                                              08234000
                                                                        08236000
LOGICAL PROCEDURE FSTORE (TDBUF);                                       08238000
         INTEGER ARRAY TDBUF;                                           08240000
         OPTION FORWARD,  UNCALLABLE, PRIVILEGED;                       08242000
                                                                        08244000
INTEGER PROCEDURE GET'JITDST;                                           08246000
   OPT'FORWARD;                                                         08248000
                                                                        08250000
PROCEDURE GET'SIRS (WANT'FISIR, WANT'DSIR);                             08252000
         VALUE WANT'FISIR, WANT'DSIR;                                   08254000
         LOGICAL WANT'FISIR, WANT'DSIR;                                 08256000
         OPTION FORWARD,  UNCALLABLE;                                   08258000
                                                                        08260000
INTEGER PROCEDURE GET'NEXT'VOLUME (DESTINATION, DISTANCE);              08262000
         VALUE DESTINATION;                                             08264000
         DOUBLE DESTINATION, DISTANCE;                                  08266000
         OPT'FORWARD'PRIV;                                              08268000
                                                                        08270000
DOUBLE PROCEDURE GET'PRIOR'LABELED'VOLUME;                              08272000
         OPT'FORWARD'PRIV;                                              08274000
                                                                        08276000
DOUBLE PROCEDURE GET'PRIOR'UNLABELED'VOLUME;                            08278000
         OPT'FORWARD'PRIV;                                              08280000
                                                                        08282000
LOGICAL PROCEDURE IRESTORE (TDBUF);                                     08284000
         INTEGER ARRAY TDBUF;                                           08286000
         OPT'FORWARD'PRIV;                                              08288000
                                                               <<LB.RS>>08288100
PROCEDURE ISSUE'CTRL (FUNC);                                   <<LB.RS>>08288200
         VALUE FUNC;                                           <<LB.RS>>08288300
         LOGICAL FUNC;                                         <<LB.RS>>08288400
         OPT'FORWARD;                                          <<LB.RS>>08288500
                                                               <<LB.RS>>08288600
                                                               <<LB.RS>>08288700
PROCEDURE ISSUE'READ (BUFFER, READLENGTH, USE'WAIT'IO);        <<LB.RS>>08288800
         VALUE READLENGTH, USE'WAIT'IO;                        <<LB.RS>>08288900
         LOGICAL ARRAY BUFFER;                                 <<LB.RS>>08289000
         INTEGER READLENGTH;                                   <<LB.RS>>08289100
         LOGICAL USE'WAIT'IO;                                  <<LB.RS>>08289200
         OPT'FORWARD;                                          <<LB.RS>>08289300
                                                               <<LB.RS>>08289400
PROCEDURE ISSUE'SKIP (USE'WAIT'IO);                            <<LB.RS>>08289500
         VALUE USE'WAIT'IO;                                    <<LB.RS>>08289600
         LOGICAL USE'WAIT'IO;                                  <<LB.RS>>08289700
         OPT'FORWARD;                                          <<LB.RS>>08289800
                                                               <<LB.RS>>08289900
                                                                        08290000
PROCEDURE JOIN'CONTIGUOUS'EXTENTS (NUM'DISJ'EXTS, DISJ'EXT'ADDR,        08292000
                                   DISJ'EXT'LEN,  ORIG'EXTMAP,          08294000
                                   ORIG'NUM'EXTENTS, EXTSIZE,  <<LB.RS>>08296000
                         LAST'EXTSIZE );                       <<LB.RS>>08297000
   VALUE ORIG'NUM'EXTENTS, EXTSIZE, LAST'EXTSIZE;              <<LB.RS>>08298000
   INTEGER NUM'DISJ'EXTS, ORIG'NUM'EXTENTS;                             08300000
   DOUBLE ARRAY DISJ'EXT'ADDR, DISJ'EXT'LEN, ORIG'EXTMAP;               08302000
   DOUBLE EXTSIZE, LAST'EXTSIZE;                               <<LB.RS>>08303000
   OPTION FORWARD, UNCALLABLE;                                          08304000
INTEGER PROCEDURE LOCK'DIRECTORY;                              <<LB.RS>>08304100
         OPTION FORWARD;                                       <<LB.RS>>08304200
                                                               <<LB.RS>>08304300
LOGICAL PROCEDURE LOCK'UNLOCK'FILE (SETTING, LDN, ADDRESS,              08306000
                                    GOTIT);                             08308000
         VALUE GOTIT, LDN, SETTING, ADDRESS;                            08310000
         INTEGER LDN, SETTING;                                          08312000
         DOUBLE ADDRESS;                                                08314000
         LOGICAL GOTIT;                                                 08316000
         OPTION FORWARD, UNCALLABLE, PRIVILEGED;                        08318000
                                                               <<04101>>08318100
PROCEDURE MARK'REEL'BAD;                                       <<04101>>08318200
         OPTION FORWARD;                                       <<04101>>08318300
                                                                        08320000
LOGICAL PROCEDURE MOUNT'VOLUME'SET (VSGROUP', VSACCT', INFO);  <<LB.RS>>08320100
         INTEGER INFO;                                         <<LB.RS>>08320200
         BYTE ARRAY VSGROUP', VSACCT';                         <<LB.RS>>08320300
         OPT'FORWARD;                                          <<LB.RS>>08320400
                                                               <<LB.RS>>08320500
PROCEDURE MOVE'DATA'IN (XDS, INX, BUF, LEN);                            08322000
         VALUE   XDS, INX, LEN;                                         08324000
         INTEGER XDS, INX, LEN;                                         08326000
         INTEGER ARRAY BUF;                                             08328000
         OPTION FORWARD,  UNCALLABLE, PRIVILEGED;                       08330000
                                                                        08332000
PROCEDURE MOVE'DATA'OUT (XDS, INX, BUF, LEN);                           08334000
         VALUE   XDS, INX, LEN;                                         08336000
         INTEGER XDS, INX, LEN;                                         08338000
         INTEGER ARRAY BUF;                                             08340000
         OPTION FORWARD,  UNCALLABLE, PRIVILEGED;                       08342000
                                                                        08344000
LOGICAL PROCEDURE OPEN'FILE (FILENO,                                    08346000
                             DESIG, FOPTIONS, AOPTIONS, RECSIZE,        08348000
                             DEV',                                      08350000
                             BLOCKFACTOR, NUMBUFFERS, FILESIZE,         08352000
                             NUMEXTENTS, INITIALLOC);                   08354000
         VALUE FOPTIONS, AOPTIONS, RECSIZE, BLOCKFACTOR,                08356000
               NUMBUFFERS, FILESIZE, NUMEXTENTS, INITIALLOC;            08358000
         INTEGER FILENO;                                                08360000
         INTEGER RECSIZE, BLOCKFACTOR, NUMBUFFERS,                      08362000
               NUMEXTENTS, INITIALLOC;                                  08364000
         LOGICAL FOPTIONS, AOPTIONS;                                    08366000
         BYTE ARRAY DEV';                                               08368000
         INTEGER ARRAY DESIG;                                           08370000
         DOUBLE FILESIZE;                                               08372000
         OPTION FORWARD,  UNCALLABLE,             VARIABLE;             08374000
                                                                        08376000
PROCEDURE OUTER'BLOCK (PARM, INFO'LENGTH, INFO'ADDRESS);                08378000
         VALUE   PARM, INFO'LENGTH, INFO'ADDRESS;                       08380000
         INTEGER PARM, INFO'LENGTH, INFO'ADDRESS;                       08382000
         OPTION FORWARD,  UNCALLABLE;                                   08384000
                                                                        08386000
LOGICAL PROCEDURE PARSE'DATE (PDATE);                                   08388000
         LOGICAL PDATE;                                                 08390000
         OPTION FORWARD,  UNCALLABLE;                                   08392000
                                                                        08394000
LOGICAL PROCEDURE PARSE'FILESET;                                        08396000
         OPTION FORWARD,  UNCALLABLE, PRIVILEGED;                       08398000
                                                                        08400000
INTEGER PROCEDURE PARSE'NAME (PTR, LEN);                                08402000
         VALUE   PTR, LEN;                                              08404000
         INTEGER LEN;                                                   08406000
         BYTE POINTER PTR;                                              08408000
         OPTION FORWARD,  UNCALLABLE;                                   08410000
                                                                        08412000
LOGICAL PROCEDURE PARSE'OTHER'PARMS;                                    08414000
         OPTION FORWARD,  UNCALLABLE;                                   08416000
                                                                        08418000
LOGICAL PROCEDURE PATTERN'BUILD (PTEXT, PATTERN, ERROR);                08420000
         VALUE        PTEXT;                                            08422000
         BYTE POINTER PTEXT;                                            08424000
         INTEGER ERROR;                                                 08426000
         INTEGER ARRAY PATTERN;                                         08428000
         OPTION FORWARD,  UNCALLABLE;                                   08430000
                                                                        08432000
LOGICAL PROCEDURE PATTERN'BUILD'STANDARD (PSTD, F'PAT, G'PAT, A'PAT,    08434000
                                          ERROR);                       08436000
         VALUE PSTD;                                                    08438000
         BYTE POINTER PSTD;                                             08440000
         INTEGER ARRAY F'PAT, G'PAT, A'PAT;                             08442000
         INTEGER ERROR;                                                 08444000
         OPTION FORWARD,  UNCALLABLE;                                   08446000
                                                                        08448000
LOGICAL PROCEDURE PATTERN'MATCH (PTEXT, PATTERN);                       08450000
         VALUE        PTEXT;                                            08452000
         BYTE POINTER PTEXT;                                            08454000
         INTEGER ARRAY PATTERN;                                         08456000
         OPTION FORWARD,  UNCALLABLE;                                   08458000
                                                                        08460000
LOGICAL PROCEDURE PATTERN'MATCH'STANDARD (PSTDA, FILE'PAT, GROUP'PAT,   08462000
                                          ACCT'PAT, ERROR);             08464000
         INTEGER ARRAY FILE'PAT, GROUP'PAT, ACCT'PAT;                   08466000
         BYTE ARRAY PSTDA;                                              08468000
         INTEGER ERROR;                                                 08470000
         OPTION FORWARD,  UNCALLABLE;                                   08472000
                                                                        08474000
LOGICAL PROCEDURE PATTERN'3'MATCH (F', G', A', FILE'PAT, GROUP'PAT,     08476000
                                          ACCT'PAT, ERROR);             08478000
         INTEGER ARRAY FILE'PAT, GROUP'PAT, ACCT'PAT;                   08480000
         BYTE ARRAY F', G', A';                                         08482000
         INTEGER ERROR;                                                 08484000
         OPTION FORWARD,  UNCALLABLE;                                   08486000
                                                                        08488000
PROCEDURE PRINT'CARROT (INX);                                           08490000
         VALUE INX;                                                     08492000
         INTEGER INX;                                                   08494000
         OPTION FORWARD,  UNCALLABLE;                                   08496000
                                                                        08498000
PROCEDURE PRINT'FILE'ERROR (FID);                                       08500000
         VALUE   FID;                                                   08502000
         INTEGER FID;                                                   08504000
         OPTION FORWARD,  UNCALLABLE;                                   08506000
                                                                        08508000
PROCEDURE READ'ALL'ATTIO;                                      <<LB.RS>>08508100
         OPT'FORWARD;                                          <<LB.RS>>08508400
                                                               <<LB.RS>>08508500
LOGICAL PROCEDURE READ'DISK (LDEV, ADDRESS, DST, BUFFER, LEN, IOB);     08510000
         VALUE   LDEV, ADDRESS, DST, BUFFER, LEN;  <<NAME IOB;>>        08512000
         INTEGER LDEV, DST, BUFFER, LEN;                                08514000
         DOUBLE  ADDRESS, IOB;                                          08516000
         OPTION FORWARD,  UNCALLABLE;                                   08518000
                                                                        08520000
LOGICAL PROCEDURE READ'LABEL (LDN, ADDRESS, GOTIT);                     08522000
         VALUE GOTIT, LDN, ADDRESS;                                     08524000
         LOGICAL GOTIT;    <<IF FALSE, WILL DO A GETSIR>>               08526000
         INTEGER LDN;                                                   08528000
         DOUBLE ADDRESS;                                                08530000
         OPTION FORWARD,  UNCALLABLE, PRIVILEGED;                       08532000
                                                                        08534000
LOGICAL PROCEDURE READ'TAPE (TDBUF, GBUF);                              08536000
         INTEGER ARRAY TDBUF, GBUF;                                     08538000
         OPT'FORWARD;                                                   08540000
                                                                        08542000
INTEGER PROCEDURE RECIP'STORE (ELEMENT, LEVEL, PARMS'OFFSET, SIR);      08544000
         VALUE   LEVEL, PARMS'OFFSET, SIR;                              08546000
         INTEGER LEVEL, PARMS'OFFSET;                                   08548000
         DOUBLE                       SIR;                              08550000
         INTEGER ARRAY ELEMENT;                                         08552000
         OPTION FORWARD,  UNCALLABLE, PRIVILEGED;                       08554000
                                                                        08556000
PROCEDURE RELEASE'SIRS (REL'FISIR, REL'DSIR);                           08558000
         VALUE REL'FISIR, REL'DSIR;                                     08560000
         LOGICAL REL'FISIR, REL'DSIR;                                   08562000
         OPTION FORWARD,  UNCALLABLE;                                   08564000
                                                                        08566000
LOGICAL PROCEDURE REOPEN'FILE (FILENO,                                  08568000
                               DESIG, FOPTIONS, AOPTIONS, RECSIZE);     08570000
         VALUE FOPTIONS, AOPTIONS, RECSIZE;                             08572000
         INTEGER FILENO, RECSIZE;                                       08574000
         LOGICAL FOPTIONS, AOPTIONS;                                    08576000
         INTEGER ARRAY DESIG;                                           08578000
         OPTION FORWARD,  UNCALLABLE;                                   08580000
                                                                        08582000
LOGICAL PROCEDURE RESTORE'A'FILE (TDBUF, GBUF,                          08584000
                                  JITDST                           );   08586000
         VALUE JITDST;                                                  08588000
         INTEGER JITDST;                                                08590000
         INTEGER ARRAY TDBUF, GBUF;                                     08592000
         OPT'FORWARD;                                                   08594000
                                                                        08596000
LOGICAL PROCEDURE SENDMESSAGE (MSGNO, SEND'NO'CRLF,            <<LB.RS>>08598000
                               TELL'TO'OP, STRING);            <<LB.RS>>08598100
         VALUE   MSGNO, SEND'NO'CRLF, TELL'TO'OP;                       08600000
         INTEGER MSGNO;                                                 08602000
         LOGICAL SEND'NO'CRLF, TELL'TO'OP;                              08604000
         BYTE ARRAY STRING;                                    <<LB.RS>>08605000
         OPTION FORWARD, VARIABLE, UNCALLABLE;                          08606000
                                                                        08608000
LOGICAL PROCEDURE STANDARD'TO'DISPLAY (PSTD, PDIS, ERROR, LEN);         08610000
         VALUE        PSTD, PDIS;                                       08612000
         BYTE POINTER PSTD, PDIS;                                       08614000
         INTEGER ERROR, LEN;                                            08616000
         OPTION FORWARD,  UNCALLABLE;                                   08618000
                                                                        08620000
LOGICAL PROCEDURE STANDARD'TO'3'DISPLAY (PSTD, F', G', A', ERROR);      08622000
         VALUE PSTD;                                                    08624000
         INTEGER ERROR;                                                 08626000
         BYTE POINTER PSTD;                                             08628000
         BYTE ARRAY F', G', A';                                         08630000
         OPTION FORWARD,  UNCALLABLE;                                   08632000
PROCEDURE START'A'READ (READLENGTH);                           <<LB.RS>>08632100
         VALUE READLENGTH;                                     <<LB.RS>>08632200
         INTEGER READLENGTH;                                   <<LB.RS>>08632300
         OPT'FORWARD;                                          <<LB.RS>>08632400
                                                                        08634000
LOGICAL PROCEDURE START'REEL (TDBUF, REEL'NUM);                         08636000
         VALUE   REEL'NUM;                                              08638000
         INTEGER REEL'NUM;                                              08640000
         INTEGER ARRAY TDBUF;                                           08642000
         OPTION FORWARD,  UNCALLABLE;                                   08644000
                                                                        08646000
INTEGER PROCEDURE STEPIT';                                              08648000
         OPTION FORWARD,  UNCALLABLE;                                   08650000
                                                                        08652000
PROCEDURE STRIP'SEQUENCE'NUMBER (BUF', LEN);                            08654000
         BYTE ARRAY BUF';                                               08656000
         INTEGER LEN;         <<NAME LEN;>>                             08658000
         OPTION FORWARD,  UNCALLABLE;                                   08660000
                                                                        08662000
LOGICAL PROCEDURE SUB'MATCH (PTEXT, ACTUALLEN, PATTERN, STARTPART);     08664000
         VALUE   ACTUALLEN, STARTPART, PTEXT;                           08666000
         INTEGER ACTUALLEN, STARTPART;                                  08668000
         BYTE POINTER                  PTEXT;                           08670000
         INTEGER ARRAY PATTERN;                                         08672000
         OPTION FORWARD,  UNCALLABLE;                                   08674000
                                                                        08676000
LOGICAL PROCEDURE TAPE'RECSIZE'WAS'SPECIFIED;                           08678000
         OPTION FORWARD,  UNCALLABLE;                                   08680000
                                                                        08682000
LOGICAL PROCEDURE TEST'SWITCH (N);                                      08684000
         VALUE   N;                                                     08686000
         INTEGER N;                                                     08688000
         OPTION FORWARD,  UNCALLABLE;                                   08690000
                                                                        08692000
INTEGER PROCEDURE THUNK'STORE (ELEMENT, LEVEL,                          08694000
                               SIR'NUMBER, SIR'INFO);                   08696000
         VALUE   LEVEL, SIR'NUMBER, SIR'INFO;                           08698000
         INTEGER LEVEL, SIR'NUMBER, SIR'INFO;                           08700000
         INTEGER ARRAY ELEMENT;                                         08702000
         OPTION FORWARD,  UNCALLABLE, PRIVILEGED;                       08704000
                                                                        08706000
PROCEDURE UNLOCK'FILES (WHAT'FILES, PVINFO);                            08708000
         VALUE   WHAT'FILES, PVINFO;                                    08710000
         DOUBLE  WHAT'FILES;                                            08712000
         LOGICAL PVINFO;                                                08714000
         OPTION FORWARD,  UNCALLABLE, PRIVILEGED;                       08716000
                                                               <<LB.RS>>08716100
INTEGER PROCEDURE WAIT'FOR'ALL'ATTIO;                          <<LB.RS>>08716200
         OPT'FORWARD;                                          <<LB.RS>>08716300
                                                                        08718000
                                                                        08730000
LOGICAL PROCEDURE WRITE'LABEL (LDN, ADDRESS, GOTIT);                    08732000
         VALUE GOTIT, LDN, ADDRESS;                                     08734000
         LOGICAL GOTIT;                                                 08736000
         INTEGER LDN;                                                   08738000
         DOUBLE ADDRESS;                                                08740000
         OPTION FORWARD,  UNCALLABLE, PRIVILEGED;                       08742000
                                                                        08744000
LOGICAL PROCEDURE WRITE'TAPE (WORDC, BUFFER, IGNORE'EOT, TDBUF,         08746000
                              LAST'WRITE'OF'FILE);                      08748000
         VALUE   WORDC, IGNORE'EOT, LAST'WRITE'OF'FILE;                 08750000
         INTEGER WORDC;                                                 08752000
         LOGICAL        IGNORE'EOT, LAST'WRITE'OF'FILE;                 08754000
         INTEGER ARRAY BUFFER, TDBUF;                                   08756000
         OPTION FORWARD,  UNCALLABLE, PRIVILEGED;                       08758000
                                                                        08760000
LOGICAL PROCEDURE WRITE'TAPE'MARK (ERRNUM);                             08762000
         INTEGER ERRNUM;                                                08764000
         OPTION FORWARD,  UNCALLABLE, PRIVILEGED;                       08766000
                                                                        08768000
$PAGE                                                                   08770000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        08772000
LOGICAL PROCEDURE AFFIRM (YES, DEF);                                    08774000
         VALUE DEF;                                                     08776000
         LOGICAL YES, DEF;                                              08778000
         OPTION FORWARD,  UNCALLABLE;                                   08780000
                                                                        08782000
PROCEDURE AHEM;                                                         08784000
         OPTION FORWARD,  UNCALLABLE;                                   08786000
                                                                        08788000
PROCEDURE DEBUG'SCANNER';                                               08790000
         OPTION FORWARD,  UNCALLABLE;                                   08792000
                                                                        08794000
PROCEDURE REPORT'MISMATCH (ELEMENT', PAT);                              08796000
         BYTE ARRAY ELEMENT';                                           08798000
         INTEGER ARRAY PAT;                                             08800000
         OPTION FORWARD,  UNCALLABLE;                                   08802000
                                                                        08804000
PROCEDURE SAY1 (CHAR); VALUE CHAR; LOGICAL CHAR;                        08806000
         OPTION FORWARD,  UNCALLABLE;                                   08808000
                                                                        08810000
PROCEDURE SAYBINARY (N); VALUE N; LOGICAL N;                            08812000
         OPTION FORWARD,  UNCALLABLE;                                   08814000
                                                                        08816000
PROCEDURE SAYDNUM (N); VALUE N; DOUBLE N;                               08818000
         OPTION FORWARD,  UNCALLABLE;                                   08820000
                                                                        08822000
PROCEDURE SAYDOCTAL (DN); VALUE DN; DOUBLE DN;                          08824000
         OPTION FORWARD,  UNCALLABLE;                                   08826000
                                                                        08828000
PROCEDURE SAYNUM (N); VALUE N; INTEGER N;                               08830000
         OPTION FORWARD,  UNCALLABLE;                                   08832000
                                                                        08834000
PROCEDURE SAYOCTAL (N); VALUE N; LOGICAL N;                             08836000
         OPTION FORWARD,  UNCALLABLE;                                   08838000
                                                                        08840000
PROCEDURE SAY'PATTERN (PAT);                                            08842000
         INTEGER ARRAY PAT;                                             08844000
         OPTION FORWARD,  UNCALLABLE;                                   08846000
                                                                        08848000
PROCEDURE SAY'STANDARD (PSTD); VALUE PSTD; BYTE POINTER PSTD;           08850000
         OPTION FORWARD,  UNCALLABLE;                                   08852000
                                                                        08854000
LOGICAL PROCEDURE SEND';                                                08856000
         OPTION FORWARD,  UNCALLABLE;                                   08858000
                                                                        08860000
LOGICAL PROCEDURE SENDSTOP;                                             08862000
         OPTION FORWARD,  UNCALLABLE;                                   08864000
                                                                        08866000
$IF                           <<DEBUGGING CODE>>                        08868000
                                                                        08870000
$PAGE ";MAIN=  SEND/AHEM --- DEBUGGING OUTPUT ROUTINES"                 10000000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        10002000
                                                                        10004000
<<------------------------------------------------------------          10006000
                                                                        10008000
The following is a collection of procedures compiled only               10010000
when debugging is enabled.  These procedures facilitate                 10012000
input, output, and question asking.  Procedures:                        10014000
                                                                        10016000
   AFFIRM           gets a YES/NO answer from the user                  10018000
   AHEM             clears output buffer (OUTPUTBUFFER', POUT)          10020000
   SAY1             "SAYs" one character to output stream (POUT)        10022000
   SAYBINARY        SAYs a number in binary (16 characters long)        10024000
   SAYDNUM          SAYs a signed double integer                        10026000
   SAYDOCTAL        SAYs an octal number (11 characters long)           10028000
   SAYNUM           SAYs a signed integer (["-"], 1...5 digits)         10030000
   SAYOCTAL         SAYs an octal number (6 characters)                 10032000
   SAY'PATTERN      decodes and SAYs a pattern                          10034000
   SAY'STANDARD     decodes and SAYs a standard form title              10036000
   SEND'            writes output text to STDLIST.                      10038000
   SENDSTOP         like SEND, but with a %320 carriage control         10040000
   REPORT'MISMATCH  reports a mis-match between two patterns.           10042000
   TEST'SWITCH      tests sense switch ... from 0 to 15.                10044000
   DEBUG'SCANNER'   prints out scanner status when called               10046000
                                                                        10048000
------------------------------------------------------------->>         10050000
$PAGE                                                                   10052000
$CONTROL SEGMENT=MAIN                                                   10054000
<<***************************************************************>>     10056000
LOGICAL PROCEDURE AFFIRM (YES, DEF);                                    10058000
         VALUE           DEF;                                           10060000
         LOGICAL YES,    DEF;                                           10062000
   BEGIN                                                                10064000
                                                                        10066000
   LOGICAL ARRAY                                                        10068000
      BUF         (0:40),                                               10070000
      SCRATCH     (0:4);                                                10072000
                                                                        10074000
   INTEGER                                                              10076000
      ALEN        := 0,                                                 10078000
      I           := 0,                                                 10080000
      LEN         := 0;                                                 10082000
                                                                        10084000
   BYTE ARRAY                                                           10086000
      BUF'        (*) = BUF (0),                                        10088000
      SCRATCH'    (*) = SCRATCH (0);                                    10090000
                                                                        10092000
   BYTE ARRAY                                                           10094000
      ANSWERS' (*) = PB :=                                              10096000
         <<length, value, text, language...>>                           10098000
         1, 1, "Y",              <<english>>                            10100000
         2, 1, "YE",             <<english>>                            10102000
         3, 1, "YES",            <<english>>                            10104000
         1, 0, "N",              <<english NO>>                         10106000
         2, 0, "NO",             <<english NO>>                         10108000
         4, 0, "NEIN",           <<german NO>>                          10110000
         2, 1, "OK",             <<english slang>>                      10112000
         2, 1, "SI",             <<spanish>>                            10114000
         2, 1, "JA",             <<german>>                             10116000
         3, 1, "OUI",            <<french>>                             10118000
         0;                                                             10120000
                                                                        10122000
                                                                        10124000
   AFFIRM:=YES:=DEF;                                                    10126000
                                                                        10128000
         <<read input...>>                                              10130000
                                                                        10132000
   BUF'(LEN:=READX(BUF, -80)):=0;                                       10134000
                                                                        10136000
         <<find first non-blank...>>                                    10138000
                                                                        10140000
   WHILE BUF' = " " AND LEN > 1 DO                                      10142000
      BEGIN                                                             10144000
      MOVE BUF'(0):=BUF'(1), (LEN-1);                                   10146000
      BUF'(LEN:=LEN-1):=0;                                              10148000
      END;                                                              10150000
                                                                        10152000
         <<find length of token...>>                                    10154000
                                                                        10156000
   MOVE BUF':=BUF' WHILE ANS;     <<upshift>>                           10158000
   SCAN BUF' UNTIL " ", 1;                                              10160000
   ALEN:=TOS-LOGICAL(@BUF');  <<length of token>>                       10162000
                                                                        10164000
   IF LEN <= 0 THEN                                                     10166000
      RETURN;                                                           10168000
                                                                        10170000
                  <<look up answer in ANSWERS' array...>>               10172000
                                                                        10174000
   LEN:=ALEN;     <<LEN is now the length of the token found>>          10176000
                                                                        10178000
   I:=0;                                                                10180000
   MOVE SCRATCH':=ANSWERS'(0),(1);                                      10182000
   ALEN:=SCRATCH'(0);                                                   10184000
   MOVE SCRATCH'(0):=ANSWERS'(0), (ALEN+2);                             10186000
                                                                        10188000
   WHILE ALEN <> 0 DO                                                   10190000
      BEGIN                                                             10192000
      IF LEN = ALEN THEN     <<do lengths match?>>                      10194000
         BEGIN                                                          10196000
         IF BUF' = SCRATCH'(2), (ALEN) THEN                             10198000
            BEGIN                                                       10200000
            AFFIRM:=YES:= (SCRATCH'(1) = 1);                            10202000
            RETURN;                                                     10204000
            END;                                                        10206000
         END;                                                           10208000
      I:=I+ALEN+2;                                                      10210000
      MOVE SCRATCH'(0):=ANSWERS'(I),(1);                                10212000
      ALEN:=SCRATCH'(0);                                                10214000
      MOVE SCRATCH'(0):=ANSWERS'(I),(ALEN+2);                           10216000
      END;                                                              10218000
                                                                        10220000
   END <<AFFIRM PROC>>;                                                 10222000
<<***************************************************************>>     10224000
PROCEDURE AHEM;                                                         10226000
         OPTION UNCALLABLE;                                             10228000
                                                                        10230000
   BEGIN                                                                10232000
                                                                        10234000
   FILL (OUTPUTBUFFER, 66, "  ");                                       10236000
                                                                        10238000
   @POUT:=@OUTPUTBUFFER';                                               10240000
                                                                        10242000
   END <<AHEM PROC>>;                                                   10244000
<<**************************************************************>>      10246000
PROCEDURE SAY1 (CHAR); VALUE CHAR; LOGICAL CHAR;                        10248000
         OPTION UNCALLABLE;                                             10250000
                                                                        10252000
   BEGIN                                                                10254000
                                                                        10256000
   IF CHAR.(8:8) = 0 THEN                                               10258000
      CHAR.(8:8):=CHAR.(0:8);                                           10260000
                                                                        10262000
   IF CHAR.(8:8) = " " THEN                                             10264000
      IF CHAR.(0:8) <> 0 THEN                                           10266000
         CHAR.(8:8):=CHAR.(0:8);                                        10268000
                                                                        10270000
   POUT:=CHAR;                                                          10272000
                                                                        10274000
   @POUT:=@POUT(1);                                                     10276000
                                                                        10278000
   END <<SAY1 PROC>>;                                                   10280000
<<***************************************************************>>     10282000
PROCEDURE SAYBINARY (N); VALUE N; LOGICAL N;                            10284000
         OPTION UNCALLABLE;                                             10286000
                                                                        10288000
   BEGIN                                                                10290000
                                                                        10292000
   INTEGER                                                              10294000
      I;                                                                10296000
                                                                        10298000
   FOR I:=15 STEP -1 UNTIL 0 DO                                         10300000
      BEGIN                                                             10302000
      IF N.(0:1) = 0 THEN                                               10304000
         SAY1 ("0")                                                     10306000
      ELSE                                                              10308000
         SAY1("1");                                                     10310000
      N:=N & CSL (1);                                                   10312000
      END;                                                              10314000
                                                                        10316000
   END <<SAYBINARY PROC>>;                                              10318000
<<***************************************************************>>     10320000
PROCEDURE SAYDNUM (N); VALUE N; DOUBLE N;                               10322000
         OPTION UNCALLABLE;                                             10324000
                                                                        10326000
   BEGIN                                                                10328000
                                                                        10330000
   @POUT:=@POUT(DASCII (N, 10, POUT));                                  10332000
                                                                        10334000
   END <<SAYDNUM PROC>>;                                                10336000
<<***************************************************************>>     10338000
PROCEDURE SAYDOCTAL (DN); VALUE DN; DOUBLE DN;                          10340000
         OPTION UNCALLABLE;                                             10342000
                                                                        10344000
   BEGIN                                                                10346000
                                                                        10348000
   DASCII(DN, 8, POUT);       <<octal DASCII always takes 11 spaces>>   10350000
                                                                        10352000
   @POUT:=@POUT(11);                                                    10354000
                                                                        10356000
   END <<SAYOCTAL PROC>>;                                               10358000
<<***************************************************************>>     10360000
PROCEDURE SAYNUM (N); VALUE N; INTEGER N;                               10362000
         OPTION UNCALLABLE;                                             10364000
                                                                        10366000
   BEGIN                                                                10368000
                                                                        10370000
   IF N < 0 THEN                                                        10372000
      SAY "-" ENDSAY;                                                   10374000
                                                                        10376000
   @POUT:=@POUT(ASCII(\N\,10,POUT));                                    10378000
                                                                        10380000
   END <<SAYNUM PROC>>;                                                 10382000
<<***************************************************************>>     10384000
PROCEDURE SAYOCTAL (N); VALUE N; LOGICAL N;                             10386000
         OPTION UNCALLABLE;                                             10388000
                                                                        10390000
   BEGIN                                                                10392000
                                                                        10394000
   ASCII(N, 8, POUT);         <<octal ASCII always takes 6 spaces>>     10396000
                                                                        10398000
   @POUT:=@POUT(6);                                                     10400000
                                                                        10402000
   END <<SAYOCTAL PROC>>;                                               10404000
<<***************************************************************>>     10406000
PROCEDURE SAY'PATTERN (PAT);                                            10408000
         INTEGER ARRAY PAT;                                             10410000
                                                                        10412000
   BEGIN                                                                10414000
                                                                        10416000
   INTEGER                                                              10418000
      CHAR        := 0,                                                 10420000
      INX         := 1,                                                 10422000
      LEN         := 0,                                                 10424000
      PARTS       := 0,                                                 10426000
      WORD        := 0;                                                 10428000
                                                                        10430000
   PARTS:=PAT(0);                                                       10432000
                                                                        10434000
   WHILE (PARTS:=PARTS-1) >= 0 DO                                       10436000
      BEGIN                                                             10438000
                                                                        10440000
      WORD:=PAT(INX);                                                   10442000
      LEN:=WORD.PATLENf;                                                10444000
      CHAR:=WORD.PATCHARf;                                              10446000
                                                                        10448000
      IF WORD.PATTYPEf = ANYCHARACTERSp THEN                            10450000
         LEN:=1;                                                        10452000
                                                                        10454000
      WHILE (LEN:=LEN-1) >= 0 DO                                        10456000
         SAY1 (CHAR);                                                   10458000
                                                                        10460000
      INX:=INX+1;                                                       10462000
                                                                        10464000
      END                                                               10466000
                                                                        10468000
   END <<SAY'PATTERN PROC>>;                                            10470000
<<***************************************************************>>     10472000
PROCEDURE SAY'STANDARD (PSTD); VALUE PSTD; BYTE POINTER PSTD;           10474000
                                                                        10476000
   BEGIN                                                                10478000
                                                                        10480000
   INTEGER                                                              10482000
      ERROR,                                                            10484000
      LEN;                                                              10486000
                                                                        10488000
   IF STANDARD'TO'DISPLAY (PSTD, POUT, ERROR, LEN) = FAILED THEN        10490000
      BEGIN                                                             10492000
      SAY "***STD ERR " ENDSAY;                                         10494000
      SAYNUM(ERROR);                                                    10496000
      SAY " AT " ENDSAY;                                                10498000
      SAYNUM(LEN);                                                      10500000
      END                                                               10502000
   ELSE                                                                 10504000
      @POUT:=@POUT(LEN);                                                10506000
                                                                        10508000
   END <<SAY'STANDARD PROC>>;                                           10510000
<<***************************************************************>>     10512000
LOGICAL PROCEDURE SEND';                                                10514000
         OPTION UNCALLABLE;                                             10516000
                                                                        10518000
   BEGIN                                                                10520000
                                                                        10522000
   INTEGER                                                              10524000
      I           := 0,                                                 10526000
      J           := 0;                                                 10528000
                                                                        10530000
   <<----------------->>                                                10532000
   <<------------------------->>                                        10534000
                                                                        10536000
   SEND':=FALSE;                                                        10538000
                                                                        10540000
   PRINT (OUTPUTBUFFER, -POUT'OFFSET, 0);                               10542000
                                                                        10544000
   IF <> THEN                                                           10546000
      SEND':=TRUE;                                                      10548000
                                                                        10550000
   AHEM;                                                                10552000
                                                                        10554000
   IF DEBUGGING THEN                                                    10556000
      IF DEBUGPAUSE > 0.0 AND DEBUG'SEND'END THEN                       10558000
         PAUSE (DEBUGPAUSE);                                            10560000
                                                                        10562000
   END <<SEND' PROC>>;                                                  10564000
<<***************************************************************>>     10566000
LOGICAL PROCEDURE SENDSTOP;                                             10568000
         OPTION UNCALLABLE;                                             10570000
                                                                        10572000
   BEGIN                                                                10574000
                                                                        10576000
   SENDSTOP:=FALSE;                                                     10578000
                                                                        10580000
   PRINT (OUTPUTBUFFER, -POUT'OFFSET, %320);                            10582000
                                                                        10584000
   IF <> THEN                                                           10586000
      SENDSTOP:=TRUE;                                                   10588000
                                                                        10590000
   AHEM;                                                                10592000
                                                                        10594000
   END <<SENDSTOP PROC>>;                                               10596000
<<****************************************************************>>    10598000
PROCEDURE REPORT'MISMATCH (ELEMENT', PAT);                              10600000
         BYTE ARRAY ELEMENT';                                           10602000
         INTEGER ARRAY PAT;                                             10604000
                                                                        10606000
   BEGIN                                                                10608000
                                                                        10610000
   SAY "MATCH FOR: " ENDSAY;                                            10612000
   SAY ELEMENT',(8) ENDSAY;                                             10614000
   SAY " vs " ENDSAY;                                                   10616000
   SAY'PATTERN (PAT);                                                   10618000
                                                                        10620000
   SEND;                                                                10622000
                                                                        10624000
   END <<REPORT'MISMATCH PROC>>;                                        10626000
$PAGE ";MAIN=  TEST'SWITCH --- DEBUGGING ROUTINE"                       10628000
$CONTROL SEGMENT=MAIN                                                   10630000
<<**************************************************************>>      10632000
LOGICAL PROCEDURE TEST'SWITCH (N);                                      10634000
         VALUE   N;                                                     10636000
         INTEGER N;                                                     10638000
   BEGIN                                                                10640000
   LOGICAL                                                              10642000
      SWITCHES;                                                         10644000
                                                                        10646000
   ASSEMBLE (RSW);                                                      10648000
   SWITCHES:=TOS;                                                       10650000
   IF SWITCHES.(8:1) = 1 THEN DEBUG;                                    10652000
                                                                        10654000
   DO                                                                   10656000
      SWITCHES:=SWITCHES & CSL(1)                                       10658000
   UNTIL                                                                10660000
      (N:=N-1) < 0;                                                     10662000
                                                                        10664000
   TEST'SWITCH:=SWITCHES;                                               10666000
                                                                        10668000
   END <<TEST'SWITCH PROC>>;                                            10670000
$PAGE ";MAIN=  DEBUG'SCANNER'"                                          10672000
$CONTROL SEGMENT=MAIN                                                   10674000
<<**********************************************************>>          10676000
PROCEDURE DEBUG'SCANNER';                                               10678000
         OPTION           UNCALLABLE;                                   10680000
   BEGIN                                                                10682000
                                                                        10684000
                                                                        10686000
   SAY " ITEMP= '" ENDSAY;                                              10688000
   SAY ITEMP,(ILEN) ENDSAY;                                             10690000
   SAY "', ILEN=" ENDSAY;                                               10692000
   SAYNUM (ILEN);                                                       10694000
                                                                        10696000
   SAY ", ILEFT=" ENDSAY;                                               10698000
   SAYNUM (ILEFT);                                                      10700000
                                                                        10702000
   SAY ", ICLASS=" ENDSAY;                                              10704000
   IF ICLASS > 0 THEN                                                   10706000
      SAYNUM (ICLASS)                                                   10708000
   ELSE                                                                 10710000
      CASE \ICLASS\ OF                                                  10712000
         BEGIN                                                          10714000
         SAY1 ("0");                                                    10716000
         SAY "endline" ENDSAY;                                          10718000
         SAY "token" ENDSAY;                                            10720000
         SAY "number" ENDSAY;                                           10722000
         SAY "special" ENDSAY;                                          10724000
         SAY "string" ENDSAY;                                           10726000
         SAY "dnumber" ENDSAY;                                          10728000
         SAY "unknown" ENDSAY;                                          10730000
         SAY "7" ENDSAY                                                 10732000
         END;                                                           10734000
                                                                        10736000
   SAY ", SUBCLASS = " ENDSAY;                                          10738000
                                                                        10740000
   IF ICLASS IS TOKENv THEN                                             10742000
      IF SUBCLASS <> 0 THEN                                             10744000
         IF SUBCLASS IS DNUMBERv THEN                                   10746000
            SAY " BIG DOUBLE" ENDSAY                                    10748000
         ELSE IF SUBCLASS IS NUMBERv THEN                               10750000
            SAY " BIG SINGLE" ENDSAY                                    10752000
         ELSE                                                           10754000
            SAYNUM (SUBCLASS)                                           10756000
      ELSE                                                              10758000
         SAY "normal" ENDSAY                                            10760000
   ELSE IF ICLASS IS DNUMBERv THEN                                      10762000
      BEGIN                                                             10764000
      SAYDNUM (SUBCLASS'D);                                             10766000
      SAY1 ("D");                                                       10768000
      END                                                               10770000
   ELSE                                                                 10772000
      SAYNUM (SUBCLASS);                                                10774000
                                                                        10776000
   SEND;                                                                10778000
                                                                        10780000
   END <<DEBUG'SCANNER' PROC>>;                                         10782000
$IF                           <<DEBUGGING CODE>>                        10784000
$PAGE ";MAIN=  DO'MPE'COMMAND --- HANDLES ':' INPUT"                    10786000
$CONTROL SEGMENT=MAIN                                                   10788000
<<************************************************************>>        10790000
LOGICAL PROCEDURE DO'MPE'COMMAND (BUF');                                10792000
         BYTE ARRAY BUF';                                               10794000
                                                                        10796000
      <<--------------------------------------------------------        10798000
        Does the MPE command pointed to by BUF'.  If a colon            10800000
        starts the image, it is stripped off.  If the command           10802000
        fails, an error message is printed,                             10804000
        and a FAILED is returned.  If the command worked ok, a          10806000
        GOOD is returned.                                               10808000
        ------------------------------------------------------>>        10810000
   BEGIN                                                                10812000
                                                                        10814000
   INTEGER                                                              10816000
      I,                                                                10818000
      J,                                                                10820000
      LEN;                                                              10822000
                                                                        10824000
   INTRINSIC                                                            10826000
      COMMAND;                                                          10828000
                                                                        10830000
   SCAN BUF' UNTIL %15, 1;                                              10832000
   LEN:=TOS-LOGICAL(@BUF');                                             10834000
                                                                        10836000
   WHILE (BUF'(0) = ":") OR (BUF'(0) = " ") DO                          10838000
      BEGIN                                                             10840000
      MOVE BUF'(0):=BUF'(1), (LEN);                                     10842000
      LEN:=LEN-1;                                                       10844000
      END;                                                              10846000
                                                                        10848000
   DO'MPE'COMMAND:=GOOD;      <<assume that it will work ok!>>          10850000
                                                                        10852000
   MOVE BUF':=BUF' WHILE ANS;                                           10854000
                                                                        10856000
   COMMAND (BUF', I, J);                                                10858000
                                                                        10860000
   IF I<>0 THEN                                                <<04101>>10862000
      BEGIN                                                             10864000
      GENMSGU (2, \I\);         <<CI error message set>>       <<04983>>10866000
      IF J > 20 THEN                                                    10868000
         GENMSGU (8, J);      <<file sys error set>>                    10870000
      END;                                                              10872000
                                                                        10874000
   END <<DO'MPE'COMMAND PROC>>;                                         10876000
$PAGE ";MAIN=  STORE'RESTORE'DRIVER"                                    10878000
$CONTROL SEGMENT=MAIN                                                   10880000
<<***********************************************************>>         10882000
PROCEDURE STORE'RESTORE'DRIVER;                                         10884000
                                                                        10886000
   << This procedure is the program-mode driver for STORE               10888000
      and RESTORE.  It is called when this program is run               10890000
      WITHOUT an INFO parameter.  It merely loops, prompting            10892000
      the user for input (if interactive), and calls the                10894000
      procedure CXSTORE'RESTORE with the input (unless this             10896000
      was compiled with debugging enabled, in which case it             10898000
      first checks to see if the input was a debugging command).        10900000
                                                                        10902000
      In batch mode, a double line of "#####..." is printed             10904000
      after every STORE/RESTORE command.                                10906000
                                                                        10908000
      In either mode, the input text is examined for a                  10910000
      sequence number at the right hand side.  If the last              10912000
      8 characters are digits, they are stripped off.                   10914000
                                                                        10916000
      In either mode, the input is examined and any occurances          10918000
      of this procedure's prompt ("<--") are stipped off.    >>         10920000
                                                                        10922000
   BEGIN                                                                10924000
                                                                        10926000
   INTEGER ARRAY                                                        10928000
      BUF         (0:140);                                              10930000
                                                                        10932000
   INTEGER                                                              10934000
      LEN,                                                              10936000
      STDLISTNUM;                                                       10938000
                                                                        10940000
   LOGICAL                                                              10942000
      MY'MODE     := FALSE,                                             10944000
      TF          := FALSE;                                             10946000
                                                                        10948000
   BYTE ARRAY                                                           10950000
      BUF'        (*) = BUF (0);                                        10952000
                                                                        10954000
   BYTE                                                                 10956000
      CHAR;                                                             10958000
                                                                        10960000
   <<-------------------->>                                             10962000
   SUBROUTINE CHECK'OPTIONS;                                            10964000
                                                                        10966000
      BEGIN                                                             10968000
                                                                        10970000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        10972000
      BUF'(LEN):=0;                                                     10974000
      MOVE BUF':=BUF' WHILE ANS;                                        10976000
                                                                        10978000
      IF LEN > 1 THEN                                                   10980000
         MOVE BUF'(1):=BUF'(1) WHILE ANS;                               10982000
      IF LEN > 2 THEN                                                   10984000
         MOVE BUF'(2):=BUF'(2) WHILE ANS;                               10986000
                                                                        10988000
      IF BUF' = "\DEBUG" THEN                                           10990000
         BEGIN                                                          10992000
         DEBUG;                                                         10994000
         RETURN;                                                        10996000
         END;                                                           10998000
                                                                        11000000
      IF BUF'(1) = "+" THEN                                             11002000
         TF:=TRUE                                                       11004000
                                                                        11006000
      ELSE IF BUF'(1) = "-" THEN                                        11008000
         TF:=FALSE                                                      11010000
                                                                        11012000
      ELSE                                                              11014000
         BEGIN                                                          11016000
         SAY "Expected a '+' or a '-' after the '\', found: '" ENDSAY;  11018000
         SAY BUF'(1),(1) ENDSAY;                                        11020000
         SAY "'" ENDSAY;                                                11022000
         SEND;                                                          11024000
         SAY "Or....expected \DEBUG" ENDSAY;                            11026000
         SEND;                                                          11028000
         RETURN;                                                        11030000
         END;                                                           11032000
                                                                        11034000
      CHAR:=BUF'(2);                                                    11036000
                                                                        11038000
      IF CHAR="D" THEN                                                  11040000
         DEBUGGING:=TF                                                  11042000
                                                                        11044000
      ELSE IF CHAR="P" THEN                                             11046000
         IF TF THEN                                                     11048000
            DEBUGPAUSE := 0.4                                           11050000
         ELSE                                                           11052000
            DEBUGPAUSE := 0.0                                           11054000
                                                                        11056000
      ELSE                                                              11058000
         BEGIN                                                          11060000
         SAY "UNKNOWN OPTION: " ENDSAY;                                 11062000
         SAY BUF'(0),(3) ENDSAY;                                        11064000
         SAY ", EXPECTED: D, P" ENDSAY;                                 11066000
         SEND;                                                          11068000
         SAY "   D = DEBUGGING" ENDSAY; SEND;                           11070000
         SAY "   P = PAUSE after DEBUGGING FWRITEs" ENDSAY; SEND;       11072000
         SEND;                                                          11074000
         END;                                                           11076000
$IF                           <<DEBUGGING CODE>>                        11078000
                                                                        11080000
      END <<CHECK'OPTIONS SUB>>;                                        11082000
   <<----------------------->>                                          11084000
                                                                        11086000
   USING'DRIVER := TRUE;                                                11088000
                                                                        11090000
   DISABLE'ARITHMETIC'TRAPS;                                            11092000
                                                                        11094000
   IF STORE'CATALOG <> 0 THEN                                           11096000
      GENMESSAGE (STORE'CATALOG, SR'MESSAGE'SET, SR'STORE'VERSION)      11098000
   ELSE                                                                 11100000
      GENMSGU (SR'MESSAGE'SET, SR'STORE'VERSION);                       11102000
                                                                        11104000
   ENABLE'ARITHMETIC'TRAPS;                                             11106000
                                                                        11108000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        11110000
   AHEM;                                                                11112000
$IF                           <<DEBUGGING CODE>>                        11114000
                                                                        11116000
   WHO (MY'MODE);                                                       11118000
                                                                        11120000
   IF MY'MODE.INTERACTIVEbit THEN                                       11122000
      STDLISTNUM:=0           <<SYSLIST not opened yet>>                11124000
   ELSE                                                                 11126000
      STDLISTNUM:=STDLIST'NUM;      << "2" >>                           11128000
                                                                        11130000
   WHILE TRUE DO                                                        11132000
      BEGIN                                                             11134000
                                                                        11136000
      IF MY'MODE.INTERACTIVEbit THEN                                    11138000
         BEGIN                                                          11140000
         MOVE BUF':="<--";                                              11142000
         PRINT (BUF, -3, %320);                                         11144000
         END;                                                           11146000
                                                                        11148000
      FILL' (BUF', 257, %15);                                           11150000
                                                                        11152000
      LEN:=READX (BUF, -280);                                           11154000
                                                                        11156000
      IF <> THEN                                                        11158000
         RETURN;              <<exit procedure>>                        11160000
                                                                        11162000
            <<"take off" sequence number...>>                           11164000
                                                                        11166000
      STRIP'SEQUENCE'NUMBER (BUF', LEN);                                11168000
                                                                        11170000
            <<delete the prompt (if any) from start...>>                11172000
                                                                        11174000
      WHILE (BUF' = "<--") DO          <<the prompt!>>                  11176000
         BEGIN                         <<strip the prompt...>>          11178000
         MOVE BUF'(0):=BUF'(3),(LEN-3);                                 11180000
         LEN:=LEN-3;                                                    11182000
         END;                                                           11184000
                                                                        11186000
            <<delete any leading blanks...>>                            11188000
                                                                        11190000
      WHILE (BUF' = " ") AND LEN > 0 DO                                 11192000
         BEGIN                                                          11194000
         MOVE BUF'(0):=BUF'(1),(LEN-1);                                 11196000
         LEN:=LEN-1;                                                    11198000
         END;                                                           11200000
                                                                        11202000
      IF NOT MY'MODE.DUPLICATIVEbit THEN                                11204000
         PRINT (BUF, -LEN, 0);                                          11206000
                                                                        11208000
      BUF'(LEN):=%15;                                                   11210000
                                                                        11212000
      IF LEN > 0 THEN                                                   11214000
         BEGIN                                                          11216000
                                                                        11218000
         MOVE BUF':=BUF' WHILE ANS;                                     11220000
                                                                        11222000
         IF BUF' = "EXIT" THEN                                          11224000
            RETURN            <<exit procedure>>                        11226000
                                                                        11228000
         ELSE IF BUF' = ":" THEN                                        11230000
            DO'MPE'COMMAND (BUF')                                       11232000
                                                                        11234000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        11236000
         ELSE IF BUF'(0) = "\" THEN                                     11238000
            CHECK'OPTIONS                                               11240000
$IF                           <<DEBUGGING CODE>>                        11242000
                                                                        11244000
         ELSE                                                           11246000
            BEGIN                                                       11248000
                                                                        11250000
            CXSTORE'RESTORE (BUF', STDLISTNUM, FALSE);                  11252000
                                                                        11254000
            IF (NOT MY'MODE.INTERACTIVEbit) THEN                        11256000
               BEGIN                                                    11258000
               FILL' (BUF', 72, "#");                                   11260000
               PRINT (BUF, -72, 0);                                     11262000
               PRINT (BUF, -72, 0);                                     11264000
               PRINT (BUF, 0, 0);                                       11266000
               END;                                                     11268000
            END;                                                        11270000
         END;                                                           11272000
      END;                                                              11274000
                                                                        11276000
   END <<STORE'RESTORE'DRIVER PROC>>;                                   11278000
$PAGE ";MAIN=  OUTER BLOCK"                                             11280000
$CONTROL SEGMENT=MAIN                                                   11282000
<<***********************************************************>>         11284000
PROCEDURE OUTER'BLOCK (PARM, INFO'LENGTH, INFO'ADDRESS);                11286000
         VALUE   PARM, INFO'LENGTH, INFO'ADDRESS;                       11288000
         INTEGER PARM, INFO'LENGTH, INFO'ADDRESS;                       11290000
                                                                        11292000
   << This procedure decides whether the program was run                11294000
      with or without an INFO paramter.  If it has an                   11296000
      INFO parameter, STORE/RESTORE is called with that                 11298000
      string and the program then terminates.  Otherwise,               11300000
      it calls STORE'RESTORE'DRIVER to allow multiple                   11302000
      commands from the user.                                           11304000
                                                                        11306000
      The first action taken by this procedure is to open               11308000
      the message catalog.  This will disappear when the                11310000
      messages for STORE/RESTORE are put back into the                  11312000
      system message catalog.                           >>              11314000
                                                                        11316000
   BEGIN                                                                11318000
                                                                        11320000
   INTEGER ARRAY                                                        11322000
      BUF         (0: 170 + 10);                                        11324000
                                                                        11326000
   INTEGER                                                              11328000
      I1;                                                               11330000
                                                                        11332000
   LOGICAL                                                              11334000
      WANTS       := FALSE;   <<"want" flag bits for STORE/RESTORE>>    11336000
                                                                        11338000
   BYTE ARRAY                                                           11340000
      BUF'        (*) = BUF (0);                                        11342000
                                                                        11344000
   BYTE POINTER                                                         11346000
      PTR;                                                              11348000
                                                                        11350000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        11352000
   IF PARM < 0 THEN                                                     11354000
      DEBUGGING:=TRUE;                                                  11356000
$IF                           <<DEBUGGING CODE>>                        11358000
                                                                        11360000
   PARM:=\PARM\;                                                        11362000
                                                                        11364000
   IF PARM = PARM'STORE OR PARM = PARM'RESTORE THEN            <<LB.RS>>11366000
      WANT'JCW:=TRUE                                                    11368000
   ELSE IF PARM <> 0 THEN                                               11370000
      WANT'MAIL:=TRUE;                                                  11372000
                                                                        11374000
$PAGE                                                                   11376000
                                                                        11378000
         <<Debugging...open a separate catalog file...>>                11380000
                                                                        11382000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        11384000
                                                                        11386000
   AHEM;                                                                11388000
                                                                        11390000
   MOVE BUF':=STORE'CATALOG'TITLE;                                      11392000
   STORE'CATALOG:=FOPEN (BUF', 5, %420);                                11394000
   IF STORE'CATALOG <= 0 THEN                                           11396000
      BEGIN                                                             11398000
      MOVE BUF':=STORE2'CATALOG'TITLE;                                  11400000
      STORE'CATALOG:=FOPEN (BUF', 5, %420);                             11402000
      END;                                                              11404000
                                                                        11406000
                                                                        11408000
   IF STORE'CATALOG <= 0 THEN                                           11410000
      BEGIN                                                             11412000
      SAY "Failed to open: " ENDSAY;                                    11414000
      SAY STORE'CATALOG'TITLE ENDSAY;                                   11416000
      SEND;                                                             11418000
      PRINTFILEINFO (STORE'CATALOG);                                    11420000
      STORE'CATALOG:=0;                                                 11422000
      END                                                               11424000
   ELSE                                                                 11426000
      BEGIN                                                             11428000
                                                                        11430000
            <<see if file is MR & NOBUF...>>                            11432000
                                                                        11434000
      I1:=0;                                                            11436000
                                                                        11438000
      FGETINFO (STORE'CATALOG, , , I1 <<aoptions>>);                    11440000
                                                                        11442000
      IF I1.(07:01) = 0 OR I1.(11:01) = 0 THEN                          11444000
         BEGIN    <<either not NOBUF or not MR>>                        11446000
         PRINTFILEINFO (STORE'CATALOG);                                 11448000
         FCLOSE (STORE'CATALOG, 0, 0);                                  11450000
         STORE'CATALOG:=0;                                              11452000
         SAY "Bad catalog for STORE/RESTORE: " ENDSAY;                  11454000
         SAY STORE'CATALOG'TITLE ENDSAY;                                11456000
         SEND;                                                          11458000
         SAY "Must be opened MR and NOBUF" ENDSAY;                      11460000
         SEND;                                                          11462000
         END;                                                           11464000
      END;                                                              11466000
                                                                        11468000
   IF DEBUGGING THEN                                                    11470000
      BEGIN                                                             11472000
      SAY "STORE'CATALOG = " ENDSAY;                                    11474000
      SAYNUM (STORE'CATALOG);                                           11476000
      SEND;                                                             11478000
      END;                                                              11480000
$IF                                                                     11482000
$PAGE                                                                   11484000
                                                                        11486000
         <<if an INFO parameter was passed, interpret it and            11488000
           then quit...>>                                               11490000
                                                                        11492000
   IF INFO'LENGTH > 0 THEN                                              11494000
      BEGIN                      <<retrieve INFO= text...>>             11496000
                                                                        11498000
      @PTR:=INFO'ADDRESS;        <<byte pointer at Q-5>>                11500000
      MOVE BUF':=PTR,(INFO'LENGTH), 2; <<leave dest>>                   11502000
      MOVE *:=(%15);             <<append a carriage return>>           11504000
                                                                        11506000
            <<invoke STORE or RESTORE...>>                              11508000
                                                                        11510000
      CXSTORE'RESTORE (BUF', 0 <<STDLISTNUM>>, WANTS);                  11512000
                                                                        11514000
      END                                                               11516000
   ELSE                                                                 11518000
      STORE'RESTORE'DRIVER;                                             11520000
                                                                        11522000
   END <<OUTER'BLOCK PROC>>;                                            11524000
$CONTROL SEGMENT=TITLES                                                 15000000
$PAGE ";TITLES=  PATTERN MATCHING ROUTINES"                             15002000
<< PATTERN...a pattern matcher that implements a fairly simple          15004000
   pattern matching scheme.  It matches a pattern versus a string       15006000
   of up to 8 characters.  Wildcards, and their meanings, are:          15008000
         @        Match from 0 to 8 characters.                         15010000
         ?        Match any single character.                           15012000
         #        Match any single digit (0..9).                        15014000
                                                                        15016000
   Written by:  Stan Sieler   June, 1980                                15018000
                                                                        15020000
NOTE: this source matches the file INCLPAT.SIELER.MPE!                  15022000
                                                                        15024000
-------------------------------------------------------------------     15026000
                                                                        15028000
The following procedures are declared:                                  15030000
                                                                        15032000
      SUB'MATCH                                                         15034000
         ... used only by PATTERN'MATCH.                                15036000
                                                                        15038000
      PATTERN'BUILD                                                     15040000
         ... used by any user to build a pattern from a text            15042000
             string.  The comments further along in this file           15044000
             document the format of a "pattern".                        15046000
                                                                        15048000
      PATTERN'BUILD'STANDARD                                            15050000
         ... used by any user to build 3 patterns from a single         15052000
             standard form file title.  The 3 patterns returned         15054000
             are: file part pattern, group part pattern, and            15056000
             account part pattern.                                      15058000
                                                                        15060000
      PATTERN'MATCH                                                     15062000
         ... used by any user (and by PATTERN'MATCH'STANDARD) to        15064000
             test a pattern versus a text string for "matching".        15066000
                                                                        15068000
      PATTERN'MATCH'STANDARD                                            15070000
         ... used by any user to test a set of 3 patterns to a          15072000
             standard form title.  The 3 patterns are: a file           15074000
             part pattern, a group part pattern, and an account         15076000
             part pattern.                                              15078000
>>                                                                      15080000
$PAGE ";TITLES=  PATTERN MATCHER:   SUB'MATCH"                          15082000
$CONTROL SEGMENT=TITLES                                                 15084000
<<***************************************************************>>     15086000
LOGICAL PROCEDURE SUB'MATCH (PTEXT, ACTUALLEN, PATTERN, STARTPART);     15088000
         VALUE PTEXT, ACTUALLEN, STARTPART;                             15090000
         INTEGER ACTUALLEN, STARTPART;                                  15092000
         BYTE POINTER PTEXT;                                            15094000
         INTEGER ARRAY PATTERN;                                         15096000
      <<This routine attempts to match the remaining portion            15098000
        of the pattern versus the remaining portion of the              15100000
        original text.  If the match succeeds, GOOD is                  15102000
        returned, otherwise FAILED.                                     15104000
        Note: it is recursive!>>                                        15106000
   BEGIN                                                                15108000
   INTEGER                                                              15110000
      I,                                                                15112000
      LEN,                                                              15114000
      MINLEN,                                                           15116000
      NUMBER,                                                  <<04870>>15118000
      PART,                                                             15120000
      PARTS;                                                            15122000
                                                                        15124000
   SUB'MATCH:=FAILED;                                                   15126000
                                                                        15128000
   MINLEN:=0;                                                           15130000
   PARTS:=PATTERN(0);                                                   15132000
   PART:=STARTPART-1;                                                   15134000
                                                                        15136000
         <<determine minimum length that the rest of the                15138000
           pattern must be...>>                                         15140000
                                                                        15142000
   WHILE (PART:=PART+1) <= PARTS DO                                     15144000
      IF (I:=PATTERN(PART)).PATTYPEf <> ANYCHARACTERSp THEN             15146000
         MINLEN:=MINLEN+I.PATLENf;                                      15148000
                                                                        15150000
         <<see if test string has any possible chance of matching       15152000
           pattern...>>                                                 15154000
                                                                        15156000
   IF MINLEN > ACTUALLEN THEN                                           15158000
      RETURN;                 <<FAILED>>                                15160000
                                                                        15162000
         <<loop thru easy parts, recursing to handle                    15164000
           complex parts ("@")...>>                                     15166000
                                                                        15168000
   PART:=STARTPART-1;                                                   15170000
                                                                        15172000
   WHILE (PART:=PART+1) <= PARTS DO                                     15174000
      BEGIN                                                             15176000
      I:=PATTERN(PART);                                                 15178000
      LEN:=I.PATLENf;         <<length of this part>>                   15180000
                                                                        15182000
      IF (ACTUALLEN < LEN) AND I.PATTYPEf <> ANYCHARACTERSp THEN        15184000
         RETURN;              <<can't possibly match>>                  15186000
                                                                        15188000
      CASE I.PATTYPEf OF                                                15190000
         BEGIN                                                          15192000
                                                                        15194000
         <<ANYONECHARACTERp:>>                                          15196000
            ;                          <<valid match, by definition!>>  15198000
                                                                        15200000
         <<ANYCHARACTERSp:>>                                            15202000
            BEGIN                      <<match from 0 to ACTUALLEN>>    15204000
            IF PART = PARTS THEN                                        15206000
               BEGIN                                                    15208000
               SUB'MATCH:=GOOD;        <<is last part.>>                15210000
               RETURN;                                                  15212000
               END;                                                     15214000
                  <<try matching with 0, 1, ..., ACTUALLEN chars...>>   15216000
            LEN:=ACTUALLEN-MINLEN;                                      15218000
            DO                                                          15220000
               IF SUB'MATCH (PTEXT(LEN), ACTUALLEN-LEN,                 15222000
                             PATTERN, PART+1) = GOOD THEN               15224000
                  BEGIN                                                 15226000
                  SUB'MATCH:=GOOD;     <<it worked!>>                   15228000
                  RETURN;                                               15230000
                  END                                                   15232000
            UNTIL                                                       15234000
               (LEN:=LEN-1) < 0;                                        15236000
            RETURN;                    <<it failed!>>                   15238000
            END;                                                        15240000
                                                                        15242000
         <<DIGITONLYp:>>                                                15244000
            BEGIN                                                       15246000
            WHILE (LEN:=LEN-1) >= 0 DO                                  15248000
               IF PTEXT(LEN) <> NUMERIC THEN                            15250000
                  RETURN;              <<not a digit!>>                 15252000
            LEN:=I.PATLENf;                                             15254000
                                                               <<04870>>15256000
            IF DBSTORE'TOG AND (LEN=2) THEN                    <<04870>>15258000
               BEGIN                                           <<04870>>15260000
               NUMBER := 10 * (PTEXT-"0") + (PTEXT(1)-"0");    <<04870>>15262000
               IF (NUMBER > DBSTORE'HIGH) OR                   <<04870>>15264000
                  (NUMBER < DBSTORE'LOW) THEN                  <<04870>>15266000
                     RETURN;                                   <<04870>>15268000
               END;                                            <<04870>>15270000
            END;                                                        15272000
                                                                        15274000
         <<EXACTp:>>                                                    15276000
            BEGIN                                                       15278000
            WHILE (LEN:=LEN-1) >= 0 DO                                  15280000
               IF INTEGER(PTEXT(LEN)) <> I.PATCHARf THEN                15282000
                  RETURN;                 <<mismatched!>>               15284000
            LEN:=I.PATLENf;                                             15286000
            END;                                                        15288000
         END;                                                           15290000
                                                                        15292000
      MINLEN:=MINLEN-LEN;              <<subtract # chars matched>>     15294000
      ACTUALLEN:=ACTUALLEN-LEN;        <<ditto>>                        15296000
      @PTEXT:=@PTEXT(LEN);             <<point to remainder of text>>   15298000
                                                                        15300000
      END;        <<end of while loop>>                                 15302000
                                                                        15304000
   IF ACTUALLEN = 0 THEN                                                15306000
      SUB'MATCH:=GOOD;                 <<matched ok!>>                  15308000
                                                                        15310000
   END <<SUB'MATCH PROC>>;                                              15312000
$PAGE ";TITLES=  PATTERN MATCHER:   PATTERN'BUILD"                      15314000
$CONTROL SEGMENT=TITLES                                                 15316000
<<***************************************************************>>     15318000
LOGICAL PROCEDURE PATTERN'BUILD (PTEXT, PATTERN, ERROR);                15320000
         VALUE PTEXT;                                                   15322000
         INTEGER ERROR;                                                 15324000
         BYTE POINTER PTEXT;                                            15326000
         INTEGER ARRAY PATTERN;                                         15328000
      << This routine encodes a "pattern" into a special format for     15330000
        use by the procedure PATTERN'MATCH.  (See the comment in        15332000
        that procedure for the layout of an encoded "pattern".)         15334000
                                                                        15336000
        This assumes PTEXT points to a string of 1 to PAT'MAX'FIRM      15338000
        characters composed of (usually) A..Z, a..z, 0..9, and          15340000
        "#?@".  This string is a "pattern".  PAT'MAX'FIRM is usually    15342000
        8.  The first byte of the text is the length of the text,       15344000
        not self-inclusive.  Thus the text "CAT#" would be represented  15346000
        as:  %4, "C", "A", "T", "#".                                    15348000
                                                                        15350000
        Note: for compatibility with standard-form titles,              15352000
        only the bottom 7 bits of the length are used...thus,           15354000
        a pointer like:   %(2)10000011, "C", "?", "#"                   15356000
        can be passed into PATTERN'BUILD without having to              15358000
        zap the wildcard bit.                                           15360000
                                                                        15362000
        If more than PAT'MAX'PART parts are found in the pattern text,  15364000
        the routine result will be FAILED and ERROR will be set         15366000
        to PB'ERR'MANY'PARTS.  PAT'MAX'PART is usually 8.               15368000
                                                                        15370000
        If the pattern text contains more than PAT'MAX'FIRM "firm"      15372000
        characters, a FAILED will be returned and ERROR will be         15374000
        set to PB'ERR'MANY'FIRM.  PAT'MAX'FIRM is usually 8.            15376000
        A "firm" character is any character that matches at least       15378000
        1 character (i.e: any character other than "@" is a "firm"      15380000
        character).                                                     15382000
                                                                        15384000
        If no error is found, GOOD is returned and ERROR:=0.            15386000
                                                                        15388000
        PATTERN must be at least 9 words long, even though a short      15390000
        pattern wont use all 9 words.  PATTERN is zeroed at the         15392000
        start of the routine.                                           15394000
                                                                        15396000
        Note that the pattern text is NOT shifted to uppercase!         15398000
                                                                  >>    15400000
      <<---------------------------------------------------------->>    15402000
   BEGIN                                                                15404000
                                                                        15406000
   INTEGER                                                              15408000
      I,                                                                15410000
      FIRMCOUNT   := 0,       <<number of "firm" chars seen>>           15412000
      LEN,                                                              15414000
      PART        := 0,       <<number of parts seen>>                  15416000
      TEXTLEFT;                                                         15418000
                                                                        15420000
   BYTE ARRAY                                                           15422000
      TEXT'COPY'  (0:64);     <<holds a copy of PTEXT(1...)>>           15424000
                                                                        15426000
   LABEL                                                                15428000
      END'PATTERN'BUILD;                                                15430000
                                                                        15432000
   <<------------------->>                                              15434000
   SUBROUTINE FAIL (N); VALUE N; INTEGER N;                             15436000
      BEGIN                                                             15438000
      PATTERN'BUILD:=FAILED;                                            15440000
      ERROR:=N;                                                         15442000
      GO END'PATTERN'BUILD;                                             15444000
      END <<FAIL SUB>>;                                                 15446000
   <<------------------->>                                              15448000
                                                                        15450000
   ERROR:=0;                                                            15452000
                                                                        15454000
   FILL (PATTERN, PAT'MAX'PART + 1, 0);                                 15456000
                                                                        15458000
   TEXTLEFT:=INTEGER(PTEXT).(9:7);     <<only use bottom 7 bits>>       15460000
                                                                        15462000
   MOVE TEXT'COPY':=PTEXT(1),(TEXTLEFT), 2;                             15464000
   MOVE *:=0;                          <<append a stopper>>             15466000
   @PTEXT:=@TEXT'COPY';                                                 15468000
                                                                        15470000
   WHILE TEXTLEFT > 0 DO                                                15472000
      BEGIN                                                             15474000
                                                                        15476000
      PART:=PART+1;                                                     15478000
      IF PART > PAT'MAX'PART THEN                                       15480000
         FAIL (PB'ERR'MANY'PARTS);                                      15482000
                                                                        15484000
      IF PTEXT = "?" THEN              <<match any 1 character>>        15486000
         BEGIN                <<count number of contiguous "?"...>>     15488000
         SCAN PTEXT WHILE "?",1;       <<leave pointer>>                15490000
         LEN:=TOS-LOGICAL(@PTEXT);     <<number of "?">>                15492000
         PATTERN(PART).PATLENf := LEN;                                  15494000
         PATTERN(PART).PATCHARf:="?";                                   15496000
         PATTERN(PART).PATTYPEf:= ANYONECHARACTERp;                     15498000
         FIRMCOUNT:=FIRMCOUNT+LEN;                                      15500000
         END                                                            15502000
                                                                        15504000
      ELSE IF PTEXT = "#" THEN         <<match digit>>                  15506000
         BEGIN                <<count number of contiguous "#"...>>     15508000
         SCAN PTEXT WHILE "#",1;       <<leave pointer>>                15510000
         LEN:=TOS-LOGICAL(@PTEXT);     <<number of "#">>                15512000
         PATTERN(PART).PATLENf := LEN;                                  15514000
         PATTERN(PART).PATCHARf:= "#";                                  15516000
         PATTERN(PART).PATTYPEf:= DIGITONLYp;                           15518000
         FIRMCOUNT:=FIRMCOUNT + LEN;                                    15520000
         END                                                            15522000
                                                                        15524000
      ELSE IF PTEXT = "@" THEN   <<matches any number of characters>>   15526000
         BEGIN                <<count number of contiguous "@"...>>     15528000
         SCAN PTEXT WHILE "@",1;       <<leave pointer>>                15530000
         LEN:=TOS-LOGICAL(@PTEXT);     <<number of "?">>                15532000
         PATTERN(PART).PATLENf := LEN;                                  15534000
         PATTERN(PART).PATCHARf:="@";                                   15536000
         PATTERN(PART).PATTYPEf:= ANYCHARACTERSp;                       15538000
         END                                                            15540000
                                                                        15542000
      ELSE                    <<not a pattern match character...>>      15544000
         BEGIN                                                          15546000
         I:=INTEGER(PTEXT);                                             15548000
         SCAN PTEXT WHILE I, 1;                                         15550000
         LEN:=TOS-LOGICAL(@PTEXT);                                      15552000
         PATTERN(PART).PATLENf := LEN;                                  15554000
         PATTERN(PART).PATCHARf:= INTEGER(PTEXT);                       15556000
         PATTERN(PART).PATTYPEf:= EXACTp;                               15558000
         FIRMCOUNT:=FIRMCOUNT+LEN;                                      15560000
         END;                                                           15562000
                                                                        15564000
      IF FIRMCOUNT > PAT'MAX'FIRM THEN                                  15566000
         FAIL (PB'ERR'MANY'FIRM);                                       15568000
                                                                        15570000
      @PTEXT:=@PTEXT+LEN;                                               15572000
      TEXTLEFT:=TEXTLEFT-LEN;                                           15574000
      END;                                                              15576000
                                                                        15578000
   PATTERN(0):=PART;          <<remember how many parts in pattern.>>   15580000
                                                                        15582000
   PATTERN'BUILD:=GOOD;                                                 15584000
                                                                        15586000
END'PATTERN'BUILD:                                                      15588000
                                                                        15590000
   END <<PATTERN'BUILD PROC>>;                                          15592000
$PAGE ";TITLES=  PATTERN MATCHER:   PATTERN'BUILD'STANDARD"             15594000
$CONTROL SEGMENT=TITLES                                                 15596000
<<***************************************************************>>     15598000
LOGICAL PROCEDURE PATTERN'BUILD'STANDARD (PSTD, F'PAT, G'PAT, A'PAT,    15600000
                                          ERROR);                       15602000
         VALUE PSTD;                                                    15604000
         BYTE POINTER PSTD;                                             15606000
         INTEGER ARRAY F'PAT, G'PAT, A'PAT;                             15608000
         INTEGER ERROR;                                                 15610000
      <<-------------------------------------------------------->>      15612000
      << This routine takes the file, group, and acct parts from>>      15614000
      << the standard form title PSTD and converts them into    >>      15616000
      << three patterns: F'PAT, G'PAT, and A'PAT.  If a part in >>      15618000
      << PSTD is empty, its corresponding pattern will be empty.>>      15620000
      << GOOD is returned if all 3 patterns are built ok,       >>      15622000
      << otherwise FAILED is returned and ERROR is set to 1, 2, >>      15624000
      << or 3 depending on which part failed to parse as a valid>>      15626000
      << pattern (the file=1, group=2, or acct=3).              >>      15628000
      <<-------------------------------------------------------->>      15630000
   BEGIN                                                                15632000
                                                                        15634000
   LABEL                                                                15636000
      END'PROC;                                                         15638000
                                                                        15640000
   <<--------------->>                                                  15642000
   SUBROUTINE FAIL (N); VALUE N; INTEGER N;                             15644000
      BEGIN                                                             15646000
      ERROR:=N;                                                         15648000
      PATTERN'BUILD'STANDARD:=FAILED;                                   15650000
      GO END'PROC;                                                      15652000
      END <<FAIL SUB>>;                                                 15654000
   <<--------------->>                                                  15656000
                                                                        15658000
   PATTERN'BUILD'STANDARD:=GOOD;                                        15660000
                                                                        15662000
   MOVE F'PAT:=(0,0);                                                   15664000
   MOVE G'PAT:=(0,0);                                                   15666000
   MOVE A'PAT:=(0,0);                                                   15668000
   ERROR:=0;                                                            15670000
                                                                        15672000
   IF STD'FILE'INX > 0 THEN                                             15674000
      IF PATTERN'BUILD (PSTD(STD'FILE'INX), F'PAT, ERROR)               15676000
            = FAILED THEN                                               15678000
         FAIL (1);                                                      15680000
                                                                        15682000
   IF STD'GROUP'INX > 0 THEN                                            15684000
      IF PATTERN'BUILD (PSTD(STD'GROUP'INX), G'PAT, ERROR)              15686000
            = FAILED THEN                                               15688000
         FAIL (2);                                                      15690000
                                                                        15692000
   IF STD'ACCT'INX > 0 THEN                                             15694000
      IF PATTERN'BUILD (PSTD(STD'ACCT'INX), A'PAT, ERROR)               15696000
            = FAILED THEN                                               15698000
         FAIL (3);                                                      15700000
                                                                        15702000
END'PROC:                                                               15704000
                                                                        15706000
   END <<PATTERN'BUILD'STANDARD PROC>>;                                 15708000
$PAGE ";TITLES=  PATTERN MATCHER:   PATTERN'MATCH"                      15710000
$CONTROL SEGMENT=TITLES                                                 15712000
<<***************************************************************>>     15714000
LOGICAL PROCEDURE PATTERN'MATCH (PTEXT, PATTERN);                       15716000
         VALUE PTEXT;                                                   15718000
         BYTE POINTER PTEXT;                                            15720000
         INTEGER ARRAY PATTERN;                                         15722000
      <<This routine compares the pattern in PATTERN to the             15724000
        title in PTEXT.  Byte(0) of PTEXT is the text length            15726000
        (0 to PAT'MAX'FIRM (usually 8)).  Only the bottom 7             15728000
        bits of the length are used...this maintains compatibility      15730000
        with standard-form titles, which may use the eighth bit         15732000
        as a wildcard flag.                                             15734000
                                                                        15736000
        If the text in PTEXT matches the pattern in PATTERN,            15738000
        a GOOD is returned, otherwise a FAILED.                         15740000
                                                                        15742000
        The layout of PATTERN is:                                       15744000
            PATTERN (0) = number of parts in the pattern.               15746000
            PATTERN (1..PATTERN(0)) = separate pattern parts.           15748000
        Each pattern part is a single word (16 bits) that looks         15750000
        like:                                                           15752000
              0  1  2    7  8        15                                 15754000
            +------+------+--+--------+                                 15756000
            ! Part ! Part ! Part      !                                 15758000
            ! Type !Length! Character !                                 15760000
            !      !      !           !                                 15762000
            +------+------+-----------+                                 15764000
        Field names:                                                    15766000
             PATTYPEf = (0:2)  PATLENf = (2:6)  PATCHARf = (8:8)        15768000
Char:   Possible types:          Meanings:                              15770000
                                                                        15772000
  ?        ANYONECHARACTERp      Match any sequence of PATLENf          15774000
                                 characters.                            15776000
                                                                        15778000
  @        ANYCHARACTERSp        Match any number of characters.        15780000
                                 PATLENf is disregarded, but happens    15782000
                                 to be the number of contiguous         15784000
                                  "@"'s found in the original           15786000
                                 pattern.                               15788000
                                                                        15790000
  #        DIGITONLYp            Match any sequence of PATLENf          15792000
                                 digits.                                15794000
                                                                        15796000
  A..Z,    EXACTp                Match the exact ASCII character        15798000
  a..z, 0..9, ...                that is found in PATLENf field.        15800000
                                                                        15802000
      A pattern text of:  CA?D#@ would be represented as:               15804000
                                                                        15806000
         6, (EXACTp, 1, "C"), (EXACTp, 1, "A"),                         15808000
            (ANYONECHARACTERp, 1, "?"), (EXACTp, 1, "D"),               15810000
            (DIGITONLYp, 1, "#"), (ANYCHARACTERSp, 1, "@")              15812000
                                                                        15814000
      A pattern text of:  ??@@AA would be represented as:               15816000
                                                                        15818000
         3, (ANYONECHARACTERp, 2, "?"), (ANYCHARACTERSp, 2, "@"),       15820000
            (EXACTp, 2, "A")                                            15822000
                                                                >>      15824000
   <<----------------------------------------------------------->>      15826000
   BEGIN                                                                15828000
                                                                        15830000
   PATTERN'MATCH:=SUB'MATCH (PTEXT(1),                                  15832000
                             INTEGER(PTEXT).(9:7),                      15834000
                             PATTERN, 1);                               15836000
                                                                        15838000
   END <<PATTERN'MATCH PROC>>;                                          15840000
$PAGE ";TITLES=  PATTERN MATCHER:   PATTERN'MATCH'STANDARD"             15842000
$CONTROL SEGMENT=TITLES                                                 15844000
<<***************************************************************>>     15846000
LOGICAL PROCEDURE PATTERN'MATCH'STANDARD (PSTDA, FILE'PAT, GROUP'PAT,   15848000
                                          ACCT'PAT, ERROR);             15850000
         INTEGER ARRAY FILE'PAT, GROUP'PAT, ACCT'PAT;                   15852000
         BYTE ARRAY PSTDA;                                              15854000
         INTEGER ERROR;                                                 15856000
      <<-------------------------------------------------->>            15858000
      << This routine matches the standard-form name found>>            15860000
      << in PSTD to the file,group&account patterns found >>            15862000
      << in FILE'PAT, GROUP'PAT, ACCT'PAT.   If all match,>>            15864000
      << a GOOD is returned, otherwise a FAILED will be   >>            15866000
      << returned and the parameter ERROR will be set to  >>            15868000
      << 1 if the file part did not match, 2 if the group >>            15870000
      << part did not match, and 3 if the acct part did   >>            15872000
      << not match.                                       >>            15874000
      <<                                                  >>            15876000
      << If the file (or group (or acct)) part is empty,  >>            15878000
      << (i.e: STD'FILE'INX = 0), then it will only match >>            15880000
      << an empty pattern (i.e: FILE'PAT(0) = 0)          >>            15882000
      <<-------------------------------------------------->>            15884000
   BEGIN                                                                15886000
                                                                        15888000
   INTEGER                                                              15890000
      ACCTINX,                                                          15892000
      FILEINX,                                                          15894000
      GROUPINX;                                                         15896000
                                                                        15898000
   BYTE POINTER                                                         15900000
      PSTD;                                                             15902000
                                                                        15904000
   LABEL                                                                15906000
      PROC'EXIT;                                                        15908000
                                                                        15910000
   <<---------->>                                                       15912000
   SUBROUTINE FAIL (N); VALUE N; INTEGER N;                             15914000
                                                                        15916000
      BEGIN                                                             15918000
                                                                        15920000
      PATTERN'MATCH'STANDARD:=FAILED;                                   15922000
                                                                        15924000
      ERROR:=N;                                                         15926000
                                                                        15928000
      GO PROC'EXIT;                                                     15930000
                                                                        15932000
      END <<FAIL SUB>>;                                                 15934000
   <<---------->>                                                       15936000
                                                                        15938000
   @PSTD:=@PSTDA;                                                       15940000
                                                                        15942000
   ACCTINX:= STD'ACCT'INX;                                              15944000
   GROUPINX:=STD'GROUP'INX;                                             15946000
   FILEINX:= STD'FILE'INX;                                              15948000
                                                                        15950000
   IF FILEINX = 0 AND FILE'PAT (0) <> 0 THEN                            15952000
      FAIL (1);                                                         15954000
                                                                        15956000
   IF PATTERN'MATCH (PSTD(FILEINX), FILE'PAT) = FAILED THEN             15958000
      FAIL (1);                                                         15960000
                                                                        15962000
   IF GROUPINX = 0 AND GROUP'PAT(0) <> 0 THEN                           15964000
      FAIL (2);                                                         15966000
                                                                        15968000
   IF PATTERN'MATCH (PSTD(GROUPINX), GROUP'PAT) = FAILED THEN           15970000
      FAIL (2);                                                         15972000
                                                                        15974000
   IF ACCTINX = 0 AND ACCT'PAT(0) <> 0 THEN                             15976000
      FAIL (3);                                                         15978000
                                                                        15980000
   IF PATTERN'MATCH (PSTD(ACCTINX), ACCT'PAT) = FAILED THEN             15982000
      FAIL (3);                                                         15984000
                                                                        15986000
   PATTERN'MATCH'STANDARD:=GOOD;                                        15988000
                                                                        15990000
PROC'EXIT:                                                              15992000
                                                                        15994000
   END <<PATTERN'MATCH'STANDARD PROC>>;                                 15996000
$PAGE ";TITLES=  PATTERN MATCHER:   PATTERN'3'MATCH"                    15998000
$CONTROL SEGMENT=TITLES                                                 16000000
<<***************************************************************>>     16002000
LOGICAL PROCEDURE PATTERN'3'MATCH (F', G', A', FILE'PAT, GROUP'PAT,     16004000
                                          ACCT'PAT, ERROR);             16006000
         INTEGER ARRAY FILE'PAT, GROUP'PAT, ACCT'PAT;                   16008000
         BYTE ARRAY F', G', A';                                         16010000
         INTEGER ERROR;                                                 16012000
      <<-------------------------------------------------->>            16014000
      << This routine matches the three 8-byte titles in  >>            16016000
      << F', G', and A' to the 3 patterns found in arrays >>            16018000
      << FILE'PAT, GROUP'PAT, ACCT'PAT.   If all match,   >>            16020000
      << a GOOD is returned, otherwise a FAILED will be   >>            16022000
      << returned and the parameter ERROR will be set to  >>            16024000
      << 1 if the file part did not match, 2 if the group >>            16026000
      << part did not match, and 3 if the acct part did   >>            16028000
      << not match.                                       >>            16030000
      <<-------------------------------------------------->>            16032000
   BEGIN                                                                16034000
                                                                        16036000
   INTEGER                                                              16038000
      LEN;                                                              16040000
                                                                        16042000
   BYTE ARRAY                                                           16044000
      SCRATCH'    (0:PAT'MAX'FIRM + 1);   <<a file part + 2>>           16046000
                                                                        16048000
   LABEL                                                                16050000
      PROC'EXIT;                                                        16052000
                                                                        16054000
   <<---------->>                                                       16056000
   SUBROUTINE FAIL (N); VALUE N; INTEGER N;                             16058000
                                                                        16060000
      BEGIN                                                             16062000
                                                                        16064000
      PATTERN'3'MATCH:=FAILED;                                          16066000
                                                                        16068000
      ERROR:=N;                                                         16070000
                                                                        16072000
      GO PROC'EXIT;                                                     16074000
                                                                        16076000
      END <<FAIL SUB>>;                                                 16078000
                                                                        16080000
   <<---------->>                                                       16082000
   SUBROUTINE MATCHIT (N, PART', PAT);                                  16084000
            VALUE      N;                                               16086000
            INTEGER    N;                                               16088000
            BYTE ARRAY    PART';                                        16090000
            INTEGER ARRAY        PAT;                                   16092000
      BEGIN                                                             16094000
                                                                        16096000
      MOVE SCRATCH'(1):=PART', (PAT'MAX'FIRM);                          16098000
                                                                        16100000
      SCAN SCRATCH'(1) UNTIL " ", 1;                                    16102000
      LEN:=TOS-LOGICAL(@SCRATCH'(1));                                   16104000
      SCRATCH'(0):=LEN;       <<'simple' standard form>>                16106000
                                                                        16108000
      IF PATTERN'MATCH (SCRATCH', PAT) = FAILED THEN                    16110000
         FAIL (N);                                                      16112000
                                                                        16114000
      END <<MATCHIT SUB>>;                                              16116000
   <<----------->>                                                      16118000
                                                                        16120000
   FILL' (SCRATCH', PAT'MAX'FIRM + 2, " ");                             16122000
                                                                        16124000
   MATCHIT (1, F', FILE'PAT);                                           16126000
                                                                        16128000
   MATCHIT (2, G', GROUP'PAT);                                          16130000
                                                                        16132000
   MATCHIT (3, A', ACCT'PAT);                                           16134000
                                                                        16136000
   PATTERN'3'MATCH:=GOOD;                                               16138000
                                                                        16140000
PROC'EXIT:                                                              16142000
                                                                        16144000
   END <<PATTERN'3'MATCH PROC>>;                                        16146000
$PAGE ";TITLES=  STANDARD FORM ROUTINES"                                16148000
<<                                                                      16150000
*******************************************************************     16152000
                                                                        16154000
   STANDARD'TO'DISPLAY  and  DISPLAY'TO'STANDARD                        16156000
                                                                        16158000
   Designed and written in 1980 by Stan Sieler.                         16160000
   Enhanced in 1981 by Stan Sieler.                                     16162000
                                                                        16164000
NOTE: this source matches the file INCLSTD.SIELER.MPE!                  16166000
                                                                        16168000
-------------------------------------------------------------------     16170000
                                                                        16172000
The following procedures are declared in this include file:             16174000
                                                                        16176000
      DISPLAY'TO'STANDARD                                               16178000
         ... This routine converts a display form file title            16180000
         into a standard form title.  This routine documents the        16182000
         format of a standard form title.                               16184000
                                                                        16186000
      DISPLAY'3'TO'STANDARD                                             16188000
         ... This routine converts 3 8-byte arrays (which are           16190000
         a file name, group name, and account name) into a              16192000
         standard form title.                                           16194000
                                                                        16196000
      STANDARD'TO'DISPLAY                                               16198000
         ... This routine converts a standard form title into           16200000
         a display form title.                                          16202000
                                                                        16204000
      STANDARD'TO'3'DISPLAY                                             16206000
         ... This routine converts a standard form title into           16208000
         three 8-byte arrays, which are: file name, group name          16210000
         and account name.                                              16212000
                                                                        16214000
-------------------------------------------------------------------     16216000
>>                                                                      16218000
$PAGE ";TITLES=  STANDARD FORM:   DISPLAY'TO'STANDARD"                  16220000
$CONTROL SEGMENT=TITLES                                                 16222000
<<***************************************************************>>     16224000
LOGICAL PROCEDURE DISPLAY'TO'STANDARD (PDIS, PSTD, ERROR, CHAR'INX,     16226000
                                       DELIMS', ALLOWED'ITEMS);         16228000
            VALUE PDIS, PSTD, DELIMS', ALLOWED'ITEMS;                   16230000
            INTEGER ERROR, CHAR'INX;                                    16232000
            LOGICAL ALLOWED'ITEMS;                                      16234000
            BYTE POINTER PDIS, PSTD, DELIMS';                           16236000
            OPTION VARIABLE;                                            16238000
   <<This routine converts a display form file title into               16240000
     a standard form file title.  If an error occurs, the error         16242000
     number is reported in ERROR.                                       16244000
     Parameters:                                                        16246000
                                                                        16248000
      PDIS:  byte pointer, points to a file title (with or              16250000
         without wildcards or group or account.  Terminated by          16252000
         a blank!                                                       16254000
         May not be omitted.                                            16256000
                                                                        16258000
      PSTD:  byte pointer, will hold standard form title.  As           16260000
         such, must hold at least MAX'STD'LEN characters!               16262000
         This will be filled with zeroes at start of routine.           16264000
         May not be omitted.                                            16266000
                                                                        16268000
      ERROR: integer, call by reference.                                16270000
         This is initialized to zero at entry.                          16272000
         May not be omitted.                                            16274000
                                                                        16276000
      CHAR'INX: integer, call by reference.                             16278000
         In the event of an error, this is the index of the             16280000
         offending character in PDIS.                                   16282000
         In the event of a successful conversion, this is the           16284000
         index of the first character AFTER the file title,             16286000
         presumably the blank that trails it.  It therefore             16288000
         is equivalent to the length of the display form title.         16290000
         May not be omitted.                                            16292000
                                                                        16294000
      DELIMS': byte pointer, call by value.                             16296000
         Contains a sequence of characters that are valid to            16298000
         terminate a file title with.  DELIMS' (0) is the count of      16300000
         the number of valid delimiters.  Thus, to allow a file title   16302000
         to be delimited by blank, comma, semicolon, or minus, one      16304000
         would use:  MOVE DELIMS':=(%4, " ,;-");   or                   16306000
         (%4, "-; ,").                                                  16308000
         Note: this cannot be used to prevent letters/digits/wildcards  16310000
         from being part of a title!                                    16312000
         Defaults to:   (%6, "-; ,", %15, 0).                           16314000
                                                                        16316000
      ALLOWED'ITEMS: logical, call by value.                            16318000
         Contains bits that determine what types of titles are          16320000
         allowed.                                                       16322000
         Defaults to: all possibilities allowed except                  16324000
                      imbedded blanks.                                  16326000
                                                                        16328000
   Result:                                                              16330000
      FAILED if an error occurs,                                        16332000
      GOOD if no error.   (GOOD <==> NOT FAILED)                        16334000
   -----------------------------------------------------------          16336000
                                                                        16338000
   Standard form file title layout:                                     16340000
                                                                        16342000
   Byte array:           #Bytes  Byte index    Define to access:        16344000
                                             (using byte pointer        16346000
      +------------------+                    PSTD)                     16348000
      ! total length     !    2     0             STD'LEN'TOTAL         16350000
      ! (self inclusive) !                                              16352000
      ! (units are bytes)!                                              16354000
      !(NOTE: this field !                                              16356000
      ! is 2 bytes long!)!                                              16358000
      +------------------+                                              16360000
      ! standard-form    !    1     2             STD'VERSION           16362000
      ! version          !                                              16364000
      ! (usually = 1)    !                                              16366000
      +------------------+                                              16368000
      ! information byte !    1     3             STD'INFO              16370000
      ! bits: (8..15)    !                                              16372000
      ! 8 = r e s e r v e!  \                                           16374000
      ! 9 = r e s e r v e!   \                                          16376000
      !10 = r e s e r v e!    >   set to 0.                             16378000
      !11 = r e s e r v e!   /                                          16380000
      !12 = r e s e r v e!  /                                           16382000
      !13 = backreference!                        STD'BACKREF           16384000
      !14 = dollar       !                        STD'DOLLAR            16386000
      !15 = wildcards    !                        STD'WILD              16388000
      +------------------+                                              16390000
      !index of file part!    1     4             STD'FILE'INX          16392000
      ! in this array    !                                              16394000
      !(if zero, part was!                                              16396000
      !not found)        !                                              16398000
      +------------------+                                              16400000
      !index of lockword !    1     5             STD'LOCK'INX          16402000
      !part in this array!                                              16404000
      +------------------+                                              16406000
      !index of group    !    1     6             STD'GROUP'INX         16408000
      !part in this array!                                              16410000
      +------------------+                                              16412000
      !index of acct part!    1     7             STD'ACCT'INX          16414000
      !in this array     !                                              16416000
      +------------------+                                              16418000
      !reserved, := 0    !    1     8             STD'HOST'INX          16420000
      !  (host name)     !                                              16422000
      +------------------+                                              16424000
      !reserved, := 0    !    1     9             STD'PV'INX            16426000
      !(private volume   !                                              16428000
      ! (family) name    !                                              16430000
      +------------------+                                              16432000
              ...                                                       16434000
      +------------------+                                              16436000
      ~ dont count on the~                                              16438000
      ~ next part being  ~                                              16440000
      ~ right after the  ~                                              16442000
      ~ above info!!!!   ~                                              16444000
      +------------------+                                              16446000
              ...                                                       16448000
      +------------------+                                              16450000
      ! reserved, := 1   !    1     STD'FILE'INX-1                      16452000
      ! (number of parts !                        STD'FILE'PARTS        16454000
      ! in file name)    !                                              16456000
      +------------------+                                              16458000
      !file part info:   !    1     STD'FILE'INX  STD'FILE'INFO         16460000
      !bit 8 = wildcards !                        STD'FILE'WILD         16462000
      !bit 9..15= length !                        STD'FILE'LEN          16464000
      +------------------+                                              16466000
      !file part text... !    0..8  STD'FILE'INX+1                      16468000
      !up to 8 characters!                        STD'FILE'             16470000
      !in length, no fill!                                              16472000
      !characters at end.!                                              16474000
      +------------------+                                              16476000
              ...                                                       16478000
      +------------------+                                              16480000
      ! (second, third...!    0..???                                    16482000
      ! 'nth' file parts !                                              16484000
      ! will follow this !                                              16486000
      ! someday).        !                                              16488000
      +------------------+                                              16490000
              ...                                                       16492000
      +------------------+                                              16494000
      !lock part info:   !    1     STD'LOCK'INX  STD'LOCK'INFO         16496000
      !bit 8 = wildcards !                        STD'LOCK'WILD         16498000
      !bit 9..15= length !                        STD'LOCK'LEN          16500000
      +------------------+                                              16502000
      !lock part text... !    0..8  STD'LOCK'INX+1                      16504000
      !up to 8 characters!                        STD'LOCK'             16506000
      !in length, no fill!                                              16508000
      !characters at end.!                                              16510000
      +------------------+                                              16512000
              ...                                                       16514000
      +------------------+                                              16516000
      !group part info:  !    1     STD'GROUP'INX STD'GROUP'INFO        16518000
      !bit 8 = wildcards !                        STD'GROUP'WILD        16520000
      !bit 9..15= length !                        STD'GROUP'LEN         16522000
      +------------------+                                              16524000
      !group part text...!    0..8  STD'GROUP'INX+1                     16526000
      !up to 8 characters!                        STD'GROUP'            16528000
      !in length, no fill!                                              16530000
      !characters at end.!                                              16532000
      +------------------+                                              16534000
              ...                                                       16536000
      +------------------+                                              16538000
      !acct part info:   !    1     STD'ACCT'INX  STD'ACCT'INFO         16540000
      !bit 8 = wildcards !                        STD'ACCT'WILD         16542000
      !bit 9..15= length !                        STD'ACCT'LEN          16544000
      +------------------+                                              16546000
      !acct part text... !    0..8  STD'ACCT'INX+1                      16548000
      !up to 8 characters!                        STD'ACCT'             16550000
      !in length, no fill!                                              16552000
      !characters at end.!                                              16554000
      +------------------+                                              16556000
              ...                                                       16558000
      ~~~~~~~~~~~~~~~~~~~~                                              16560000
      ~ The following    ~                                              16562000
      ~ two parts are not~                                              16564000
      ~ yet implemented, ~                                              16566000
      ~ but have been    ~                                              16568000
      ~ defined to allow ~                                              16570000
      ~later enhancements~                                              16572000
      ~~~~~~~~~~~~~~~~~~~~                                              16574000
              ...                                                       16576000
      +------------------+                                              16578000
      !family part info: !    1     STD'FAMILY'INX STD'FAMILY'INFO      16580000
      !bit 8 = wildcards !                        STD'FAMILY'WILD       16582000
      !bit 9..15= length !                        STD'FAMILY'LEN        16584000
      +------------------+                                              16586000
      !family part text..!    0..8  STD'FAMILY'INX+1                    16588000
      !up to 8 characters!                        STD'FAMILY'           16590000
      !in length, no fill!                                              16592000
      !characters at end.!                                              16594000
      +------------------+                                              16596000
              ...                                                       16598000
      +------------------+                                              16600000
      !host part info:   !    1     STD'HOST'INX  STD'HOST'INFO         16602000
      !bit 8 = wildcards !                        STD'HOST'WILD         16604000
      !bit 9..15= length !                        STD'HOST'LEN          16606000
      +------------------+                                              16608000
      !host part text... !    0..8  STD'HOST'INX+1                      16610000
      !up to 8 characters!                        STD'HOST'             16612000
      !in length, no fill!                                              16614000
      !characters at end.!                                              16616000
      +------------------+                                              16618000
                                                                        16620000
   ----------------------------------------------------------->>        16622000
   BEGIN                                                                16624000
                                                                        16626000
   LABEL                                                                16628000
      XIT;                                                              16630000
                                                                        16632000
   BYTE ARRAY                                                           16634000
      DEFAULT'DELIMS' (0:6),                                            16636000
      DUMMY'(0:1) = Q;                                                  16638000
                                                                        16640000
   LOGICAL                                                              16642000
      BITMASK     = Q - 4,                                              16644000
      CHAR'TYPE   := FALSE,                                             16646000
      DEFAULT'ALLOWED'ITEMS,                                            16648000
      DIGIT       := FALSE,                                             16650000
      DONE        := FALSE,                                             16652000
      LETTER      := FALSE,                                             16654000
      WILD        := FALSE,                                             16656000
      WILD'PART   := FALSE;                                             16658000
                                                                        16660000
   INTEGER                                                              16662000
      DELIM'INX   := 0,   <<used to index through DELIMS'>>             16664000
      PART'INX    := 0,   <<index of info for current part>>            16666000
      PART'LEN    := 0,   <<length of current part>>                    16668000
      STATE       := 0,   <<0, 1, 2, 3: file, lock, group, acct>>       16670000
      TOTAL'LEN   := 0;   <<cumulative length of std title thus far>>   16672000
                                                                        16674000
   BYTE                                                                 16676000
      CHAR;                                                             16678000
                                                                        16680000
   DEFINE                                                               16682000
      STATE'FILE  = 0 #,                                                16684000
      STATE'LOCK  = 1 #,                                                16686000
      STATE'GROUP = 2 #,                                                16688000
      STATE'ACCT  = 3 #;                                                16690000
                                                                        16692000
   <<---------------------->>                                           16694000
   SUBROUTINE ERR (N); VALUE N; INTEGER N;                              16696000
      BEGIN                                                             16698000
                                                                        16700000
      ERROR:= N;                                                        16702000
      DISPLAY'TO'STANDARD:=FAILED;                                      16704000
      GO XIT;                                                           16706000
                                                                        16708000
      END <<ERR SUB>>;                                                  16710000
   <<--------------------->>                                            16712000
   SUBROUTINE APPEND'CHAR;                                              16714000
      BEGIN                                                             16716000
                                                                        16718000
            <<see if we can suppress a duplicate "@"...>>               16720000
                                                                        16722000
      IF WILD AND CHAR="@" AND PART'LEN > 1 AND                         16724000
              PSTD(TOTAL'LEN) = "@" THEN                                16726000
      ELSE                                                              16728000
         BEGIN                         <<nope...can't suppress it...>>  16730000
         TOTAL'LEN:=TOTAL'LEN+1;                                        16732000
         IF (PART'LEN:=PART'LEN+1) > 8 THEN                             16734000
            ERR (SE'PART'TOO'LONG);       <<part too long>>             16736000
                                                                        16738000
         PSTD(TOTAL'LEN):=CHAR;                                         16740000
         END;                                                           16742000
                                                                        16744000
      END <<APPEND'CHAR SUB>>;                                          16746000
   <<------------------------->>                                        16748000
   LOGICAL SUBROUTINE CHECK'DELIM;                                      16750000
      BEGIN                                                             16752000
                                                                        16754000
      DELIM'INX:=DELIMS'(0)+1;                                          16756000
                                                                        16758000
      WHILE (DELIM'INX:=DELIM'INX-1) > 0 DO                             16760000
         IF DELIMS'(DELIM'INX) = CHAR THEN                              16762000
            BEGIN                                                       16764000
            CHECK'DELIM:=GOOD;                                          16766000
            RETURN;                                                     16768000
            END;                                                        16770000
                                                                        16772000
      CHECK'DELIM:=FAILED;                                              16774000
                                                                        16776000
      END <<CHECK'DELIM SUB>>;                                          16778000
   <<------------------------>>                                         16780000
   SUBROUTINE CLASSIFY'CHAR;                                            16782000
      BEGIN                                                             16784000
                                                                        16786000
      CHAR:=PDIS(CHAR'INX);                                             16788000
                                                                        16790000
            <<classify the character...>>                               16792000
                                                                        16794000
      WILD:=DIGIT:=LETTER:=FALSE;                                       16796000
                                                                        16798000
      IF CHAR = ALPHA THEN                                              16800000
         BEGIN                                                          16802000
         LETTER:=TRUE;                 <<lowercase a..z>>               16804000
            <<upcase it...>>                                            16806000
         DUMMY'(0):=CHAR;                                               16808000
         MOVE DUMMY':=DUMMY' WHILE AS;   <<upshift 1 character>>        16810000
         CHAR:=DUMMY'(0);                                               16812000
         END                                                            16814000
      ELSE IF CHAR = NUMERIC THEN                                       16816000
         DIGIT:=TRUE                   <<digit from 0..9>>              16818000
      ELSE IF CHAR="@" OR CHAR="?" OR CHAR="#" THEN                     16820000
         WILD:=TRUE;                   <<wildcard>>                     16822000
                                                                        16824000
      END <<CLASSIFY'CHAR SUB>>;                                        16826000
   <<--------------------->>                                            16828000
   SUBROUTINE CLOSE'PART;                                               16830000
      BEGIN                                                             16832000
                                                                        16834000
      IF PART'LEN = 0 THEN                                              16836000
         ERR (SE'ZERO'PART);           <<zero length part>>             16838000
                                                                        16840000
      CASE STATE OF                                                     16842000
         BEGIN                                                          16844000
                                                                        16846000
         <<STATE'FILE:>>                                                16848000
            BEGIN                                                       16850000
            STD'FILE'WILD:=WILD'PART;                                   16852000
            STD'FILE'LEN:=PART'LEN;                                     16854000
            END;                                                        16856000
                                                                        16858000
         <<STATE'LOCK:>>                                                16860000
            BEGIN                                                       16862000
            STD'LOCK'WILD:=WILD'PART;                                   16864000
            STD'LOCK'LEN:=PART'LEN;                                     16866000
            END;                                                        16868000
                                                                        16870000
         <<STATE'GROUP:>>                                               16872000
            BEGIN                                                       16874000
            STD'GROUP'WILD:=WILD'PART;                                  16876000
            STD'GROUP'LEN:=PART'LEN;                                    16878000
            END;                                                        16880000
                                                                        16882000
         <<STATE'ACCT:>>                                                16884000
            BEGIN                                                       16886000
            STD'ACCT'WILD:=WILD'PART;                                   16888000
            STD'ACCT'LEN:=PART'LEN;                                     16890000
            END                                                         16892000
         END;                                                           16894000
                                                                        16896000
      END <<CLOSE'PART SUB>>;                                           16898000
   <<--------------------->>                                            16900000
   SUBROUTINE LOOK'AT'CHAR;                                             16902000
      BEGIN                                                             16904000
                                                                        16906000
      IF WILD THEN                                                      16908000
         BEGIN                         <<wildcard found>>               16910000
         WILD'PART:=TRUE;                                               16912000
         STD'WILD:=TRUE;                                                16914000
                                                                        16916000
         IF LOGICAL(STD'DOLLAR) THEN                                    16918000
            ERR (SE'WILD'AND'DOLLAR);  <<wildcard and $>>               16920000
                                                                        16922000
         IF LOGICAL(STD'BACKREF) THEN                                   16924000
            ERR (SE'WILD'AND'STAR);    <<wildcard and *>>               16926000
                                                                        16928000
         IF PART'LEN=0 AND CHAR="#" THEN                                16930000
            ERR (SE'FIRST'NOT'LETTER); <<first char not letter>>        16932000
         END                                                            16934000
                                                                        16936000
      ELSE IF PART'LEN=0 AND DIGIT THEN                                 16938000
         ERR (SE'FIRST'NOT'LETTER);    <<first char not letter>>        16940000
                                                                        16942000
      APPEND'CHAR;                                                      16944000
                                                                        16946000
      END <<LOOK'AT'CHAR SUB>>;                                         16948000
   <<--------------------->>                                            16950000
   SUBROUTINE START'PART;                                               16952000
      BEGIN                                                             16954000
                                                                        16956000
      PART'INX:= (TOTAL'LEN:=TOTAL'LEN+1);                              16958000
                                                                        16960000
      CASE STATE OF                                                     16962000
         BEGIN                                                          16964000
                                                                        16966000
         <<STATE'FILE:>>                                                16968000
            BEGIN                                                       16970000
            PSTD(PART'INX):=1;                                          16972000
            PART'INX:= (TOTAL'LEN:=TOTAL'LEN+1);                        16974000
            STD'FILE'INX:=PART'INX;                                     16976000
            END;                                                        16978000
                                                                        16980000
         <<STATE'LOCK:>>                                                16982000
            STD'LOCK'INX:=PART'INX;                                     16984000
                                                                        16986000
         <<STATE'GROUP:>>                                               16988000
            STD'GROUP'INX:=PART'INX;                                    16990000
                                                                        16992000
         <<STATE'ACCT:>>                                                16994000
            STD'ACCT'INX:=PART'INX;                                     16996000
                                                                        16998000
         END;                                                           17000000
                                                                        17002000
      WILD'PART:=FALSE;                                                 17004000
      PART'LEN:=0;                                                      17006000
                                                                        17008000
      END <<START'PART SUB>>;                                           17010000
   <<--------------------->>                                            17012000
                                                                        17014000
   IF BITMASK.(10:04) <> %17 THEN                                       17016000
      ERR (SE'MISSING'PARAMETERS);                                      17018000
                                                                        17020000
   IF NOT BITMASK.(14:01) THEN                                          17022000
      BEGIN                                                             17024000
      @DELIMS':=@DEFAULT'DELIMS';                                       17026000
      MOVE DELIMS':=(%6, " ,;-", %15, 0);                               17028000
      END;                                                              17030000
                                                                        17032000
   DEFAULT'ALLOWED'ITEMS:=%177777;          <<all bits on>>             17034000
                                                                        17036000
   IF NOT BITMASK.(15:01) THEN                                          17038000
      ALLOWED'ITEMS:=DEFAULT'ALLOWED'ITEMS;                             17040000
                                                                        17042000
   DISPLAY'TO'STANDARD:=GOOD;                                           17044000
                                                                        17046000
   PSTD(0):=0;                                                          17048000
   MOVE PSTD(1):=PSTD(0),(MAX'STD'LEN-1);                               17050000
                                                                        17052000
   ERROR:=0;                                                            17054000
   DUMMY'(1):=0;                                                        17056000
   STD'VERSION:=1;            <<this is version 1 of std form>>         17058000
   TOTAL'LEN:=10-1;           <<first available index-1>>               17060000
                                                                        17062000
   STATE:=STATE'FILE;                                                   17064000
                                                                        17066000
   START'PART;                                                          17068000
                                                                        17070000
   CHAR'INX:=0;                                                         17072000
                                                                        17074000
   IF ALLOWED'ITEMS.ALLOW'LEAD'BLANK'bit THEN                           17076000
      WHILE PDIS(CHAR'INX) = " " DO                                     17078000
         CHAR'INX:=CHAR'INX + 1;                                        17080000
                                                                        17082000
   DONE:=FALSE;                                                         17084000
                                                                        17086000
   WHILE NOT DONE DO                                                    17088000
      BEGIN                                                             17090000
                                                                        17092000
            <<setup & classify CHAR...>>                                17094000
                                                                        17096000
      CLASSIFY'CHAR;                                                    17098000
                                                                        17100000
            <<look at the character...>>                                17102000
                                                                        17104000
      IF WILD OR LETTER OR DIGIT THEN                                   17106000
         LOOK'AT'CHAR                                                   17108000
                                                                        17110000
      ELSE IF CHAR = "." OR CHAR = "/" THEN                             17112000
         BEGIN                                                          17114000
         CLOSE'PART;                   <<close off current part>>       17116000
         IF CHAR = "/" THEN                                             17118000
            IF STATE <> STATE'FILE THEN                                 17120000
               ERR (SE'LOCKWORD'LOC)   <<bad place for lockword>>       17122000
            ELSE                                                        17124000
               STATE:=STATE'LOCK                                        17126000
         ELSE IF STATE = STATE'FILE THEN                                17128000
            STATE:=STATE'GROUP         <<dot moves from file->group>>   17130000
         ELSE IF STATE = STATE'LOCK THEN                                17132000
            STATE:=STATE'GROUP         <<dot moves from lock->group>>   17134000
         ELSE IF STATE = STATE'GROUP THEN                               17136000
            STATE:=STATE'ACCT          <<dot moves from group->acct>>   17138000
         ELSE                                                           17140000
            ERR (SE'TOO'MANY'PERIODS); <<too many periods>>             17142000
         START'PART;                   <<setup next part>>              17144000
         END                                                            17146000
                                                                        17148000
      ELSE IF CHAR = "*" THEN                                           17150000
         BEGIN                                                          17152000
         IF LOGICAL(STD'BACKREF) THEN                                   17154000
            ERR (SE'STAR'NOT'FIRST);  <<second "*" we have seen>>       17156000
         STD'BACKREF:=TRUE;                                             17158000
         IF STATE <> STATE'FILE OR PART'LEN <> 0 OR                     17160000
               LOGICAL(STD'DOLLAR) THEN                                 17162000
            ERR (SE'STAR'NOT'FIRST);   <<"*" must be first char>>       17164000
         END                                                            17166000
                                                                        17168000
      ELSE IF CHAR = "$" THEN                                           17170000
         BEGIN                                                          17172000
         IF LOGICAL(STD'DOLLAR) THEN                                    17174000
            ERR (SE'DOLLAR'NOT'FIRST); <<second $ we have seen>>        17176000
         STD'DOLLAR:=TRUE;                                              17178000
         IF STATE <> STATE'FILE OR PART'LEN <> 0 OR                     17180000
               LOGICAL(STD'BACKREF) THEN                                17182000
            ERR (SE'DOLLAR'NOT'FIRST); <<"$" must be first char>>       17184000
         END                                                            17186000
                                                                        17188000
      ELSE IF CHECK'DELIM = GOOD THEN                                   17190000
         DONE:=TRUE                                                     17192000
                                                                        17194000
      ELSE                                                              17196000
         ERR (SE'ILLEGAL'CHARACTER);   <<invalid title character>>      17198000
                                                                        17200000
      IF NOT DONE THEN                                                  17202000
         CHAR'INX:=CHAR'INX+1;                                          17204000
                                                                        17206000
      END;                                                              17208000
                                                                        17210000
   CLOSE'PART;                                                          17212000
                                                                        17214000
   TOTAL'LEN:=TOTAL'LEN+1;                                              17216000
   PSTD(0):=TOTAL'LEN.(0:8);                                            17218000
   PSTD(1):=TOTAL'LEN.(8:8);                                            17220000
                                                                        17222000
         <<we now have a valid title...see if the user supplied         17224000
           any portions that the programmer did NOT want...>>           17226000
                                                                        17228000
   IF ALLOWED'ITEMS <> DEFAULT'ALLOWED'ITEMS THEN                       17230000
      BEGIN                                                             17232000
                                                                        17234000
      IF NOT ALLOWED'ITEMS.ALLOW'BACKREF'bit THEN                       17236000
         IF STD'BACKREF = 1 THEN                                        17238000
            ERR (SE'FOUND'BACKREF);                                     17240000
                                                                        17242000
      IF NOT ALLOWED'ITEMS.ALLOW'DOLLAR'bit  THEN                       17244000
         IF STD'DOLLAR = 1 THEN                                         17246000
            ERR (SE'FOUND'DOLLAR);                                      17248000
                                                                        17250000
      IF NOT ALLOWED'ITEMS.ALLOW'WILD'bit    THEN                       17252000
         IF STD'WILD = 1 THEN                                           17254000
            ERR (SE'FOUND'WILD);                                        17256000
                                                                        17258000
      IF NOT ALLOWED'ITEMS.ALLOW'MULTI'FILE'PARTS'bit  THEN             17260000
         IF STD'FILE'PARTS > 1 THEN                                     17262000
            ERR (SE'FOUND'MULTI);                                       17264000
                                                                        17266000
      IF NOT ALLOWED'ITEMS.ALLOW'LOCK'bit    THEN                       17268000
         IF STD'LOCK'INX > 0 THEN                                       17270000
            ERR (SE'FOUND'LOCK);                                        17272000
                                                                        17274000
      IF NOT ALLOWED'ITEMS.ALLOW'GROUP'bit   THEN                       17276000
         IF STD'GROUP'INX > 0 THEN                                      17278000
            ERR (SE'FOUND'GROUP);                                       17280000
                                                                        17282000
      IF NOT ALLOWED'ITEMS.ALLOW'ACCT'bit    THEN                       17284000
         IF STD'ACCT'INX > 0 THEN                                       17286000
            ERR (SE'FOUND'ACCT);                                        17288000
                                                                        17290000
      IF NOT ALLOWED'ITEMS.ALLOW'FAMILY'bit  THEN                       17292000
         IF STD'FAMILY'INX > 0 THEN                                     17294000
            ERR (SE'FOUND'FAMILY);                                      17296000
                                                                        17298000
      IF NOT ALLOWED'ITEMS.ALLOW'HOST'bit    THEN                       17300000
         IF STD'HOST'INX > 0 THEN                                       17302000
            ERR (SE'FOUND'HOST);                                        17304000
      END;                                                              17306000
                                                                        17308000
XIT:                                                                    17310000
                                                                        17312000
   END <<DISPLAY'TO'STANDARD PROC>>;                                    17314000
$PAGE ";TITLES=  STANDARD FORM:   DISPLAY'3'TO'STANDARD"                17316000
$CONTROL SEGMENT=TITLES                                                 17318000
<<***************************************************************>>     17320000
LOGICAL PROCEDURE DISPLAY'3'TO'STANDARD (F', G', A',                    17322000
                                         PSTD, ERROR);                  17324000
            VALUE PSTD;                                                 17326000
            INTEGER ERROR;                                              17328000
            BYTE POINTER PSTD;                                          17330000
            BYTE ARRAY F', G', A';                                      17332000
   <<This routine converts a display form file title into               17334000
     a standard form file title.  If an error occurs, the error         17336000
     number is reported in ERROR.                                       17338000
     Parameters:                                                        17340000
                                                                        17342000
      F', G', A': byte arrays.                                          17344000
         These hold the file, group, and account parts ... up to        17346000
         8 bytes each, blank filled.  A part exactly 8 bytes long       17348000
         will not have a blank at the end.                              17350000
                                                                        17352000
      PSTD:  byte pointer, will hold standard form title.  As           17354000
         such, must hold at least MAX'STD'LEN characters!               17356000
         This will be filled with zeroes at start of routine.           17358000
                                                                        17360000
      ERROR: integer, call by reference.                                17362000
         This is initialized to zero at entry.                  >>      17364000
      <<-------------------------------------------------------->>      17366000
   BEGIN                                                                17368000
                                                                        17370000
   INTEGER                                                              17372000
      CHAR'INX,                                                         17374000
      ERROR1,                                                           17376000
      LEN;                                                              17378000
                                                                        17380000
   BYTE ARRAY                                                           17382000
      DELIMS'      (0:1),                                               17384000
      PDIS        (0:MAX'TITLE'LEN+1),                                  17386000
      TEMP        (0:8);                                                17388000
                                                                        17390000
   BYTE POINTER                                                         17392000
      P;                                                                17394000
                                                                        17396000
   <<-------------------->>                                             17398000
   SUBROUTINE APPEND (PART', TAIL);                                     17400000
            VALUE TAIL;                                                 17402000
            BYTE ARRAY PART';                                           17404000
            BYTE TAIL;                                                  17406000
      BEGIN                                                             17408000
                                                                        17410000
      MOVE TEMP:=PART',(8);                                             17412000
      SCAN TEMP UNTIL "  ",1;          <<leave dest pointer>>           17414000
      LEN:=TOS-LOGICAL(@TEMP);         <<number of non-blanks>>         17416000
      MOVE P:=TEMP,(LEN),2;            <<leave new P>>                  17418000
      @P:=TOS;                                                          17420000
      P:=TAIL;                                                          17422000
      @P:=@P+1;                                                         17424000
                                                                        17426000
      END <<APPEND SUB>>;                                               17428000
   <<---------------------->>                                           17430000
                                                                        17432000
   MOVE DELIMS':=(1, " ");                                              17434000
   TEMP(8):=" ";                                                        17436000
                                                                        17438000
         <<place file.group.acct in PDIS...>>                           17440000
                                                                        17442000
   @P:=@PDIS;                                                           17444000
   APPEND (F', ".");                                                    17446000
   APPEND (G', ".");                                                    17448000
   APPEND (A', " ");                                                    17450000
                                                                        17452000
   DISPLAY'3'TO'STANDARD := DISPLAY'TO'STANDARD (PDIS, PSTD, ERROR,     17454000
                                                 CHAR'INX, DELIMS');    17456000
                                                                        17458000
   END <<DISPLAY'3'TO'STANDARD PROC>>;                                  17460000
$PAGE ";TITLES=  STANDARD FORM:   STANDARD'TO'DISPLAY"                  17462000
$CONTROL SEGMENT=TITLES                                                 17464000
<<***************************************************************>>     17466000
LOGICAL PROCEDURE STANDARD'TO'DISPLAY (PSTD, PDIS, ERROR, LEN);         17468000
            VALUE PSTD, PDIS;                                           17470000
            INTEGER ERROR, LEN;                                         17472000
            BYTE POINTER PSTD, PDIS;                                    17474000
   BEGIN                                                                17476000
   INTEGER                                                              17478000
      PART'LEN;                                                         17480000
   LABEL                                                                17482000
      XIT;                                                              17484000
   <<------------------>>                                               17486000
   SUBROUTINE ERR (N); VALUE N; INTEGER N;                              17488000
      BEGIN                                                             17490000
                                                                        17492000
      ERROR:=N;                                                         17494000
      STANDARD'TO'DISPLAY:=FAILED;                                      17496000
      GO XIT;                                                           17498000
                                                                        17500000
      END <<ERR SUB>>;                                                  17502000
   <<------------------->>                                              17504000
   SUBROUTINE APPEND'CHAR (CHAR); VALUE CHAR; BYTE CHAR;                17506000
      BEGIN                                                             17508000
                                                                        17510000
      PDIS(LEN):=CHAR;                                                  17512000
      LEN:=LEN+1;                                                       17514000
      IF LEN > MAX'TITLE'LEN THEN                                       17516000
         ERR (DE'STANDARD'TOO'LONG);                                    17518000
                                                                        17520000
      END <<APPEND'CHAR SUB>>;                                          17522000
   <<------------------>>                                               17524000
   SUBROUTINE APPEND'PART (CHAR, INX); VALUE CHAR, INX;                 17526000
            BYTE CHAR;                                                  17528000
            INTEGER INX;                                                17530000
      BEGIN                                                             17532000
                                                                        17534000
      IF CHAR <> " " THEN                                               17536000
         APPEND'CHAR (CHAR);                                            17538000
                                                                        17540000
      PART'LEN:=PSTD(INX).STD'PART'LENf;                                17542000
      WHILE PART'LEN > 0 DO                                             17544000
         BEGIN                                                          17546000
         INX:=INX+1;                                                    17548000
         PART'LEN:=PART'LEN-1;                                          17550000
         APPEND'CHAR (PSTD(INX));                                       17552000
         END;                                                           17554000
                                                                        17556000
      END <<APPEND'PART SUB>>;                                          17558000
   <<---------------------->>                                           17560000
                                                                        17562000
   ERROR:=0;                                                            17564000
                                                                        17566000
   LEN:=0;                                                              17568000
                                                                        17570000
   IF LOGICAL(STD'BACKREF) THEN                                         17572000
      APPEND'CHAR ("*")                                                 17574000
   ELSE IF LOGICAL(STD'DOLLAR) THEN                                     17576000
      APPEND'CHAR ("$");                                                17578000
                                                                        17580000
   IF STD'FILE'INX = 0 THEN                                             17582000
      ERR (DE'STANDARD'EMPTY)                                           17584000
   ELSE                                                                 17586000
      APPEND'PART (" ", STD'FILE'INX);                                  17588000
                                                                        17590000
   IF STD'LOCK'INX > 0 THEN                                             17592000
      APPEND'PART ("/", STD'LOCK'INX);                                  17594000
                                                                        17596000
   IF STD'GROUP'INX > 0 THEN                                            17598000
      APPEND'PART (".", STD'GROUP'INX);                                 17600000
                                                                        17602000
   IF STD'ACCT'INX > 0 THEN                                             17604000
      APPEND'PART (".", STD'ACCT'INX);                                  17606000
                                                                        17608000
   APPEND'CHAR (" ");                                                   17610000
   LEN:=LEN-1;                <<dont count trailing blank>>             17612000
                                                                        17614000
   STANDARD'TO'DISPLAY := GOOD;                                         17616000
                                                                        17618000
XIT:                                                                    17620000
                                                                        17622000
   END <<STANDARD'TO'DISPLAY PROC>>;                                    17624000
$PAGE ";TITLES=  STANDARD FORM:   STANDARD'TO'3'DISPLAY"                17626000
$CONTROL SEGMENT=TITLES                                                 17628000
<<***************************************************************>>     17630000
LOGICAL PROCEDURE STANDARD'TO'3'DISPLAY (PSTD, F', G', A', ERROR);      17632000
         VALUE PSTD;                                                    17634000
         INTEGER ERROR;                                                 17636000
         BYTE POINTER PSTD;                                             17638000
         BYTE ARRAY F', G', A';                                         17640000
   BEGIN                                                                17642000
                                                                        17644000
   INTEGER                                                              17646000
      LEN;                                                              17648000
                                                                        17650000
   EQUATE                                                               17652000
      MAX'PART'LEN = 8;                                                 17654000
                                                                        17656000
   LABEL                                                                17658000
      PROC'EXIT;                                                        17660000
                                                                        17662000
   <<-------------->>                                                   17664000
   SUBROUTINE FAIL (N); VALUE N; INTEGER N;                             17666000
                                                                        17668000
      BEGIN                                                             17670000
                                                                        17672000
      STANDARD'TO'3'DISPLAY:=FAILED;                                    17674000
                                                                        17676000
      ERROR:=N;                                                         17678000
                                                                        17680000
      GO PROC'EXIT;                                                     17682000
                                                                        17684000
      END <<FAIL SUB>>;                                                 17686000
   <<-------------->>                                                   17688000
                                                                        17690000
   ERROR:=0;                                                            17692000
   MOVE F':="        ";                                                 17694000
   MOVE G':=F',(8);                                                     17696000
   MOVE A':=F',(8);                                                     17698000
                                                                        17700000
   IF STD'FILE'INX > 0 THEN                                             17702000
      IF (LEN:=STD'FILE'LEN) > MAX'PART'LEN THEN                        17704000
         FAIL (DE'STANDARD'TOO'LONG)                                    17706000
      ELSE                                                              17708000
         MOVE F':=STD'FILE',(LEN);                                      17710000
                                                                        17712000
   IF STD'GROUP'INX > 0 THEN                                            17714000
      IF (LEN:=STD'GROUP'LEN) > MAX'PART'LEN THEN                       17716000
         FAIL (DE'STANDARD'TOO'LONG)                                    17718000
      ELSE                                                              17720000
         MOVE G':=STD'GROUP',(LEN);                                     17722000
                                                                        17724000
   IF STD'ACCT'INX > 0 THEN                                             17726000
      IF (LEN:=STD'ACCT'LEN) > MAX'PART'LEN THEN                        17728000
         FAIL (DE'STANDARD'TOO'LONG)                                    17730000
      ELSE                                                              17732000
         MOVE A':=STD'ACCT',(LEN);                                      17734000
                                                                        17736000
   STANDARD'TO'3'DISPLAY:=GOOD;                                         17738000
                                                                        17740000
PROC'EXIT:                                                              17742000
                                                                        17744000
   END <<STANDARD'TO'3'DISPLAY PROC>>;                                  17746000
$PAGE ";STORMISC=  CALL'SUDDENDEATH"                                    20000000
$CONTROL SEGMENT=STORMISC                                               20002000
<<****************************************************************>>    20004000
PROCEDURE CALL'SUDDENDEATH (ERR);                                       20006000
         VALUE ERR;                                                     20008000
         INTEGER ERR;                                                   20010000
         OPTION UNCALLABLE;                                             20012000
   BEGIN                                                                20014000
                                                                        20016000
   INTRINSIC                                                            20018000
      TERMINATE;                                                        20020000
                                                                        20022000
                                                                        20024000
   ERROR'CODE:=ERR;                                                     20026000
                                                                        20028000
   IF STORING THEN                                                      20030000
      SENDMESSAGE (SR'SUDDENDEATH)                                      20032000
   ELSE                                                                 20034000
      SENDMESSAGE (RS'SUDDENDEATH);                                     20036000
                                                                        20038000
   TERMINATE;                                                           20040000
                                                                        20042000
   END <<CALL'SUDDENDEATH PROC>>;                                       20044000
$PAGE ";STORMISC=  CHECK'STORE'RESTORE'LABEL"                           20046000
$CONTROL SEGMENT=STORMISC                                               20048000
<<***************************************************************>>     20050000
LOGICAL PROCEDURE CHECK'STORE'RESTORE'LABEL;                            20052000
         OPTION UNCALLABLE;                                             20054000
                                                                        20056000
         <<--------------------------------------------------->>        20058000
         << This routine is called to determine if the tape is          20060000
            a valid STORE/RESTORE tape.  The acceptable format          20062000
            is:                                                         20064000
                                                                        20066000
                  [misc]                                                20068000
                  eof                                                   20070000
                  [misc]                                                20072000
                  eof                                                   20074000
                  STORE/RESTORE LABEL-HP/3000.                          20076000
                     (note: the above text occupies words               20078000
                      0 thru 13 of the first record after the           20080000
                      second eof!)                                      20082000
                                                                        20084000
            After the "." in the above text, one of the                 20086000
            following 3 things may follow:                              20088000
                                                                        20090000
            Version#  Text       meaning                                20092000
            -------- -------  ---------------                           20094000
                                                                        20096000
               3     "VIIB+"  --> indicates a S/R tape of vintage       20098000
                                  MPE-IV (E MIT) thru ...?              20100000
               2     "VIIB"   --> indicates a S/R tape of vintage       20102000
                                  MPE2B thru MPE-IV (D MIT)             20104000
               1     other    --> indicates a pre-MPE2B S/R tape.       20106000
            -------------------------------------------------->>        20108000
   BEGIN                                                                20110000
                                                                        20112000
                                                                        20114000
   INTEGER                                                              20116000
      LEN         := 0;       <<length of data read>>                   20118000
                                                                        20120000
   LOGICAL                                                              20122000
      DO'FREAD    := FALSE;                                             20124000
                                                                        20126000
   LABEL                                                                20128000
      END'CHECK'STORE'RESTORE'LABEL;                                    20130000
                                                                        20132000
   <<-------->>                                                         20134000
   <<  FAIL  >>                                                         20136000
   <<-------->>                                                         20138000
                                                                        20140000
   SUBROUTINE FAIL (N);                                                 20142000
            VALUE   N;                                                  20144000
            INTEGER N;                                                  20146000
      BEGIN                                                             20148000
                                                                        20150000
      CHECK'STORE'RESTORE'LABEL:=FAILED;                                20152000
                                                                        20154000
      IF N <> 0 THEN                                                    20156000
         SENDMESSAGE (N);                                               20158000
                                                                        20160000
      GO END'CHECK'STORE'RESTORE'LABEL;                                 20162000
                                                                        20164000
      END <<FAIL SUB>>;                                                 20166000
                                                                        20168000
   <<------------->>                                                    20170000
   <<  FILE'FAIL  >>                                                    20172000
   <<------------->>                                                    20174000
                                                                        20176000
   SUBROUTINE FILE'FAIL (FID, N);                                       20178000
            VALUE        FID, N;                                        20180000
            INTEGER      FID, N;                                        20182000
      BEGIN                                                             20184000
                                                                        20186000
      PARMS'TEMPI'1 := ERROR'CODE;                             <<LB.RS>>20187800
                                                               <<LB.RS>>20187900
      IF FID = T'NUM AND USING'ATTIO THEN                      <<LB.RS>>20188000
         SENDMESSAGE (RS'ATTIO'ERROR)                          <<LB.RS>>20188200
      ELSE                                                     <<LB.RS>>20188300
         PRINT'FILE'ERROR (FID);                               <<LB.RS>>20188400
                                                               <<LB.RS>>20188500
                                                                        20190000
      FAIL (N);                                                         20192000
                                                                        20194000
      END <<FILE'FAIL SUB>>;                                            20196000
                                                                        20198000
   <<----------------->>                                                20200000
                                                                        20202000
   CHECK'STORE'RESTORE'LABEL:=GOOD;                                     20204000
   TAPE'VERSION:=VERSION'2;                                             20206000
                                                                        20208000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        20210000
   IF DEBUGGING THEN                                                    20212000
      BEGIN                                                             20214000
      SAY "STARTED CHECK'STORE'RESTORE'LABEL" ENDSAY;                   20216000
      SEND;                                                             20218000
      END;                                                              20220000
$IF                           <<DEBUGGING CODE>>                        20222000
                                                                        20224000
         << (position tape) read S/R label...>>                         20226000
                                                                        20228000
   IF LABELED THEN                                                      20230000
      BEGIN                                                             20232000
$IF X1=ON THEN                                                          20234000
      IF DEBUG'LAB'TAPE THEN                                            20236000
         BEGIN                                                          20238000
         SAY "ABOUT TO DO LRELSW IN CHECK'STORE'RESTORE'LABEL" ENDSAY;  20240000
         SEND;                                                          20242000
         END;                                                           20244000
$IF                                                                     20246000
      LRELSW (T'NUM);       <<turn on STORE tape flag>>                 20248000
      LEN:=TAPE'LABEL'SIZE;                                             20250000
$IF X1=ON THEN                                                          20252000
      IF DEBUG'LAB'TAPE THEN                                            20254000
         BEGIN                                                          20256000
         SAY "ABOUT TO DO FREADLABEL IN CHECK'STORE'RESTORE" ENDSAY;    20258000
         SEND;                                                          20260000
         END;                                                           20262000
$IF                                                                     20264000
      FREADLABEL (T'NUM, TAPE'LABEL, TAPE'LABEL'SIZE);                  20266000
      IF < THEN                                                         20268000
         FILE'FAIL (T'NUM, RS'T'READ'SR'LABEL);                         20270000
      END                                                               20272000
                                                                        20274000
   ELSE                                                                 20276000
      BEGIN                                                             20278000
         ISSUE'READ (TAPE'LABEL, TAPE'LABEL'SIZE + 1, TRUE);   <<LB.RS>>20280000
         LEN := READ'TAPE'LEN;                                 <<LB.RS>>20281000
                                                               <<LB.RS>>20282000
         IF ERROR'CODE <> 0 THEN                               <<LB.RS>>20284000
            FILE'FAIL (T'NUM, RS'T'READ'SR'LABEL);             <<LB.RS>>20286000
                                                               <<LB.RS>>20287000
         IF READ'TAPE'EOF THEN                                 <<LB.RS>>20288000
            BEGIN                                                       20290000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        20292000
            IF DEBUGGING THEN                                           20294000
               BEGIN                                                    20296000
               SAY "PROBABLY FIRST REEL OF STORE - FSF1 ALREADY DONE"   20298000
                                                             ENDSAY;    20300000
               SEND;                                                    20302000
               SAY "FSF2" ENDSAY;                                       20304000
               SEND;                                                    20306000
               END;                                                     20308000
$IF                           <<DEBUGGING CODE>>                        20310000
               REEL'1'MOUNTED := TRUE;                                  20312000
               ISSUE'SKIP (TRUE);                              <<LB.RS>>20314000
               IF ERROR'CODE <> 0 THEN                         <<LB.RS>>20315000
                  FILE'FAIL (T'NUM, RS'T'FSF'FAIL);            <<LB.RS>>20316000
               DO'FREAD := TRUE;                                        20318000
            END                                                         20320000
         ELSE IF LEN <> TAPE'LABEL'SIZE THEN                            20322000
            BEGIN                                                       20324000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        20326000
            IF DEBUGGING THEN                                           20328000
               BEGIN                                                    20330000
               SAY "SYSDUMP TAPE - FSF1" ENDSAY;                        20332000
               SEND;                                                    20334000
               END;                                                     20336000
$IF                           <<DEBUGGING CODE>>                        20338000
               REEL'1'MOUNTED := TRUE;                                  20340000
               ISSUE'SKIP (TRUE);                              <<LB.RS>>20342000
               IF ERROR'CODE <> 0 THEN                         <<LB.RS>>20343000
                  FILE'FAIL (T'NUM, RS'T'FSF'FAIL);            <<LB.RS>>20344000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        20346000
               IF DEBUGGING THEN                                        20348000
                  BEGIN                                                 20350000
                  SAY "FSF2" ENDSAY;                                    20352000
                  SEND;                                                 20354000
                  END;                                                  20356000
$IF                           <<DEBUGGING CODE>>                        20358000
               ISSUE'SKIP (TRUE);                              <<LB.RS>>20360000
               IF ERROR'CODE <> 0 THEN                         <<LB.RS>>20361000
                  FILE'FAIL (T'NUM, RS'T'FSF'FAIL);            <<LB.RS>>20362000
               DO'FREAD := TRUE;                                        20364000
            END;                                                        20366000
         IF DO'FREAD THEN                                               20368000
            BEGIN                                                       20370000
               ISSUE'READ (TAPE'LABEL,TAPE'LABEL'SIZE+1,TRUE); <<LB.RS>>20372000
               LEN := READ'TAPE'LEN;                           <<LB.RS>>20373000
                                                               <<LB.RS>>20374000
               IF ERROR'CODE <> 0 THEN                         <<LB.RS>>20376000
                  FILE'FAIL (T'NUM, RS'T'READ'SR'LABEL);       <<LB.RS>>20378000
                                                               <<LB.RS>>20379000
                                                                        20380000
               IF READ'TAPE'EOF THEN                           <<LB.RS>>20382000
                  FAIL (RS'T'GOT'EOF'NOT'SR'LABEL);            <<LB.RS>>20384000
            END;                                                        20386000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        20388000
      IF DEBUGGING THEN                                                 20390000
         BEGIN                                                          20392000
         SAY "   READ LEN=" ENDSAY;                                     20394000
         SAYNUM (LEN);                                                  20396000
         SAY ", TEXT = " ENDSAY;                                        20398000
         SEND;                                                          20400000
         SAY TAPE'LABEL',(LEN) ENDSAY;                                  20402000
         SEND;                                                          20404000
         END;                                                           20406000
$IF                           <<DEBUGGING CODE>>                        20408000
      IF LEN <> TAPE'LABEL'SIZE THEN                                    20410000
         FAIL (RS'T'BAD'SR'LABEL'RECSIZE);                              20412000
      END;                                                              20414000
                                                                        20416000
                                                                        20418000
   IF TAPE'LABEL' <> LABELTEXT THEN                                     20420000
      FAIL (RS'T'NOT'SR'LABEL);                                         20422000
                                                                        20424000
   IF TL'IIBID' = "VIIB+" THEN                                          20426000
      TAPE'VERSION:=VERSION'3                                           20428000
   ELSE IF TL'IIBID' = "VIIB" THEN                                      20430000
      TAPE'VERSION:=VERSION'2                                           20432000
   ELSE                                                                 20434000
      TAPE'VERSION:=VERSION'1;                                          20436000
                                                                        20438000
   << For labeled tapes, if the first file is a continuation of >>      20440000
   << a file started on the last reel, then that file preceeds  >>      20442000
   << the directory.  We must skip it.                          >>      20444000
   IF LABELED AND (TL'REELNUM <> 1) AND (TL'SPANTOG) THEN               20446000
      IF NEXTTAPEFILE(T'NUM) <> 0 THEN                                  20448000
         FAIL (RS'T'READ'SR'LABEL);                                     20450000
                                                                        20452000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        20454000
   IF DEBUGGING THEN                                                    20456000
      BEGIN                                                             20458000
      SAY "Version = " ENDSAY;                                          20460000
      SAYNUM (TAPE'VERSION);                                            20462000
      SEND;                                                             20464000
      END;                                                              20466000
$IF                           <<DEBUGGING CODE>>                        20468000
                                                                        20470000
END'CHECK'STORE'RESTORE'LABEL:                                          20472000
                                                                        20474000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        20476000
   IF DEBUGGING THEN                                                    20478000
      BEGIN                                                             20480000
      SAY "END CHECK'STORE'RESTORE'LABEL" ENDSAY;                       20482000
      SEND;                                                             20484000
      END;                                                              20486000
$IF                           <<DEBUGGING CODE>>                        20488000
                                                                        20490000
   END <<CHECK'STORE'RESTORE'LABEL PROC>>;                              20492000
$PAGE ";SECURITY=  CHECK'VALID'ACCT ... VALIDATES AN ACCOUNT"           20494000
$PAGE ";STORMISC=  CHECKSUM"                                            20496000
$CONTROL SEGMENT=STORMISC                                               20498000
<<***************************************************************>>     20500000
LOGICAL PROCEDURE CHECKSUM (BUFFER, LEN);                               20502000
         VALUE   LEN;                                                   20504000
         INTEGER LEN;                                                   20506000
         LOGICAL ARRAY BUFFER;                                          20508000
         OPTION UNCALLABLE;                                             20510000
   BEGIN                                                                20512000
                                                                        20514000
   LOGICAL                                                              20516000
      TEMP'CHECKSUM := -1;                                              20518000
                                                                        20520000
   WHILE (LEN:=LEN-1) >= 0 DO                                           20522000
      TEMP'CHECKSUM:=TEMP'CHECKSUM XOR BUFFER(LEN);                     20524000
                                                                        20526000
   CHECKSUM:=TEMP'CHECKSUM;                                             20528000
                                                                        20530000
   END <<CHECKSUM PROC>>;                                               20532000
$PAGE ";STORMISC=  CLOSE'FILES"                                         20534000
$CONTROL SEGMENT=STORMISC                                               20536000
<<***************************************************************>>     20538000
PROCEDURE CLOSE'FILES (NOSHUT);                                         20540000
         VALUE                NOSHUT;                                   20542000
         INTEGER              NOSHUT;                                   20544000
      <<Close all files if they are open except for the one             20546000
        specified by NOSHUT.   >>                                       20548000
   BEGIN                                                                20550000
                                                                        20552000
                                                                        20554000
   IF CANDIDAT <> 0 AND CANDIDAT <> NOSHUT THEN                         20556000
      FCLOSE (CANDIDAT, 0, 0);                                          20558000
                                                                        20560000
   IF E'NUM <> 0 AND E'NUM <> NOSHUT THEN                               20562000
         FCLOSE (E'NUM, 0, 0);                                          20564000
                                                                        20566000
   IF G'NUM <> 0 AND G'NUM <> NOSHUT THEN                               20568000
      FCLOSE (G'NUM, 0, 0);                                             20570000
                                                                        20572000
   IF I'NUM <> 0 AND I'NUM <> NOSHUT THEN                               20574000
      FCLOSE (I'NUM, 0, 0);                                             20576000
                                                                        20578000
   IF OFFLINE'NUM <> 0 AND OFFLINE'NUM <> NOSHUT THEN                   20580000
      FCLOSE (OFFLINE'NUM, 0, 0);                                       20582000
                                                                        20584000
   IF SYSLIST'NUM <> 0 AND SYSLIST'NUM <> NOSHUT                        20586000
            AND SYSLIST'NUM <> 2                                        20588000
            AND NOT SYSLIST'SUPPLIED THEN                               20590000
      FCLOSE (SYSLIST'NUM, 0, 0);                                       20592000
                                                                        20594000
   IF T'NUM <> 0 AND T'NUM <> NOSHUT THEN                               20596000
      FCLOSE (T'NUM, TAPE'CLOSE'DISP ,0);                      <<04726>>20598000
                                                                        20600000
   IF D'NUM <> 0 AND D'NUM <> NOSHUT THEN                               20602000
      FCLOSE (D'NUM, 0, 0);                                             20604000
                                                                        20606000
   END <<CLOSE'FILES PROC>>;                                            20608000
$PAGE ";STORMISC=  CONVERT'SE'TO'CIERR --- STANDARD FORM ERRORS"        20610000
$CONTROL SEGMENT=STORMISC                                               20612000
<<***************************************************************>>     20614000
INTEGER PROCEDURE CONVERT'SE'TO'CIERR (ERROR);                          20616000
         VALUE ERROR;                                                   20618000
         INTEGER ERROR;                                                 20620000
         OPTION UNCALLABLE;                                             20622000
   BEGIN                                                                20624000
         <<converts the STD'SE'... error number to the equivalent       20626000
           CI error number>>                                            20628000
                                                                        20630000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        20632000
   IF DEBUGGING THEN                                                    20634000
      BEGIN                                                             20636000
      SAY "CONVERT'SE'TO'CIERR (" ENDSAY;                               20638000
      SAYNUM (ERROR);                                                   20640000
      SAY ") --> " ENDSAY;                                              20642000
      END;                                                              20644000
$IF                           <<DEBUGGING CODE>>                        20646000
                                                                        20648000
   ERROR:=SR'SD'ERROR'BASE + ERROR;                                     20650000
                                                                        20652000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        20654000
   IF DEBUGGING THEN                                                    20656000
      BEGIN                                                             20658000
      SAYNUM (ERROR);                                                   20660000
      SEND;                                                             20662000
      END;                                                              20664000
$IF                           <<DEBUGGING CODE>>                        20666000
                                                                        20668000
   CONVERT'SE'TO'CIERR := ERROR;                                        20670000
                                                                        20672000
   END <<CONVERT'SE'TO'CIERR PROC>>;                                    20674000
$PAGE ";STORMISC=  DIRECTORYSEARCH --- SEARCHES DIRECTORY TREE"         20676000
$CONTROL SEGMENT=STORMISC                                               20678000
<<***************************************************************>>     20680000
LOGICAL PROCEDURE DIRECTORYSEARCH (THUNK);                              20682000
         LOGICAL PROCEDURE THUNK;                                       20684000
         OPTION UNCALLABLE;                                             20686000
      <<Assumes that a file title is in LOOK'TITLE' (standard           20688000
        form, with a group & account part ALWAYS specified!!).          20690000
        Calls PRODUCEPARMS to get the correct starting indices          20692000
        that DIRECSCAN requires.  Note that all parameters have         20694000
        already been parsed by the time this routine is called.>>       20696000
   BEGIN                                                                20698000
                                                                        20700000
                                                                        20702000
   DOUBLE                                                               20704000
      DR;                                                               20706000
                                                                        20708000
   INTEGER ARRAY                                                        20710000
      PPRESULT    (0:PPR'LEN);                                          20712000
                                                                        20714000
   INTEGER                                                              20716000
      DR'1        = DR+0,                                               20718000
      DR'2        = DR+1,                                               20720000
      ERR         := 0,       <<used for S->D, D->S>>                   20722000
      I,                                                                20724000
      J,                                                                20726000
      LEN,                                                              20728000
      MVTABX:=0,                                                        20730000
      TYPE;                                                             20732000
                                                                        20734000
   BYTE ARRAY                                                           20736000
      FILESET'    (0:MAX'TITLE'LEN+2),                                  20738000
      PPRESULT'   (*) = PPRESULT (0),                                   20740000
      SCRATCH'    (0:63);                                               20742000
                                                                        20744000
   BYTE POINTER                                                         20746000
      DELIM,                                                            20748000
      PP,                                                               20750000
      PSTD;                                                             20752000
                                                                        20754000
   LABEL                                                                20756000
      END'DIRECTORYSEARCH;                                              20758000
                                                                        20760000
   <<----------------------------->>                                    20762000
   <<  FAIL                       >>                                    20764000
   <<----------------------------->>                                    20766000
                                                                        20768000
   SUBROUTINE FAIL (N);                                                 20770000
            VALUE N;                                                    20772000
            INTEGER N;                                                  20774000
      BEGIN                                                             20776000
                                                                        20778000
      DIRECTORYSEARCH:=FAILED;                                          20780000
                                                                        20782000
      IF N <> 0 THEN                                                    20784000
         BEGIN                                                          20786000
         SENDMESSAGE (N);                                               20788000
         SENDMESSAGE (SR'WARN'DIRECTORYSEARCH'ERR);                     20790000
         END;                                                           20792000
                                                                        20794000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        20796000
      IF DEBUGGING THEN                                                 20798000
         BEGIN                                                          20800000
         SAY "DIRECTORYSEARCH FAIL # " ENDSAY;                          20802000
         SAYNUM (N);                                                    20804000
         SEND;                                                          20806000
         END;                                                           20808000
$IF                           <<DEBUGGING CODE>>                        20810000
                                                                        20812000
      GO END'DIRECTORYSEARCH;                                           20814000
                                                                        20816000
      END <<FAIL SUB>>;                                                 20818000
                                                                        20820000
   <<----------------------------->>                                    20822000
   << INITIALIZE'DIRECTORYSEARCH  >>                                    20824000
   <<----------------------------->>                                    20826000
                                                                        20828000
   SUBROUTINE INITIALIZE'DIRECTORYSEARCH;                               20830000
      BEGIN                                                             20832000
                                                                        20834000
      DIRECTORYSEARCH:=GOOD;                                            20836000
                                                                        20838000
            <<initialize some variables...>>                            20840000
                                                                        20842000
      MOUNTED'VOLUME'INFO := 0;                                         20844000
      SP'PV := 0;                                                       20846000
      @DELIM:=@SCRATCH';                                                20848000
      @PSTD:=@LOOK'TITLE';                                              20850000
                                                                        20852000
            <<and some arrays...>>                                      20854000
                                                                        20856000
      FILL' (SCRATCH', 32, " ");                                        20858000
      FILL (PPRESULT, PPR'LEN+1, 0);                                    20860000
                                                                        20862000
                                                                        20864000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        20866000
      IF DEBUGGING THEN                                                 20868000
         BEGIN                                                          20870000
         SAY "ENTERED DIRECTORYSEARCH"ENDSAY;                           20872000
         SEND;                                                          20874000
         END;                                                           20876000
$IF                           <<DEBUGGING CODE>>                        20878000
                                                                        20880000
            <<set up LOOK'FILE, LOOK'GROUP,  and LOOK'ACCT              20882000
              for DIRECSCAN...LOOK'LOCK already setup     >>            20884000
                                                                        20886000
            <<convert the standard form title in LOOK'TITLE'            20888000
              into 3 FILE'PART'SIZE byte arrays....>>                   20890000
                                                                        20892000
      STANDARD'TO'3'DISPLAY (LOOK'TITLE',                               20894000
            LOOK'FILE', LOOK'GROUP', LOOK'ACCT', ERR);                  20896000
                                                                        20898000
      IF LOOK'ACCT' = " " THEN                                          20900000
         MOVE CURR'ACCT':=LOGON'ACCT',(FILE'PART'SIZE)                  20902000
      ELSE                                                              20904000
         MOVE CURR'ACCT':=LOOK'ACCT',(FILE'PART'SIZE);                  20906000
                                                                        20908000
      IF LOOK'GROUP = " " THEN                                          20910000
         MOVE CURR'GROUP':=LOGON'GROUP',(FILE'PART'SIZE)                20912000
      ELSE                                                              20914000
         MOVE CURR'GROUP':=LOOK'GROUP',(FILE'PART'SIZE);                20916000
                                                                        20918000
      MOVE CURR'FILE':=LOOK'FILE',(FILE'PART'SIZE);                     20920000
                                                                        20922000
            <<convert CURR'FILE, 'GROUP, 'ACCT into std form...>>       20924000
                                                                        20926000
      DISPLAY'3'TO'STANDARD (CURR'FILE', CURR'GROUP', CURR'ACCT',       20928000
                             CURR'TITLE', ERROR'CODE);                  20930000
                                                                        20932000
            <<setup FILESET' for PRODUCEPARMS...>>                      20934000
                                                                        20936000
      IF STANDARD'TO'DISPLAY (LOOK'TITLE', FILESET', ERROR'CODE, LEN)   20938000
            = FAILED THEN                                               20940000
         FAIL (SR'S'2'D'FAILED);                                        20942000
                                                                        20944000
      MOVE FILESET'(LEN):=(";",%15);                                    20946000
                                                                        20948000
      END <<INITIALIZE'DIRECTORYSEARCH SUB>>;                           20950000
   <<------------------------------>>                                   20952000
                                                                        20954000
   INITIALIZE'DIRECTORYSEARCH;                                          20956000
                                                                        20958000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        20960000
   IF DEBUGGING AND FALSE THEN                                          20962000
      BEGIN                                                             20964000
      SAY "CALL PRODUCEPARMS...@FILESET'=" ENDSAY;                      20966000
      SAYOCTAL(@FILESET');                                              20968000
      SAY ", @DELIM=" ENDSAY;                                           20970000
      SAYOCTAL(@DELIM);                                                 20972000
      SEND;                                                             20974000
      SAY "   FILESET'=" ENDSAY;                                        20976000
      SAY FILESET',(LEN+2) ENDSAY;                                      20978000
      SEND;                                                             20980000
      END;                                                              20982000
$IF                           <<DEBUGGING CODE>>                        20984000
                                                                        20986000
   ERROR'CODE:=0;                                                       20988000
   DISABLE'ARITHMETIC'TRAPS;                                            20990000
                                                                        20992000
   TOS:=PRODUCEPARMS (0, FILESET', PPRESULT, DELIM, ERROR'CODE);        20994000
                                                                        20996000
   ENABLE'ARITHMETIC'TRAPS;                                             20998000
                                                                        21000000
   IF NOT TOS THEN                                                      21002000
      BEGIN                                                             21004000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        21006000
      IF DEBUGGING THEN                                                 21008000
         BEGIN                                                          21010000
         SAY "PRODUCEPARMS FAILED, ERR= #" ENDSAY;                      21012000
         SAYNUM(ERROR'CODE);                                            21014000
         SAY " @FILESET'=" ENDSAY; SAYOCTAL (@FILESET');                21016000
         SAY " @DELIM=" ENDSAY; SAYOCTAL (@DELIM);                      21018000
         SEND;                                                          21020000
         END;                                                           21022000
$IF                           <<DEBUGGING CODE>>                        21024000
      FAIL (SR'PRODUCEPARMS'FAILED);                                    21026000
      END;                                                              21028000
                                                                        21030000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        21032000
   IF DEBUGGING AND FALSE THEN                                          21034000
      BEGIN                                                             21036000
      SAY "ARET = " ENDSAY; SAYNUM(ERROR'CODE);                         21038000
      SEND;                                                             21040000
      SAY "@DELIM = " ENDSAY; SAYNUM(@DELIM);                           21042000
      SAY ", @SCRATCH' = " ENDSAY; SAYNUM(@SCRATCH');                   21044000
      SEND;                                                             21046000
      SAY "SCRATCH' = " ENDSAY; SAY SCRATCH',(31) ENDSAY;               21048000
      SEND;                                                             21050000
      SAY "PPRESULT = " ENDSAY;                                         21052000
      @PP:=@PPRESULT';                                                  21054000
      SAY "0    " ENDSAY;                                               21056000
      FOR I:=0 STEP 1 UNTIL PPR'LEN DO                                  21058000
         BEGIN                                                          21060000
         SAYOCTAL (PPRESULT(I));                                        21062000
         SAY " " ENDSAY;                                                21064000
         IF I MOD 4 = 2 THEN                                            21066000
            BEGIN                                                       21068000
            IF I=2 THEN                                                 21070000
               J:=6                                                     21072000
            ELSE                                                        21074000
               J:=8;                                                    21076000
            WHILE (J:=J-1) >= 0 DO                                      21078000
               BEGIN                                                    21080000
               IF PP=" " THEN                                           21082000
                  POUT:=" "                                             21084000
               ELSE IF PP=SPECIAL THEN                                  21086000
                  POUT:="."                                             21088000
               ELSE                                                     21090000
                  POUT:=PP;                                             21092000
               @POUT:=@POUT+1;                                          21094000
               @PP:=@PP+1;                                              21096000
               END;                                                     21098000
            SEND;                                                       21100000
            SAYNUM (I+1);                                               21102000
            @POUT:=@OUTPUTBUFFER'(5);                                   21104000
            END;                                                        21106000
         END;                                                           21108000
      SEND;                                                             21110000
      SEND;                                                             21112000
      END;                                                              21114000
$IF                           <<DEBUGGING CODE>>                        21116000
                                                                        21118000
   TYPE:=PPRESULT(2);                                                   21120000
   TYPE.(5:1):=1;             <<set HIT flag>>                          21122000
   TYPE.(13:3):=0;            <<set LEVEL for DIRECSCAN>>               21124000
   DR'1:=PPRESULT(0).MVTABXF; <<linkage  (??)>>                         21126000
   DR'2:=PPRESULT(1);         <<indexp   (??)>>                         21128000
   THUNK'STORE'ERR:=FALSE;                                              21130000
                                                                        21132000
   GET'SIRS (TRUE, FALSE);      <<get FISIR only>>                      21134000
                                                                        21136000
   DISABLE'ARITHMETIC'TRAPS;                                            21138000
                                                                        21140000
   DR:=DIRECSCAN (TYPE,                                                 21142000
                  DR,                                                   21144000
                  LOOK'ACCT,  <<Account name>>                          21146000
                  LOOK'GROUP, <<Group name>>                            21148000
                  LOOK'FILE,  <<File name>>                             21150000
                  THUNK,      <<routine>>                               21152000
                  MVTABX);                                              21154000
                                                                        21156000
   IF <> THEN                 <<problem with DIRECSCAN>>                21158000
      BEGIN                                                             21160000
                                                                        21162000
      ENABLE'ARITHMETIC'TRAPS;                                          21164000
      RELEASE'SIRS (GOT'FISIR, GOT'DSIR);                               21166000
                                                                        21168000
            <<dont report 'FILE NOT FOUND' or 'ACCT NOT                 21170000
              FOUND' or 'GROUP NOT FOUND' as an error...>>              21172000
                                                                        21174000
      IF DR'2 <> 2 OR NOT ( 0 <= DR'1 <= 2) THEN                        21176000
         FAIL (SR'DIRECTORY'ERROR)                                      21178000
                                                                        21180000
      ELSE IF SHOW'FLAG OR STD'WILD = 0 THEN                            21182000
         BEGIN                                                          21184000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        21186000
         IF DEBUGGING THEN                                              21188000
            BEGIN                                                       21190000
            SAY "DR'2 = 2, DR'1 = " ENDSAY; SAYNUM (DR'1);              21192000
            SEND;                                                       21194000
            SAY "LOOK = " ENDSAY; SAY'STANDARD(LOOK'TITLE');SEND;       21196000
            SAY "CURR = " ENDSAY; SAY'STANDARD(CURR'TITLE');SEND;       21198000
            END;                                                        21200000
$IF                           <<DEBUGGING CODE>>                        21202000
                                                                        21204000
         MOVE CURR'TITLE':=LOOK'TITLE', (MAX'STD'LEN);                  21206000
         IF DR'1 = 0 THEN                                               21208000
            SENDMESSAGE (M'NO'FILE)                                     21210000
         ELSE IF DR'1 = 1 THEN                                          21212000
            SENDMESSAGE (M'NO'GROUP)                                    21214000
         ELSE                                                           21216000
            SENDMESSAGE (M'NO'ACCT);                                    21218000
         END;                                                           21220000
      END                                                               21222000
                                                                        21224000
   ELSE                                                                 21226000
      BEGIN                                                             21228000
      RELEASE'SIRS (GOT'FISIR, GOT'DSIR);                               21230000
      ENABLE'ARITHMETIC'TRAPS;                                          21232000
      END;                                                              21234000
                                                                        21236000
   IF THUNK'STORE'ERR THEN                                              21238000
      FAIL (0);               <<already printed error msg>>             21240000
                                                                        21242000
END'DIRECTORYSEARCH:                                                    21244000
                                                                        21246000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        21248000
   IF DEBUGGING THEN                                                    21250000
      BEGIN                                                             21252000
      SAY "EXIT DIRECTORYSEARCH" ENDSAY;                                21254000
      SEND;                                                             21256000
      END;                                                              21258000
$IF                           <<DEBUGGING CODE>>                        21260000
                                                                        21262000
   END <<DIRECTORYSEARCH PROC>>;                                        21264000
$PAGE ";STORMISC=  DISMOUNT'PRIVATE'VOLUMES"                            21266000
$CONTROL SEGMENT=STORMISC                                               21268000
<<***************************************************************>>     21270000
PROCEDURE DISMOUNT'PRIVATE'VOLUMES;                                     21272000
                                                                        21274000
      <<DISMOUNT all private volumes mounted by STORE...                21276000
        done by rewinding and reading the PV file, which                21278000
        has one record per mount.  Entries in the file are              21280000
        accessed via the defines: pvinx'ACCT, pvinx'GROUP,              21282000
        and pvinx'PVINFO, which are declared globally.    >>            21284000
                                                                        21286000
   BEGIN                                                                21288000
                                                                        21290000
                                                                        21292000
   INTEGER ARRAY                                                        21294000
      PVBUF       (0:PV'RECSIZE-1);                                     21296000
                                                                        21298000
   INTEGER                                                              21300000
      HVSIND      := 0,       <<parameter to DISMOUNT>>                 21302000
      REC         := -1,      <<record # we are on, 0 based>>           21304000
      REQTYPE     := 0;       <<request type for DISMOUNT>>             21306000
                                                                        21308000
   LOGICAL                                                              21310000
      DONE        := FALSE;   <<TRUE when EOF hit on PV file>>          21312000
                                                                        21314000
   BYTE ARRAY                                                           21316000
      PVBUF'      (*) = PVBUF (0),                                      21318000
      SCRATCH'    (0:2*FILE'PART'SIZE+1);                               21320000
                                                                        21322000
   LABEL                                                                21324000
      END'DISMOUNT'PRIVATE'VOLUMES;                                     21326000
                                                                        21328000
   <<-------->>                                                         21330000
   <<  FAIL  >>                                                         21332000
   <<-------->>                                                         21334000
                                                                        21336000
   SUBROUTINE FAIL (N);                                                 21338000
            VALUE   N;                                                  21340000
            INTEGER N;                                                  21342000
                                                                        21344000
      BEGIN                                                             21346000
                                                                        21348000
      SENDMESSAGE (N);                                                  21350000
                                                                        21352000
      GO END'DISMOUNT'PRIVATE'VOLUMES;                                  21354000
                                                                        21356000
      END <<FAIL SUB>>;                                                 21358000
   <<--------------------->>                                            21360000
                                                                        21362000
                                                                        21364000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        21366000
   IF DEBUGGING THEN                                                    21368000
      BEGIN                                                             21370000
      SAY "DISMOUNT'PRIVATE'VOLUMES started" ENDSAY;                    21372000
      SEND;                                                             21374000
      END;                                                              21376000
$IF                           <<DEBUGGING CODE>>                        21378000
                                                                        21380000
   IF PV'NUM <= 0 THEN                                                  21382000
      RETURN;                                                           21384000
                                                                        21386000
   FPOINT (PV'NUM, 0D);       <<rewind the file>>                       21388000
                                                                        21390000
   IF <> THEN                                                           21392000
      FAIL (SR'PV'REWIND'FAIL);                                         21394000
                                                                        21396000
                                                                        21398000
   WHILE NOT DONE DO                                                    21400000
      BEGIN                                                             21402000
                                                                        21404000
      REC:=REC+1;                                                       21406000
                                                                        21408000
      FREAD (PV'NUM, PVBUF, PV'RECSIZE);                                21410000
                                                                        21412000
      IF <> THEN                                                        21414000
         DONE:=TRUE                                                     21416000
                                                                        21418000
      ELSE                                                              21420000
         BEGIN                                                          21422000
         REQTYPE:=CONDDISMOUNT'BIND;                                    21424000
         HVSIND:="* ";                                                  21426000
                                                                        21428000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        21430000
         IF DEBUGGING THEN                                              21432000
            BEGIN                                                       21434000
            SAY "dismount: " ENDSAY;                                    21436000
            SAY PVBUF', (2*FILE'PART'SIZE) ENDSAY;                      21438000
            SAY ", pvinfo = %" ENDSAY;                                  21440000
            SAYOCTAL (PVBUF(pvinx'PVINFO));                             21442000
            SEND;                                                       21444000
            END;                                                        21446000
$IF                           <<DEBUGGING CODE>>                        21448000
         DISMOUNT (HVSIND,                                              21450000
                   PVBUF(pvinx'GROUP),                                  21452000
                   PVBUF(pvinx'ACCT),                                   21454000
                   REQTYPE,                                             21456000
                   PVBUF(pvinx'PVINFO) );                               21458000
         IF <> THEN                                                     21460000
            BEGIN                                                       21462000
            MOVE SCRATCH':=PVBUF'(2*pvinx'GROUP),(FILE'PART'SIZE), 2;   21464000
            MOVE *:=".", 2;                                             21466000
            MOVE *:=PVBUF'(2*pvinx'ACCT),(FILE'PART'SIZE), 2;           21468000
            PARMS'TEMPI'1:=@SCRATCH';           <<byte pointer addr>>   21470000
            PARMS'TEMPI'2:=2*FILE'PART'SIZE+1;  <<length of text>>      21472000
            SENDMESSAGE (M'PV'DISMOUNT'FAIL);                           21474000
            END;                                                        21476000
         END;                                                           21478000
      END;                                                              21480000
                                                                        21482000
   IF PV'NUM <> 0 THEN                                                  21484000
      FCLOSE (PV'NUM, 0, 0);                                            21486000
                                                                        21488000
END'DISMOUNT'PRIVATE'VOLUMES:                                           21490000
                                                                        21492000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        21494000
   IF DEBUGGING THEN                                                    21496000
      BEGIN                                                             21498000
      SAY "end DISMOUNT'PRIVATE'VOLUMES" ENDSAY;                        21500000
      SEND;                                                             21502000
      END;                                                              21504000
$IF                           <<DEBUGGING CODE>>                        21506000
                                                                        21508000
   END <<DISMOUNT'PRIVATE'VOLUMES PROC>>;                               21510000
$PAGE ";STORMISC=  FILL --- FILLS WORD-ORIENTED ARRAYS WITH DATA"       21512000
$CONTROL SEGMENT=STORMISC                                               21514000
<<***************************************************************>>     21516000
PROCEDURE FILL (A, COUNT, WHAT);                                        21518000
         VALUE   COUNT, WHAT;                                           21520000
         LOGICAL COUNT, WHAT;                                           21522000
         INTEGER ARRAY A;                                               21524000
         OPTION UNCALLABLE;                                             21526000
                                                                        21528000
   BEGIN                                                                21530000
                                                                        21532000
   IF COUNT > 0 THEN                                                    21534000
      BEGIN                                                             21536000
      A(0):=WHAT;                                                       21538000
      IF COUNT > 1 THEN                                                 21540000
         MOVE A(1):=A(0),(COUNT-1);                                     21542000
      END;                                                              21544000
                                                                        21546000
   END <<FILL PROC>>;                                                   21548000
$PAGE ";STORMISC=  FILL' --- FILLS WORD-ORIENTED ARRAYS WITH DATA"      21550000
$CONTROL SEGMENT=STORMISC                                               21552000
<<***************************************************************>>     21554000
PROCEDURE FILL' (A', COUNT, WHAT);                                      21556000
         VALUE   COUNT, WHAT;                                           21558000
         LOGICAL COUNT;                                                 21560000
         BYTE ARRAY A';                                                 21562000
         BYTE    WHAT;                                                  21564000
         OPTION UNCALLABLE;                                             21566000
   BEGIN                                                                21568000
                                                                        21570000
   IF COUNT > 0 THEN                                                    21572000
      BEGIN                                                             21574000
      A'(0):=WHAT;                                                      21576000
      IF COUNT > 1 THEN                                                 21578000
         MOVE A'(1):=A'(0),(COUNT-1);                                   21580000
      END;                                                              21582000
                                                                        21584000
   END <<FILL' PROC>>;                                                  21586000
$PAGE ";STORMISC=  FIND'BLOCK'FACTOR --- FILE SIZE ROUTINE"             21588000
$CONTROL SEGMENT=STORMISC                                               21590000
<<***************************************************************>>     21592000
INTEGER PROCEDURE FIND'BLOCK'FACTOR (ERROR);                            21594000
         INTEGER ERROR;                                                 21596000
         OPTION UNCALLABLE;                                             21598000
   BEGIN                                                                21600000
                                                                        21602000
                                                                        21604000
   INTEGER                                                              21606000
      I;                                                                21608000
                                                                        21610000
   LOGICAL                                                              21612000
      BLKF,                   <<number of records per block>>           21614000
      BLKSIZE,                <<number of bytes in a block>>            21616000
      RECSIZE;                <<number of bytes in a record>>           21618000
                                                                        21620000
   DOUBLE                                                               21622000
      BLKSIZE'D,              <<number of bytes in a blk for RIO files>>21624000
      RECSIZE'D;              <<number of bytes in a rec for RIO files>>21626000
                                                                        21628000
   ERROR:=0;                                                            21630000
                                                                        21632000
   IF FLFOPTIONS.(2:3) = 2 THEN         << RIO file >>                  21634000
      BEGIN                                                             21636000
         << RIO files have a very special format.                       21638000
            At the end of each block is a bit map which                 21640000
            tells if each record in the block is allocated.             21642000
            The blocksize in bytes of a RIO file is                     21644000
               (recsize in bytes)*(blockfactor) + blockfactor/8         21646000
            So the blockfactor of a RIO file is                         21648000
               (8 * blksize in bytes) / ((8*recsize in bytes) + 1)    >>21650000
                                                                        21652000
                                                                        21654000
         BLKSIZE'D := DOUBLE(FLBLKSIZE) & DASL(3);                      21656000
         IF FLRECSIZE = 0 THEN RECSIZE'D := 256D                        21658000
         ELSE IF FLRECSIZE < 0 THEN RECSIZE'D:=DOUBLE(-FLRECSIZE)       21660000
         ELSE RECSIZE'D := DOUBLE (FLRECSIZE*2);                        21662000
         RECSIZE'D := (RECSIZE'D & DASL(3)) + 1D;                       21664000
         BLKF := INTEGER(BLKSIZE'D / RECSIZE'D);                        21666000
      END                                                               21668000
   ELSE IF FLFOPTIONS.(8:2) = 1 THEN     <<variable file...>>           21670000
      BLKF:=1                                                           21672000
                                                                        21674000
   ELSE                                                                 21676000
      BEGIN                                                             21678000
            <<get record size in positive bytes...>>                    21680000
                                                                        21682000
      IF (I:=FLRECSIZE) < 0 THEN                                        21684000
         RECSIZE:=LOGICAL(\I\)      <<convert to positive>>             21686000
      ELSE IF I = 0 THEN                                                21688000
         RECSIZE:=256               <<zero implies 1 sector  ??!!>>     21690000
      ELSE                                                              21692000
         RECSIZE:=LOGICAL(I)*2;     <<convert words to bytes>>          21694000
                                                                        21696000
            <<convert bytes to higher even value, if odd...>>           21698000
                                                                        21700000
      IF RECSIZE MOD 2 = 1 THEN                                         21702000
         RECSIZE:=RECSIZE+1;        <<note: doesnt assume               21704000
                                      any particular bit layout!>>      21706000
                                                                        21708000
            <<convert blocksize to positive bytes, divide by            21710000
              recsize ... this give the blocking factor                 21712000
              ...should be an integer !!>>                              21714000
                                                                        21716000
      BLKSIZE:=FLBLKSIZE*2;                                             21718000
                                                                        21720000
      BLKF:=LOGICAL(BLKSIZE/RECSIZE);  <<# of records per block>>       21722000
                                                                        21724000
      IF BLKF * RECSIZE <> BLKSIZE THEN                                 21726000
         BEGIN                                                          21728000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        21730000
         IF DEBUGGING THEN                                              21732000
            BEGIN                                                       21734000
            SAY "   FLBLKSIZE=" ENDSAY; SAYNUM(FLBLKSIZE);              21736000
                                SAY " words" ENDSAY;       SEND;        21738000
            SAY "   BLKSIZE  =" ENDSAY; SAYNUM(BLKSIZE);                21740000
                                SAY " bytes" ENDSAY;       SEND;        21742000
            SAY "   FLRECSIZE=" ENDSAY; SAYNUM(FLRECSIZE);              21744000
                                SAY " -bytes?" ENDSAY;     SEND;        21746000
            SAY "   RECSIZE  =" ENDSAY; SAYNUM(RECSIZE);                21748000
                                SAY " bytes" ENDSAY;       SEND;        21750000
            SAY "   BLKF     =" ENDSAY; SAYNUM(BLKF);                   21752000
                                SAY " records" ENDSAY;     SEND;        21754000
            SAY "   BLKF*RCSZ=" ENDSAY; SAYNUM(BLKF*RECSIZE);           21756000
                                SAY " records" ENDSAY;     SEND;        21758000
            END;                                                        21760000
$IF                           <<DEBUGGING CODE>>                        21762000
                                                                        21764000
         ERROR:=1;                  <<non-integral block factor>>       21766000
         END;                                                           21768000
                                                                        21770000
      END;                                                              21772000
                                                                        21774000
   FIND'BLOCK'FACTOR:=BLKF;                                             21776000
                                                                        21778000
   END <<FIND'BLOCK'FACTOR PROC>>;                                      21780000
$PAGE ";STORMISC=  FIND'FILE'SIZE --- FILE SIZE ROUTINE"                21782000
$CONTROL SEGMENT=STORMISC                                               21784000
<<***************************************************************>>     21786000
DOUBLE PROCEDURE FIND'FILE'SIZE (TYP, EXTENT'SIZES'D);                  21788000
         VALUE   TYP;                                                   21790000
         INTEGER TYP;                                                   21792000
         DOUBLE ARRAY EXTENT'SIZES'D;                                   21794000
<<--------------------------------------------------------------->>     21796000
<< FIND'FILE'SIZE calculates the size of a file in sectors.       >>    21798000
<< It is passed the file label and an option (TYP) that tells it  >>    21800000
<< whether to determine the number of sectors in use (used by     >>    21802000
<< STORE) or the number of sectors allocated (used by RESTORE).   >>    21804000
<<                                                                >>    21806000
<< TYP defaults to FILE'SIZE'MINv, which is what STORE passes.    >>    21808000
<<                                                                >>    21810000
<< The EXTENT'SIZES'D array will be filled with the size of each  >>    21812000
<< allocated extent.                                              >>    21814000
<<---------------------------------------------------------------->>    21816000
                                                                        21818000
   BEGIN                                                                21820000
                                                                        21822000
                                                                        21824000
   DOUBLE                                                               21826000
      BLKS,                   <<number of blocks in the file>> <<06124>>21827000
      D,                                                                21828000
      SECTORS'MAX,                                                      21830000
      SECTORS'MIN;                                                      21832000
                                                                        21834000
   INTEGER                                                              21836000
      EOF'EXTENT'SIZE,                                                  21838000
      EOF'EXTENTS,                                                      21840000
      I,                                                                21842000
      LAST'EXTENT'SEEN;       <<last allocated extent>>                 21844000
                                                                        21846000
   LOGICAL                                                              21848000
      BLKF,                   <<number of records per block>>           21850000
      SECTORS'PER'BLOCK;                                                21854000
                                                                        21856000
   DOUBLE POINTER                                                       21858000
      FL'EXTMAP'D   := @FLEXTMAP'D;                                     21860000
                                                                        21862000
   <<-------------------->>                                             21864000
   <<  FIND'MAX'FILESIZE >>                                             21866000
   <<-------------------->>                                             21868000
                                                                        21870000
   SUBROUTINE FIND'MAX'FILESIZE;                                        21872000
                                                                        21874000
      BEGIN                                                             21876000
                                                                        21878000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        21880000
      IF DEBUGGING THEN                                                 21882000
         BEGIN                                                          21884000
         SAY "   Find max sectors = " ENDSAY;                           21886000
         END;                                                           21888000
$IF                           <<DEBUGGING CODE>>                        21890000
                                                                        21892000
      I:=-1;                                                            21894000
      LAST'EXTENT'SEEN:=0;                                              21896000
      SECTORS'MAX:=0D;                                                  21898000
      D:=FLEXTSIZE'D;                                                   21900000
                                                                        21902000
            <<loop running I from 0 to FLNUMEXTS ...                    21904000
              note that if we have, say, 5 extents in a                 21906000
              file FLNUMEXTS = 4.                  >>                   21908000
                                                                        21910000
      WHILE (I:=I+1) <= FLNUMEXTS DO                                    21912000
         BEGIN                                                          21914000
         IF FL'EXTMAP'D (I) <> 0D THEN                                  21916000
            BEGIN                                                       21918000
                  <<if this is the last extent, change D                21920000
                    to be FLLASTEXTSIZE...               >>             21922000
                                                                        21924000
            IF I = FLNUMEXTS THEN                                       21926000
               D:=FLLASTEXTSIZE'D;                                      21928000
                                                                        21930000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        21932000
      IF DEBUGGING THEN                                                 21934000
         BEGIN                                                          21936000
         SAY "(FLEXTSIZE = " ENDSAY;                                    21938000
         SAYDNUM (D);                                                   21940000
         SAY1 (")");                                                    21942000
         SEND;                                                          21944000
         END;                                                           21946000
$IF                           <<DEBUGGING CODE>>                        21948000
                                                                        21950000
            EXTENT'SIZES'D(I):=D;                                       21952000
            SECTORS'MAX:=SECTORS'MAX + D;                               21954000
            LAST'EXTENT'SEEN:=I;                                        21956000
            END;                                                        21958000
         END;                                                           21960000
                                                                        21962000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        21964000
      IF DEBUGGING THEN                                                 21966000
         BEGIN                                                          21968000
         SAYDNUM (SECTORS'MAX);                                         21970000
         SEND;                                                          21972000
         END;                                                           21974000
$IF                           <<DEBUGGING CODE>>                        21976000
                                                                        21978000
      END <<FIND'MAX'FILESIZE SUB>>;                                    21980000
                                                                        21982000
   <<--------------------->>                                            21984000
   <<  FIND'MIN'FILESIZE  >>                                            21986000
   <<--------------------->>                                            21988000
                                                                        21990000
   SUBROUTINE FIND'MIN'FILESIZE;                                        21992000
                                                                        21994000
      BEGIN                                                             21996000
                                                                        21998000
      FIND'MAX'FILESIZE;      <<fills EXTENT'SIZES'D array>>            22000000
                                                                        22002000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        22004000
      IF DEBUGGING THEN                                                 22006000
         BEGIN                                                          22008000
         SAY "   Find min sectors = " ENDSAY;                           22010000
         END;                                                           22012000
$IF                           <<DEBUGGING CODE>>                        22014000
                                                                        22016000
      IF FLFOPTIONS.(08:02) = 1 THEN                                    22018000
         BEGIN                         <<variable format file>>         22020000
         SECTORS'MIN:=SECTORS'MAX;                                      22022000
         RETURN;                                                        22024000
         END;                                                           22026000
                                                                        22028000
      BLKF:=FIND'BLOCK'FACTOR (I);                                      22030000
                                                                        22032000
      D:=FLEOF;                        <<not variable format file.>>    22034000
                                                                        22036000
                                                                        22038000
      BLKS:=D / DOUBLE (BLKF);          <<number of blocks>>   <<06124>>22040000
      IF (D MOD DOUBLE(BLKF)) <> 0D THEN                       <<06124>>22042000
         BLKS:=BLKS+1D;       <<last block is partially full>> <<06124>>22044000
                                                                        22046000
      SECTORS'PER'BLOCK:=(FLBLKSIZE+127)/128;                           22048000
                                                                        22050000
      SECTORS'MIN:= BLKS                                       <<06124>>22052000
                      * DOUBLE(LOGICAL(SECTORS'PER'BLOCK))              22054000
                      + DOUBLE(LOGICAL(FLSECTOFF));                     22056000
                                                                        22058000
          << The following code has been added to FIND'MIN'FILESIZE >>  22060000
          << to avoid including non-allocated extents.  The code    >>  22062000
          << finds the extent in which eof occurs and how far into  >>  22064000
          << that extent the eof occurs.  Then it loops subtracting >>  22066000
          << non-allocated extents                                  >>  22068000
                                                                        22070000
                                                                        22072000
      EOF'EXTENTS := ((SECTORS'MIN - 1D) // FLEXTSIZE'L);               22074000
      EOF'EXTENT'SIZE := ((SECTORS'MIN - 1D) MODD FLEXTSIZE'L) + 1;     22076000
                                                                        22078000
      I := -1;                                                          22080000
      WHILE (I:=I+1) < EOF'EXTENTS DO                                   22082000
         IF EXTENT'SIZES'D (I) = 0D THEN                                22084000
            SECTORS'MIN := SECTORS'MIN - FLEXTSIZE'D;                   22086000
                                                                        22088000
      IF EXTENT'SIZES'D (EOF'EXTENTS) = 0D THEN                         22090000
          SECTORS'MIN := SECTORS'MIN - DOUBLE (EOF'EXTENT'SIZE);        22092000
                                                                        22094000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        22096000
      IF DEBUGGING THEN                                                 22098000
         BEGIN                                                          22100000
         SAYDNUM (SECTORS'MIN);                                         22102000
         SEND;                                                          22104000
         END;                                                           22106000
$IF                           <<DEBUGGING CODE>>                        22108000
                                                                        22110000
      END <<FIND'MIN'FILESIZE SUB>>;                                    22112000
   <<----------------------------->>                                    22114000
                                                                        22116000
   I:=32;                                                               22118000
   WHILE (I:=I-1) >= 0 DO                                               22120000
      EXTENT'SIZES'D(I):=0D;                                            22122000
                                                                        22124000
   IF TYP = FILE'SIZE'MAXv THEN                                         22126000
      BEGIN                                                             22128000
      FIND'MAX'FILESIZE;                                                22130000
      FIND'FILE'SIZE:=SECTORS'MAX;                                      22132000
      END                                                               22134000
                                                                        22136000
   ELSE <<IF TYP = FILE'SIZE'MINv THEN>>                                22138000
      BEGIN                                                             22140000
      FIND'MIN'FILESIZE;                                                22142000
      FIND'FILE'SIZE:=SECTORS'MIN;                                      22144000
      END;                                                              22146000
                                                                        22148000
   END <<FIND'FILE'SIZE PROC>>;                                         22150000
$PAGE ";STORMISC=  FKONTROL --- ROUTINE TO DO FCONTROLS"                22152000
$CONTROL SEGMENT=STORMISC                                               22154000
<<***************************************************************>>     22156000
LOGICAL PROCEDURE FKONTROL (FID, WHAT);                                 22158000
         VALUE   WHAT;                                                  22160000
         INTEGER WHAT, FID;                                             22162000
                                                                        22164000
   BEGIN                                                                22166000
                                                                        22168000
   INTEGER                                                              22170000
      DUMMY'I        := 0;                                     <<05016>>22172000
                                                                        22174000
   FKONTROL:=GOOD;                                                      22176000
                                                                        22178000
   FCONTROL (FID, WHAT, DUMMY'I);                                       22180000
   IF <> OR (WHAT = WEOF) THEN                                 <<05016>>22180900
      FCHECK (FID, DUMMY'I);                                   <<05016>>22181000
   IF DUMMY'I = FS'ERR'RECOVERED THEN                          <<04102>>22181100
      DUMMY'I := 0;                                            <<04102>>22181200
                                                                        22182000
   IF DUMMY'I <> 0 THEN                                        <<04102>>22184000
      BEGIN                                                             22186000
                                                                        22188000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        22190000
      IF DEBUGGING THEN                                                 22192000
         BEGIN                                                          22194000
         SAY "FKONTROL (" ENDSAY;                                       22196000
         SAYNUM (FID);                                                  22198000
         SAY ", %" ENDSAY;                                              22200000
         SAYOCTAL (WHAT);                                               22202000
         SAY ") failed!...file info = " ENDSAY;                         22204000
         SEND;                                                          22206000
         END;                                                           22208000
$IF                           <<DEBUGGING CODE>>                        22210000
      FKONTROL:=FAILED;                                                 22212000
      END;                                                              22214000
                                                                        22216000
   END <<FKONTROL PROC>>;                                               22218000
$PAGE ";STORMISC=  GET'SIRS --- GETS FILE INTEGRITY & DIRECTORY SIRS"   22220000
$CONTROL SEGMENT=STORMISC                                               22222000
<<***************************************************************>>     22224000
PROCEDURE GET'SIRS (WANT'FISIR, WANT'DSIR);                             22226000
         VALUE WANT'FISIR, WANT'DSIR;                                   22228000
         LOGICAL WANT'FISIR, WANT'DSIR;                                 22230000
         OPTION UNCALLABLE;                                             22232000
                                                                        22234000
   BEGIN                                                                22236000
                                                                        22238000
                                                                        22240000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        22242000
   IF DEBUG'SIRS THEN                                                   22244000
      BEGIN                                                             22246000
      SAY "GET'SIRS (" ENDSAY; SAYNUM(WANT'FISIR.(15:01));              22248000
      SAY ", " ENDSAY; SAYNUM (WANT'DSIR.(15:01)); SAY1 (")");          22250000
      SAY "   have: " ENDSAY;                                           22252000
      IF GOT'FISIR THEN SAY "FISIR  " ENDSAY;                           22254000
      IF GOT'DSIR THEN BEGIN SAY "DSIR (info=" ENDSAY;                  22256000
         SAYNUM (DSIR'INFO); SAY1 (")"); END;                           22258000
      SEND;                                                             22260000
      DEBUG;                                                            22262000
      END;                                                              22264000
$IF                           <<DEBUGGING CODE>>                        22266000
                                                                        22268000
   IF WANT'FISIR AND GOT'DSIR AND NOT GOT'FISIR THEN                    22270000
      BEGIN                                                             22272000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        22274000
      IF DEBUGGING THEN                                                 22276000
         BEGIN                                                          22278000
         SAY "   WANT'FISIR, GOT DSIR...RELEASING DSIR" ENDSAY;         22280000
         SEND;                                                          22282000
         END;                                                           22284000
$IF                           <<DEBUGGING CODE>>                        22286000
      RELSIR (DSIR, DSIR'INFO);                                         22288000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        22290000
      IF DEBUG'SIRS THEN                                                22292000
         BEGIN                                                          22294000
         SAY "released" ENDSAY;                                         22296000
         SEND;                                                          22298000
         DEBUG;                                                         22300000
         END;                                                           22302000
$IF                           <<DEBUGGING CODE>>                        22304000
      GOT'DSIR:=FALSE;                                                  22306000
      WANT'DSIR:=TRUE;                                                  22308000
      END;                                                              22310000
                                                                        22312000
   IF WANT'FISIR THEN                                                   22314000
      BEGIN                                                             22316000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        22318000
      IF DEBUGGING THEN                                                 22320000
         BEGIN                                                          22322000
         SAY "   GETSIR (FISIR)" ENDSAY;                                22324000
         SEND;                                                          22326000
         END;                                                           22328000
$IF                           <<DEBUGGING CODE>>                        22330000
      IF GOT'FISIR THEN                                                 22332000
         BEGIN                                                          22334000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        22336000
         IF DEBUGGING THEN                                              22338000
            BEGIN                                                       22340000
            SAY "...already had it!" ENDSAY;                            22342000
            END;                                                        22344000
$IF                           <<DEBUGGING CODE>>                        22346000
         END                                                            22348000
      ELSE                                                              22350000
         FISIR'INFO:=GETSIR(FISIR);                                     22352000
      GOT'FISIR:=TRUE;                                                  22354000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        22356000
      IF DEBUGGING THEN                                                 22358000
         BEGIN                                                          22360000
         SAY "...got FISIR!" ENDSAY;                                    22362000
         SEND;                                                          22364000
         IF DEBUG'SIRS THEN DEBUG;                                      22366000
         END;                                                           22368000
$IF                           <<DEBUGGING CODE>>                        22370000
      END;                                                              22372000
                                                                        22374000
   IF WANT'DSIR THEN                                                    22376000
      BEGIN                                                             22378000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        22380000
      IF DEBUGGING THEN                                                 22382000
         BEGIN                                                          22384000
         SAY "   GETSIR (DSIR)" ENDSAY;                                 22386000
         SEND;                                                          22388000
         END;                                                           22390000
$IF                           <<DEBUGGING CODE>>                        22392000
      IF GOT'DSIR THEN                                                  22394000
         BEGIN                                                          22396000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        22398000
         IF DEBUGGING THEN                                              22400000
            BEGIN                                                       22402000
            SAY "...already had it!" ENDSAY;                            22404000
            END;                                                        22406000
$IF                           <<DEBUGGING CODE>>                        22408000
         END                                                            22410000
      ELSE                                                              22412000
         DSIR'INFO:=GETSIR(DSIR);                                       22414000
      GOT'DSIR:=TRUE;                                                   22416000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        22418000
      IF DEBUGGING THEN                                                 22420000
         BEGIN                                                          22422000
         SAY "...got DSIR!" ENDSAY;                                     22424000
         SEND;                                                          22426000
         IF DEBUG'SIRS THEN DEBUG;                                      22428000
         END;                                                           22430000
$IF                           <<DEBUGGING CODE>>                        22432000
      END;                                                              22434000
                                                                        22436000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        22438000
   IF DEBUG'SIRS THEN                                                   22440000
      BEGIN                                                             22442000
      SAY "   got the sirs" ENDSAY;                                     22444000
      SEND;                                                             22446000
      DEBUG;                                                            22448000
      END;                                                              22450000
$IF                           <<DEBUGGING CODE>>                        22452000
                                                                        22454000
   END <<GET'SIRS PROC>>;                                               22456000
$PAGE ";STOREMISC= JOIN'CONTIGUOUS'EXTENTS"                             22458000
$CONTROL SEGMENT=STORMISC                                               22460000
PROCEDURE JOIN'CONTIGUOUS'EXTENTS (NUM'DISJ'EXTS, DISJ'EXT'ADDR,        22462000
                                   DISJ'EXT'LEN , ORIG'EXTMAP,          22464000
                                   ORIG'NUM'EXTENTS, EXTSIZE,  <<LB.RS>>22466000
                                   LAST'EXTSIZE);              <<LB.RS>>22467000
   VALUE ORIG'NUM'EXTENTS, EXTSIZE, LAST'EXTSIZE;              <<LB.RS>>22468000
   INTEGER NUM'DISJ'EXTS, ORIG'NUM'EXTENTS;                             22470000
   DOUBLE ARRAY                                                         22472000
      DISJ'EXT'ADDR,                                                    22474000
      DISJ'EXT'LEN,                                                     22476000
      ORIG'EXTMAP;                                                      22478000
   DOUBLE                                                      <<LB.RS>>22478100
      EXTSIZE,                                                 <<LB.RS>>22478200
      LAST'EXTSIZE;                                            <<LB.RS>>22478300
   OPTION UNCALLABLE;                                                   22480000
                                                                        22482000
<<                                                                      22484000
   This procedure takes all occurences of two or more contiguous        22486000
   extents and joins them together to create a new extent map.          22488000
   This extent map is returned in DISJ'EXT'ADDR.  Since the length      22490000
   of the newly formed extents may differ the lengths of each           22492000
   extent is returned in DISJ'EXT'LEN.  The number of the new           22494000
   extents is returned in NUM'DISJ'EXTS.  The original extent map       22496000
   is passed in ORIG'EXTMAP.                                            22498000
>>                                                                      22500000
                                                                        22502000
BEGIN                                                                   22504000
   INTEGER I;                                                           22506000
                                                                        22508000
   NUM'DISJ'EXTS := 0;                                                  22510000
   DISJ'EXT'ADDR (0) := ORIG'EXTMAP (0);                                22512000
   DISJ'EXT'LEN  (0) := EXTSIZE;                               <<LB.RS>>22514000
                                                                        22516000
   I := 0;                                                              22518000
   WHILE ( I:=I+1 ) < ORIG'NUM'EXTENTS DO                               22520000
      BEGIN                                                             22522000
         IF ORIG'EXTMAP (I-1) + EXTSIZE = ORIG'EXTMAP (I) THEN <<LB.RS>>22524000
            IF I = ORIG'NUM'EXTENTS - 1 THEN                   <<LB.RS>>22526000
               DISJ'EXT'LEN (NUM'DISJ'EXTS) :=                          22528000
                  DISJ'EXT'LEN (NUM'DISJ'EXTS) + LAST'EXTSIZE  <<LB.RS>>22530000
            ELSE                                                        22532000
               DISJ'EXT'LEN (NUM'DISJ'EXTS) :=                          22534000
                  DISJ'EXT'LEN (NUM'DISJ'EXTS) + EXTSIZE       <<LB.RS>>22536000
         ELSE IF ORIG'EXTMAP (I) <> 0D THEN                             22538000
            BEGIN                                                       22540000
               NUM'DISJ'EXTS := NUM'DISJ'EXTS + 1;                      22542000
               DISJ'EXT'ADDR (NUM'DISJ'EXTS) := ORIG'EXTMAP (I);        22544000
               IF I = ORIG'NUM'EXTENTS - 1 THEN                <<LB.RS>>22546000
                  DISJ'EXT'LEN (NUM'DISJ'EXTS) := LAST'EXTSIZE <<LB.RS>>22548000
               ELSE                                                     22550000
                  DISJ'EXT'LEN (NUM'DISJ'EXTS) := EXTSIZE;     <<LB.RS>>22552000
            END;                                                        22554000
      END;                                                              22556000
                                                                        22558000
$IF X1=ON THEN                                                          22560000
   IF DEBUGGING THEN                                                    22562000
      BEGIN                                                             22564000
         I := -1;                                                       22566000
         WHILE (I:=I+1) <= NUM'DISJ'EXTS DO                             22568000
            BEGIN                                                       22570000
               SAY "DISJOINT EXTENT #" ENDSAY;                          22572000
               SAYNUM (I);                                              22574000
               SAY " AT ADDRESS %" ENDSAY;                              22576000
               SAYDOCTAL (DISJ'EXT'ADDR(I));                            22578000
               SAY " FOR " ENDSAY;                                      22580000
               SAYDNUM (DISJ'EXT'LEN(I));                               22582000
               SEND;                                                    22584000
            END;                                                        22586000
      END;                                                              22588000
$IF                                                                     22590000
END;                                                                    22592000
$PAGE ";STORMISC=  LOCK'UNLOCK'FILE --- FILE LABEL ROUTINES"            22594000
$CONTROL SEGMENT=STORMISC                                               22596000
<<***************************************************************>>     22598000
LOGICAL PROCEDURE LOCK'UNLOCK'FILE (SETTING, LDEV,                      22600000
                                    ADDRESS, GOTIT);                    22602000
         VALUE GOTIT, LDEV, SETTING, ADDRESS;                           22604000
         INTEGER LDEV, SETTING;                                         22606000
         LOGICAL GOTIT;                                                 22608000
         DOUBLE ADDRESS;                                                22610000
         OPTION PRIVILEGED, UNCALLABLE;                                 22612000
                                                                        22614000
      << This routine attempts to set the STORE bit in the              22616000
         file label to SETTING, which is either UNLOCK'FILE or          22618000
         LOCK'FILE.                                                     22620000
         To accomplish this, it is passed the ldev and address          22622000
         of the disc to read/write.                                     22624000
         It is also passed an array in which to stuff the               22626000
         file label.                                                    22628000
         If GOTIT is TRUE, then we already have the file SIR.           22630000
         If the setting of the store bit fails for any reason,          22632000
         a result of FAILED is returned.                                22634000
         >>                                                             22636000
   BEGIN                                                                22638000
                                                                        22640000
                                                                        22642000
   DOUBLE                                                               22644000
      IOB;                                                              22646000
                                                                        22648000
   INTEGER                                                              22650000
      LOCAL'FISIR'INFO,                                                 22652000
      X           := 0;       <<used by FLAB'CHECKSUM>>                 22654000
                                                                        22656000
   LOCK'UNLOCK'FILE:=FAILED;                                            22658000
                                                                        22660000
   IF NOT GOTIT THEN                                                    22662000
      LOCAL'FISIR'INFO:=GETSIR (FISIR);      <<Get file label SIR>>     22664000
                                                                        22666000
         <<read the file label from disc...>>                           22668000
                                                                        22670000
   IF READ'LABEL (LDEV, ADDRESS, GOT'SIR) = FAILED THEN                 22672000
      BEGIN                                                             22674000
      IF NOT GOTIT THEN                                                 22676000
         RELSIR (FISIR, LOCAL'FISIR'INFO);   <<Release label SIR>>      22678000
      RETURN;                                                           22680000
      END;                                                              22682000
                                                                        22684000
   FLSTORE:=SETTING;        <<lock/unlock file>>                        22686000
                                                                        22688000
   IF UPDATE'TOG THEN                                                   22690000
      FLLASTACC:=TODAYS'DATE;                                           22692000
                                                                        22694000
   FLAB'CHECKSUM;                                                       22696000
                                                                        22698000
         <<write the file label to disc...>>                            22700000
                                                                        22702000
   LOCK'UNLOCK'FILE:=                                                   22704000
      WRITE'LABEL (LDEV, ADDRESS, GOT'SIR);                             22706000
                                                                        22708000
   IF NOT GOTIT THEN                                                    22710000
      RELSIR (FISIR, LOCAL'FISIR'INFO);      <<Release label SIR>>      22712000
                                                                        22714000
   END <<LOCK'UNLOCK'FILE PROC>>;                                       22716000
$PAGE ";STORMISC=  MOVE'DATA'IN --- MOVE FROM XDS TO STACK"             22718000
$CONTROL SEGMENT=STORMISC                                               22720000
<<***************************************************************>>     22722000
PROCEDURE MOVE'DATA'IN (XDS, INX, BUF, LEN);                            22724000
         VALUE   XDS, INX, LEN;                                         22726000
         INTEGER XDS, INX, LEN;                                         22728000
         INTEGER ARRAY BUF;                                             22730000
         OPTION UNCALLABLE, PRIVILEGED;                                 22732000
                                                                        22734000
      <<This routine moves LEN words from the data segment              22736000
        XDS, starting at offset INX, into the buffer BUF.  >>           22738000
                                                                        22740000
   BEGIN                                                                22742000
                                                                        22744000
   TOS:=@BUF;                 <<destination address>>                   22746000
   TOS:=XDS;                  <<source DST number>>                     22748000
   TOS:=INX;                  <<starting offset into segment>>          22750000
   TOS:=LEN;                  <<number of words to transfer>>           22752000
   ASSEMBLE (MFDS);                                                     22754000
                                                                        22756000
   END <<MOVE'DATA'IN PROC>>;                                           22758000
$PAGE ";STORMISC=  MOVE'DATA'OUT --- MOVE FROM XDS TO STACK"            22760000
$CONTROL SEGMENT=STORMISC                                               22762000
<<***************************************************************>>     22764000
PROCEDURE MOVE'DATA'OUT (XDS, INX, BUF, LEN);                           22766000
         VALUE   XDS, INX, LEN;                                         22768000
         INTEGER XDS, INX, LEN;                                         22770000
         INTEGER ARRAY BUF;                                             22772000
         OPTION UNCALLABLE, PRIVILEGED;                                 22774000
                                                                        22776000
      <<This routine moves LEN words into the data segment              22778000
        XDS, starting at offset INX, from the buffer BUF.  >>           22780000
                                                                        22782000
   BEGIN                                                                22784000
                                                                        22786000
   TOS:=XDS;                  <<destination XDS>>                       22788000
   TOS:=INX;                  <<index into XDS>>                        22790000
   TOS:=@BUF;                 <<source of data in stack>>               22792000
   TOS:=LEN;                  <<number of words to transfer>>           22794000
   ASSEMBLE (MTDS);                                                     22796000
                                                                        22798000
   END <<MOVE'DATA'OUT PROC>>;                                          22800000
$PAGE ";STORMISC=  OPEN'FILE --- FILE OPENING ROUTINE"                  22802000
$CONTROL SEGMENT=STORMISC                                               22804000
<<***************************************************************>>     22806000
LOGICAL PROCEDURE OPEN'FILE (FILENO,                                    22808000
                             DESIG, FOPTIONS, AOPTIONS, RECSIZE,        22810000
                             DEV',                                      22812000
                             BLOCKFACTOR, NUMBUFFERS, FILESIZE,         22814000
                             NUMEXTENTS, INITIALLOC);                   22816000
         VALUE FOPTIONS, AOPTIONS, RECSIZE, BLOCKFACTOR,                22818000
               NUMBUFFERS, FILESIZE, NUMEXTENTS, INITIALLOC;            22820000
         INTEGER FILENO, RECSIZE, BLOCKFACTOR, NUMBUFFERS,              22822000
               NUMEXTENTS, INITIALLOC;                                  22824000
         LOGICAL FOPTIONS, AOPTIONS;                                    22826000
         BYTE ARRAY DEV';                                               22828000
         INTEGER ARRAY DESIG;                                           22830000
         DOUBLE FILESIZE;                                               22832000
         OPTION VARIABLE, UNCALLABLE;                                   22834000
                                                                        22836000
      << This routine calls FOPEN with whatever parameters it is >>     22838000
      << given.                                                  >>     22840000
      <<                                                         >>     22842000
      << DESIG is a file title, terminated by a blank.           >>     22844000
      << If FOPEN returns CCE, the result is GOOD;               >>     22846000
      << otherwise FAILED is returned and ERROR'INFO is set to   >>     22848000
      << ERR'CCL for a "<" error, and to ERR'CCG for a ">" error;>>     22850000
      << ERROR'CODE is set to the number returned by FCHECK.     >>     22852000
                                                                        22854000
   BEGIN                                                                22856000
                                                                        22858000
                                                                        22860000
   INTEGER                                                              22862000
      LEN         := 0;       <<length of file name>>                   22864000
                                                                        22866000
   BYTE ARRAY                                                           22868000
      ACTUAL'DEV' (0:8),                                                22870000
      DESIG'      (*) = DESIG (0);                                      22872000
                                                                        22874000
   ERROR'CODE:=ERROR'INFO:=0;                                           22876000
   OPEN'FILE:=GOOD;                                                     22878000
                                                                        22880000
   IF NOT PARMMASK.(15:1) THEN                                          22882000
      INITIALLOC:=1;                                                    22884000
                                                                        22886000
   IF NOT PARMMASK.(14:1) THEN                                          22888000
      NUMEXTENTS:=8;                                                    22890000
                                                                        22892000
   IF NOT PARMMASK.(13:1) THEN                                          22894000
      FILESIZE:=1023D;                                                  22896000
                                                                        22898000
   IF NOT PARMMASK.(12:1) THEN         <<2 buf, 1 copy, outpri 8>>      22900000
      NUMBUFFERS:=%(2)1000000000100010;                                 22902000
                                                                        22904000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        22906000
   IF DEBUGGING THEN                                                    22908000
      BEGIN                                                             22910000
      SAY "      OPEN'FILE (" ENDSAY;                                   22912000
      SAY DESIG',(8) ENDSAY;                                            22914000
      SAY ")" ENDSAY;                                                   22916000
      SEND;                                                             22918000
      END;                                                              22920000
$IF                           <<DEBUGGING CODE>>                        22922000
                                                                        22924000
   IF PARMMASK.(10:1) THEN                                              22926000
      MOVE ACTUAL'DEV':=DEV',(9)                                        22928000
   ELSE                                                                 22930000
      MOVE ACTUAL'DEV':="DISC ";                                        22932000
                                                                        22934000
   SCAN DESIG' UNTIL " ", 1;                                            22936000
   LEN:=TOS-LOGICAL(@DESIG');          <<length of title>>              22938000
                                                                        22940000
   IF PARMMASK.(11:1) THEN    <<blockfactor specified>>                 22942000
      FILENO:=FOPEN (DESIG', FOPTIONS, AOPTIONS, RECSIZE,               22944000
                     ACTUAL'DEV', <<formmsg>>, <<userlabels>>,          22946000
                     BLOCKFACTOR, NUMBUFFERS, FILESIZE,                 22948000
                     NUMEXTENTS, INITIALLOC)                            22950000
                                                                        22952000
   ELSE                       <<blockfactor not specified>>             22954000
      FILENO:=FOPEN (DESIG', FOPTIONS, AOPTIONS, RECSIZE,               22956000
                     ACTUAL'DEV', <<formmsg>>, <<userlabels>>,          22958000
                     <<blockfactor>>, NUMBUFFERS, FILESIZE,             22960000
                     NUMEXTENTS, INITIALLOC);                           22962000
                                                                        22964000
   IF > THEN                                                            22966000
      BEGIN                                                             22968000
      ERROR'INFO:=ERR'CCG;                                              22970000
      FCHECK (FILENO, ERROR'CODE);                                      22972000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        22974000
      IF DEBUGGING THEN                                                 22976000
         BEGIN                                                          22978000
         SAY "    -->   >   ERR# = " ENDSAY;                            22980000
         SAYNUM (ERROR'CODE);                                           22982000
         SEND;                                                          22984000
         END;                                                           22986000
$IF                           <<DEBUGGING CODE>>                        22988000
      PARMS'TEMPI'1:=@DESIG';                                           22990000
      PARMS'TEMPI'2:=LEN;      <<title is LEN chars long>>              22992000
      SENDMESSAGE (M'OPEN'FAIL);                                        22994000
      OPEN'FILE:=FAILED;                                                22996000
      END                                                               22998000
   ELSE IF < THEN                                                       23000000
      BEGIN                                                             23002000
      ERROR'INFO:=ERR'CCL;                                              23004000
      FCHECK (FILENO, ERROR'CODE);                                      23006000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        23008000
      IF DEBUGGING THEN                                                 23010000
         BEGIN                                                          23012000
         SAY "    -->   <   ERR# = " ENDSAY;                            23014000
         SAYNUM (ERROR'CODE);                                           23016000
         SEND;                                                          23018000
         END;                                                           23020000
$IF                           <<DEBUGGING CODE>>                        23022000
      PARMS'TEMPI'1:=@DESIG';                                           23024000
      PARMS'TEMPI'2:=LEN;      <<title is LEN chars long>>              23026000
      SENDMESSAGE (M'OPEN'FAIL);                                        23028000
      OPEN'FILE:=FAILED;                                                23030000
      END                                                               23032000
   ELSE                                                                 23034000
      BEGIN                                                             23036000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        23038000
      IF DEBUGGING THEN                                                 23040000
         BEGIN                                                          23042000
         SAY "    -->   =   FILE#= " ENDSAY;                            23044000
         SAYNUM (FILENO);                                               23046000
         SEND;                                                          23048000
         END;                                                           23050000
$IF                           <<DEBUGGING CODE>>                        23052000
      END;                                                              23054000
                                                                        23056000
   END <<OPEN'FILE PROC>>;                                              23058000
$PAGE ";STORMISC=  PARSE'DATE -- PARSES THE DATE KEYWORD"               23060000
$CONTROL SEGMENT=STORMISC                                               23062000
<<***************************************************************>>     23064000
LOGICAL PROCEDURE PARSE'DATE (PDATE);                                   23066000
         LOGICAL PDATE;                                                 23068000
         OPTION UNCALLABLE;                                             23070000
   << This routine checks the string pointed to by the scanner to >>    23072000
   << extract a date of the form MM/DD/YY from it.  If the string >>    23074000
   << is not a valid date (or 0/0/0), an error message is printed.>>    23076000
   << The routine result is GOOD if no errors, otherwise          >>    23078000
   << a FAILED is returned.                                       >>    23080000
   << (A good date will be encoded in the format ISTORE expects.) >>    23082000
                                                                        23084000
   BEGIN                                                                23086000
                                                                        23088000
                                                                        23090000
   INTEGER                                                              23092000
      DAY         := 0,                                                 23094000
      MONTH       := 0,                                                 23096000
      YEAR        := 0,                                                 23098000
      MAXDAYS;        <<used to cope with leap year complications>>     23100000
                                                                        23102000
   INTEGER ARRAY              <<cumulative days at month end...>>       23104000
      DAYSPERMONTH (*) = PB :=     0,  31,  59,  90, 120, 151,          23106000
                                 181, 212, 243, 273, 304, 334;          23108000
                                                                        23110000
   INTEGER ARRAY                                                        23112000
      MONTHARR (*) = PB:=     <<days of each month>>                    23114000
         0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31;             23116000
                                                                        23118000
   LABEL                                                                23120000
      END'PARSE'DATE;                                                   23122000
                                                                        23124000
   <<------------------------>>                                         23126000
   SUBROUTINE FAIL (N);                                                 23128000
            VALUE   N;                                                  23130000
            INTEGER N;                                                  23132000
      BEGIN                                                             23134000
                                                                        23136000
      IF N <> 0 THEN                                                    23138000
         BEGIN                                                          23140000
         PRINT'CARROT (ITEMP'OFFSET);                                   23142000
         SENDMESSAGE (N);                                               23144000
         END;                                                           23146000
                                                                        23148000
      PARSE'DATE:=FAILED;                                               23150000
                                                                        23152000
      GO END'PARSE'DATE;                                                23154000
                                                                        23156000
      END <<FAIL SUB>>;                                                 23158000
   <<------------------------->>                                        23160000
                                                                        23162000
   PARSE'DATE:=GOOD;                                                    23164000
                                                                        23166000
   PDATE:=0;                                                            23168000
                                                                        23170000
         <<assume STEPIT has been done already!>>                       23172000
                                                                        23174000
   IF ICLASS ISNT NUMBERv OR SUBCLASS > 12 OR SUBCLASS < 0 THEN         23176000
      FAIL (SR'INVALID'MONTH);            <<bad MM field>>              23178000
                                                                        23180000
   MONTH:=SUBCLASS;                                                     23182000
                                                                        23184000
   IF STEPIT IS ENDLINEv OR ITEMP <> "/" THEN                           23186000
      FAIL (SR'SLASH'MONTH'EXPECTED);                                   23188000
                                                                        23190000
   IF STEPIT ISNT NUMBERv OR SUBCLASS > 31 OR SUBCLASS < 0 THEN         23192000
      FAIL (SR'INVALID'DAY);                                            23194000
                                                                        23196000
   DAY:=SUBCLASS;                                                       23198000
                                                                        23200000
   IF STEPIT IS ENDLINEv OR ITEMP <> "/" THEN                           23202000
      FAIL (SR'SLASH'YEAR'EXPECTED);                                    23204000
                                                                        23206000
   IF STEPIT ISNT NUMBERv OR SUBCLASS < 0 OR SUBCLASS > 99 THEN         23208000
      FAIL (SR'INVALID'YEAR);                                           23210000
                                                                        23212000
   YEAR:=SUBCLASS;                                                      23214000
                                                                        23216000
   IF MONTH = 0 OR DAY = 0 OR YEAR = 0 THEN                             23218000
      BEGIN                                                             23220000
      IF (MONTH+DAY+YEAR) <> 0 THEN                                     23222000
         FAIL (SR'DATE'ALL'0'OR'NON'0);                                 23224000
      END                                                               23226000
   ELSE                                                                 23228000
      BEGIN                                                             23230000
      MAXDAYS:=MONTHARR(MONTH)  +      <<leap year correction...>>      23232000
            (IF YEAR MOD 4 = 0 AND MONTH = 2 THEN 1 ELSE 0);            23234000
      IF DAY > MAXDAYS THEN                                             23236000
         FAIL (SR'DAY'TOO'BIG);   <<day too big for month>>             23238000
      END;                                                              23240000
                                                                        23242000
         <<convert date to format ISTORE likes...>>                     23244000
                                                                        23246000
   PDATE.(0:7):=YEAR;                                                   23248000
   IF MONTH > 0 THEN                                                    23250000
      PDATE.(7:9):=DAYSPERMONTH(MONTH-1) + DAY +                        23252000
            (IF (YEAR MOD 4)=0 AND MONTH>2 THEN 1 ELSE 0);              23254000
                                                                        23256000
   PARSE'DATE:=GOOD;                                                    23258000
                                                                        23260000
END'PARSE'DATE:                                                         23262000
                                                                        23264000
   END <<PARSE'DATE PROC>>;                                             23266000
$PAGE ";TITLES=  PARSE'FILESET --- FILESET PARSER FOR S/R"              23268000
$CONTROL SEGMENT=TITLES                                                 23270000
<<***************************************************************>>     23272000
LOGICAL PROCEDURE PARSE'FILESET;                                        23274000
         OPTION PRIVILEGED, UNCALLABLE;                                 23276000
                                                                        23278000
      << Parses the fileset pointed to by the scanner.                  23280000
         This fileset, if valid, is transformed into a standard form    23282000
         file title and stored into LOOK'TITLE'.  This will ALWAYS      23284000
         result in a fully qualified file title, even if the user       23286000
         didn't specify group and/or account (we use the logon          23288000
         group/account as defaults). >>                                 23290000
                                                                        23292000
      <<It will disallow any file title beginning with a "*"            23294000
        or a "$".  (These titles, where they ARE allowed, are           23296000
        handled slightly specially externally.) >>                      23298000
                                                                        23300000
   BEGIN                                                                23302000
                                                                        23304000
                                                                        23306000
   INTEGER                                                              23308000
      CHAR'INX    := 0;                                                 23310000
                                                                        23312000
   BYTE ARRAY                                                           23314000
      DELIMS'     (0:6),                                                23316000
      TFILE'      (0:8),                                                23318000
      TGROUP'     (0:8);                                                23320000
                                                                        23322000
   BYTE POINTER                                                         23324000
      PSTD;                                                             23326000
                                                                        23328000
   LABEL                                                                23330000
      END'PARSE'FILESET;                                                23332000
                                                                        23334000
   <<----------------------->>                                          23336000
   <<  FAIL                 >>                                          23338000
   <<----------------------->>                                          23340000
                                                                        23342000
   SUBROUTINE FAIL (ERRNUM, INX);                                       23344000
            VALUE   ERRNUM, INX;                                        23346000
            INTEGER ERRNUM, INX;                                        23348000
      BEGIN                                                             23350000
                                                                        23352000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        23354000
      IF DEBUGGING THEN                                                 23356000
         BEGIN                                                          23358000
         SAY "   FAIL of PARSE'FILESET (" ENDSAY;                       23360000
         SAYNUM (ERRNUM); SAY ", " ENDSAY; SAYNUM (INX);                23362000
         SAY1 (")");                                                    23364000
         SEND;                                                          23366000
         END;                                                           23368000
$IF                           <<DEBUGGING CODE>>                        23370000
                                                                        23372000
      PRINT'CARROT (INX);                                               23374000
                                                                        23376000
      ERROR'CODE:=ERRNUM;                                               23378000
                                                                        23380000
      SENDMESSAGE (ERRNUM);                                             23382000
                                                                        23384000
      ERROR'CODE:=0;          <<prevents caller from printing           23386000
                                a duplicate error message>>             23388000
                                                                        23390000
      PARSE'FILESET:=FAILED;                                            23392000
                                                                        23394000
      GO END'PARSE'FILESET;                                             23396000
                                                                        23398000
      END <<FAIL SUB>>;                                                 23400000
                                                                        23402000
   <<------------------------>>                                         23404000
   <<  MAKE'FULLY'QUALIFIED  >>                                         23406000
   <<------------------------>>                                         23408000
                                                                        23410000
   SUBROUTINE MAKE'FULLY'QUALIFIED (PSTD);                              23412000
            VALUE         PSTD;                                         23414000
            BYTE POINTER  PSTD;                                         23416000
      BEGIN                                                             23418000
                                                                        23420000
            <<if the group or account wasn't specified, append          23422000
              the logon group (or account)...>>                         23424000
                                                                        23426000
      IF (STD'GROUP'INX = 0) OR (STD'ACCT'INX = 0) THEN                 23428000
         BEGIN                                                          23430000
                                                                        23432000
               <<blank out 2 temp arrays...>>                           23434000
                                                                        23436000
         FILL' (TFILE', FILE'PART'SIZE, " ");                           23438000
         FILL' (TGROUP', FILE'PART'SIZE, " ");                          23440000
                                                                        23442000
               <<set up the file part...>>                              23444000
                                                                        23446000
         MOVE TFILE':=STD'FILE', (STD'FILE'LEN);                        23448000
                                                                        23450000
               <<set up the group part (from PSTD if present,           23452000
                 otherwise from logon group...>>                        23454000
                                                                        23456000
         IF STD'GROUP'INX = 0 THEN                                      23458000
            MOVE TGROUP':= LOGON'GROUP', (FILE'PART'SIZE)               23460000
         ELSE                                                           23462000
            MOVE TGROUP':= STD'GROUP', (STD'GROUP'LEN);                 23464000
                                                                        23466000
               << (use the logon account...if we got here at all,       23468000
                  no account part existed)...convert the 3 arrays       23470000
                  into a standard form title...>>                       23472000
                                                                        23474000
         IF DISPLAY'3'TO'STANDARD (TFILE', TGROUP', LOGON'ACCT',        23476000
                                  PSTD, ERROR'CODE)                     23478000
               = FAILED THEN  <<note: err shouldnt be possible>>        23480000
            FAIL (CONVERT'SE'TO'CIERR(ERROR'CODE), ITEMP'OFFSET);       23482000
         END;                                                           23484000
                                                                        23486000
      END <<MAKE'FULLY'QUALIFIED SUB>>;                                 23488000
   <<---------------------------------->>                               23490000
                                                                        23492000
   ERROR'CODE:=0;                                                       23494000
   PARSE'FILESET:=FAILED;                                               23496000
                                                                        23498000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        23500000
   IF DEBUGGING THEN                                                    23502000
      BEGIN                                                             23504000
      SAY "PARSE'FILESET:  " ENDSAY;                                    23506000
      DEBUG'SCANNER;                                                    23508000
      END;                                                              23510000
$IF                           <<DEBUGGING CODE>>                        23512000
                                                                        23514000
         <<initialize standard form titles and patterns for the         23516000
           'search' and 'exception' titles...>>                         23518000
                                                                        23520000
   FILL' (LOOK'TITLE', MAX'STD'LEN, 0);   <<empty std form title>>      23522000
   FILL' (NOT'TITLE',  MAX'STD'LEN, 0);   <<empty std form title>>      23524000
   FILL  (LOOK'LOCK,   FILE'PART'WORDS, "  ");                          23526000
                                                                        23528000
   PATTERN'BUILD'STANDARD (LOOK'TITLE', LOOK'FILE'PAT,                  23530000
                           LOOK'GROUP'PAT, LOOK'ACCT'PAT, ERROR'CODE);  23532000
   PATTERN'BUILD'STANDARD (NOT'TITLE', NOT'FILE'PAT,                    23534000
                           NOT'GROUP'PAT, NOT'ACCT'PAT, ERROR'CODE);    23536000
                                                                        23538000
         <<build delimiters array with the following                    23540000
           delimiters:  semicolon, comma, space,                        23542000
                        return, and (this time) dash ...                23544000
           Note: the dash MUST be the last delimiter!  >>               23546000
                                                                        23548000
   MOVE DELIMS':=(%6, "!;, ", %15, "-");          <<!INDIRECT>>         23550000
                                                                        23552000
         <<parse title...note that we are guaranteed that one           23554000
           of the five delimiters above will be found, the              23556000
           carriage return is always at the end of the text!>>          23558000
                                                                        23560000
         <<Also, it is assumed that a STEPIT has been done              23562000
           prior to calling this procedure, so ITEMP is                 23564000
           valid!                                        >>             23566000
                                                                        23568000
   @PSTD:=@LOOK'TITLE';                                                 23570000
                                                                        23572000
         <<"empty" filesets require special handling...                 23574000
           the are allowed only as in:  STORE ;*T                       23576000
           RESTORE *T     RESTORE *T;     RESTORE *T;;                  23578000
           and not in:   STORE A,,B;*T                >>                23580000
                                                                        23582000
   IF ITEMP = ";" OR ICLASS IS ENDLINEv THEN                            23584000
      IF ALLOW'EMPTY'FILESET                                            23586000
          <<AND ITEMP'OFFSET = FILESET'INX>> THEN                       23588000
         BEGIN                <<got an empty fileset...>>               23590000
         IF RESTORING THEN                                              23592000
            IF CAP'SM OR CAP'OP THEN                                    23594000
               BEGIN                                                    23596000
               PRINT'CARROT (ITEMP'OFFSET);                             23598000
               SENDMESSAGE (SR'WARN'AAA);                               23600000
               MOVE TFILE':="@.@.@ ";                                   23602000
               END                                                      23604000
            ELSE IF CAP'AM THEN                                         23606000
               BEGIN                                                    23608000
               PRINT'CARROT (ITEMP'OFFSET);                             23610000
               SENDMESSAGE (SR'WARN'AA);                                23612000
               MOVE TFILE':="@.@ ";                                     23614000
               END                                                      23616000
            ELSE                                                        23618000
               BEGIN                                                    23620000
               PRINT'CARROT (ITEMP'OFFSET);                             23622000
               SENDMESSAGE (SR'WARN'A);                                 23624000
               MOVE TFILE':="@ ";                                       23626000
               END                                                      23628000
         ELSE                                                           23630000
            BEGIN                                                       23632000
            PRINT'CARROT (ITEMP'OFFSET);                                23634000
            SENDMESSAGE (SR'WARN'STORE'A);                              23636000
            MOVE TFILE' := "@ ";                                        23638000
            END;                                                        23640000
         DISPLAY'TO'STANDARD (TFILE', LOOK'TITLE',                      23642000
                       ERROR'CODE, CHAR'INX, DELIMS');                  23644000
         CHAR'INX:=0;         <<length of token at ITEMP>>              23646000
         END                                                            23648000
      ELSE                                                              23650000
$IF X2=OFF THEN                                                         23652000
         FAIL (SR'FILESET'LIST'EMPTY, ITEMP'OFFSET)                     23654000
$IF                                                                     23656000
   ELSE                                                                 23658000
      BEGIN                   <<d-->s...>>                              23660000
      IF DISPLAY'TO'STANDARD (ITEMP, LOOK'TITLE', ERROR'CODE,           23662000
                              CHAR'INX, DELIMS')                        23664000
            = FAILED THEN                                               23666000
         FAIL (CONVERT'SE'TO'CIERR (ERROR'CODE),                        23668000
               ITEMP'OFFSET+CHAR'INX);                                  23670000
      END;                                                              23672000
                                                                        23674000
         <<extract lockword...>>                                        23676000
                                                                        23678000
   IF STD'LOCK'INX <> 0 THEN                                            23680000
      MOVE LOOK'LOCK':=STD'LOCK', (STD'LOCK'LEN);                       23682000
                                                                        23684000
         <<do some validity checking...>>                               23686000
                                                                        23688000
   IF STD'DOLLAR = 1 THEN                                               23690000
      FAIL (SR'NO'DOLLAR'ALLOWED, ITEMP'OFFSET);                        23692000
                                                                        23694000
   IF STD'BACKREF = 1 THEN                                              23696000
      FAIL (SR'NO'BACKREF'ALLOWED, ITEMP'OFFSET);                       23698000
                                                                        23700000
   ILEN:=CHAR'INX;            <<length returned by D-->S>>              23702000
   STEPIT;                    <<get the next non-blank!>>               23704000
                                                                        23706000
         <<turn file title into a fully qualified file title...>>       23708000
                                                                        23710000
   MAKE'FULLY'QUALIFIED (LOOK'TITLE');                                  23712000
                                                                        23714000
   IF (STD'WILD = 0) OR (DBSTORE'TOG) THEN                     <<04870>>23716000
      SIMPLE'TOG:=1           <<no wildcards in search title>>          23718000
   ELSE                                                                 23720000
      SIMPLE'TOG:=0;          <<wildcards are in search title>>         23722000
                                                                        23724000
   IF PATTERN'BUILD'STANDARD (LOOK'TITLE', LOOK'FILE'PAT,               23726000
                           LOOK'GROUP'PAT, LOOK'ACCT'PAT, ERROR'CODE)   23728000
         = FAILED THEN        <<shouldnt be possible>>                  23730000
      FAIL (SR'FAILED'TO'BUILD'PATTERN, ITEMP'OFFSET);                  23732000
                                                                        23734000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        23736000
   IF DEBUGGING THEN                                                    23738000
      BEGIN                                                             23740000
      SAY "LOOK'TITLE = " ENDSAY;                                       23742000
      SAY'STANDARD (LOOK'TITLE');                                       23744000
      SAY ", PATTERNS = " ENDSAY;                                       23746000
      SEND;                                                             23748000
      SAY "File:    " ENDSAY;                                           23750000
      SAY'PATTERN (LOOK'FILE'PAT);                                      23752000
      IF LOOK'LOCK' <> " " THEN                                         23754000
         BEGIN                                                          23756000
         SAY "  / " ENDSAY;                                             23758000
         SAY LOOK'LOCK', (FILE'PART'SIZE) ENDSAY;                       23760000
         END;                                                           23762000
      SEND;                                                             23764000
      SAY "Group:   " ENDSAY;                                           23766000
      SAY'PATTERN (LOOK'GROUP'PAT);                                     23768000
      SEND;                                                             23770000
      SAY "Account: " ENDSAY;                                           23772000
      SAY'PATTERN (LOOK'ACCT'PAT);                                      23774000
      SEND;                                                             23776000
                                                                        23778000
      SAY "Token now: " ENDSAY;                                         23780000
      SAY ITEMP,(ILEN) ENDSAY;                                          23782000
      SEND;                                                             23784000
      END;                                                              23786000
$IF                           <<DEBUGGING CODE>>                        23788000
                                                                        23790000
         <<see if an exception title was specified...>>                 23792000
                                                                        23794000
   IF ITEMP <> "-" THEN                                                 23796000
      BEGIN                            <<no exception fileset..exit>>   23798000
      PARSE'FILESET := GOOD;                                            23800000
      RETURN;                                                           23802000
      END;                                                              23804000
                                                                        23806000
         <<extract the exception fileset...>>                           23808000
                                                                        23810000
   STEPIT;                    <<get past the "-">>                      23812000
                                                                        23814000
   @PSTD:= @NOT'TITLE';                                                 23816000
   DELIMS'(0):=DELIMS'(0) - 1;      <<same as before, but no "-">>      23818000
                                                                        23820000
   IF DISPLAY'TO'STANDARD (ITEMP, NOT'TITLE',                           23822000
                           ERROR'CODE, CHAR'INX, DELIMS')               23824000
                                                                        23826000
         = FAILED THEN                                                  23828000
      FAIL (CONVERT'SE'TO'CIERROR (ERROR'CODE), ITEMP'OFFSET+CHAR'INX); 23830000
                                                                        23832000
   IF STD'DOLLAR = 1 THEN                                               23834000
      FAIL (SR'NO'DOLLAR'ALLOWED, ITEMP'OFFSET);                        23836000
                                                                        23838000
   IF STD'BACKREF = 1 THEN                                              23840000
      FAIL (SR'NO'BACKREF'ALLOWED, ITEMP'OFFSET);                       23842000
                                                                        23844000
         <<If no group and/or account was specified for the             23846000
           exception title, we must append our logon group and          23848000
           account...>>                                                 23850000
                                                                        23852000
   MAKE'FULLY'QUALIFIED (NOT'TITLE');                                   23854000
                                                                        23856000
   IF PATTERN'BUILD'STANDARD (NOT'TITLE', NOT'FILE'PAT,                 23858000
                           NOT'GROUP'PAT, NOT'ACCT'PAT, ERROR'CODE)     23860000
            = FAILED THEN                                               23862000
      FAIL (SR'FAILED'TO'BUILD'PATTERN, ITEMP'OFFSET);                  23864000
                                                                        23866000
   ILEN:=CHAR'INX;                                                      23868000
   STEPIT;                                                              23870000
                                                                        23872000
   PARSE'FILESET:=GOOD;                                                 23874000
                                                                        23876000
END'PARSE'FILESET:                                                      23878000
                                                                        23880000
   END <<PARSE'FILESET PROC>>;                                          23882000
$PAGE ";TITLES=  PARSE'NAME --- SIMPLE NAME PARSER FOR STORE/RESTORE"   23884000
$CONTROL SEGMENT=TITLES                                                 23886000
<<***************************************************************>>     23888000
INTEGER PROCEDURE PARSE'NAME (PTR, LEN);                                23890000
      VALUE   PTR, LEN;                                                 23892000
      INTEGER LEN;                                                      23894000
      BYTE POINTER PTR;                                                 23896000
      OPTION UNCALLABLE;                                                23898000
                                                                        23900000
         <<parse the file part pointed to by PTR, which is LEN          23902000
           characters long.  If no error occurs, a 0 is returned.       23904000
           A back reference (*) is allowed, but wildcards (@,           23906000
           #, ?) are not. >>                                            23908000
   BEGIN                                                                23910000
   INTEGER                                                              23912000
      N = PARSE'NAME;                                                   23914000
   LABEL                                                                23916000
      END'PARSE'NAME;                                                   23918000
   <<----------------------->>                                          23920000
   SUBROUTINE FAIL (N); VALUE N; INTEGER N;                             23922000
      BEGIN                                                             23924000
      PARSE'NAME:=N;                                                    23926000
      GO END'PARSE'NAME;                                                23928000
      END <<FAIL SUB>>;                                                 23930000
   <<----------------------->>                                          23932000
                                                                        23934000
   PARSE'NAME := 0;                                                     23936000
                                                                        23938000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        23940000
   IF DEBUGGING THEN                                                    23942000
      BEGIN                                                             23944000
      SAY "PARSE'NAME OF '" ENDSAY;                                     23946000
      SAY PTR,(LEN) ENDSAY;                                             23948000
      SAY "'" ENDSAY;                                                   23950000
      END;                                                              23952000
$IF                           <<DEBUGGING CODE>>                        23954000
                                                                        23956000
   IF LEN <= 0 THEN                                                     23958000
      FAIL (PN'EMPTY'NAME);                                             23960000
                                                                        23962000
   IF PTR="*" THEN                                                      23964000
      BEGIN                                                             23966000
      @PTR:=@PTR(1);                                                    23968000
      LEN:=LEN-1;                                                       23970000
      IF LEN <= 0 THEN                                                  23972000
         FAIL (PN'EMPTY'NAME);                                          23974000
      END;                                                              23976000
                                                                        23978000
   IF LEN > FILE'PART'SIZE THEN                                         23980000
      FAIL (PN'NAME'TOO'LONG);                                          23982000
                                                                        23984000
   IF PTR = ALPHA THEN               <<name starts with alpha...ok>>    23986000
   ELSE IF PTR="?" OR PTR="@" THEN   <<name starts with wildcard...>>   23988000
      FAIL (PN'WILDCARDS'ILLEGAL)          <<wildcards are illegal!>>   23990000
   ELSE                              <<found something else...>>        23992000
      FAIL (PN'MUST'START'WITH'ALPHA);     <<but it wasnt an alpha!>>   23994000
                                                                        23996000
         <<check to see that all LEN characters are legal...>>          23998000
                                                                        24000000
   WHILE LEN > 0 DO                                                     24002000
      BEGIN                                                             24004000
      IF PTR = ALPHA THEN                                               24006000
      ELSE IF PTR = NUMERIC THEN                                        24008000
      ELSE IF PTR = "?" OR PTR = "#" OR PTR = "@" THEN                  24010000
         FAIL (PN'WILDCARDS'ILLEGAL)                                    24012000
      ELSE                                                              24014000
         FAIL (PN'ILLEGAL'CHARACTER);                                   24016000
      @PTR:=@PTR(1);                                                    24018000
      LEN:=LEN-1;                                                       24020000
      END;                                                              24022000
                                                                        24024000
END'PARSE'NAME:                                                         24026000
                                                                        24028000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        24030000
   IF DEBUGGING THEN                                                    24032000
      BEGIN                                                             24034000
      SAY "  --> " ENDSAY;                                              24036000
      SAYNUM(N);                                                        24038000
      SEND;                                                             24040000
      END;                                                              24042000
$IF                           <<DEBUGGING CODE>>                        24044000
                                                                        24046000
   END <<PARSE'NAME PROC>>;                                             24048000
$PAGE ";PARSE=  PARSE'OTHER'PARMS --- PARAM PARSER FOR S/R"             24050000
$CONTROL SEGMENT=PARSE                                                  24052000
<<***************************************************************>>     24054000
LOGICAL PROCEDURE PARSE'OTHER'PARMS;                                    24056000
         OPTION UNCALLABLE;                                             24058000
                                                                        24060000
      << Sets various bits in the S'R'FLAGS words.;                     24062000
         also returns information via PARMS.                            24064000
                                                                        24066000
         A result of GOOD means no problems were found. >>              24068000
                                                                        24070000
   BEGIN                                                                24072000
                                                                        24074000
                                                                        24076000
   LOGICAL                                                              24078000
      PDATE       := 0,                                                 24080000
      USE'ADATE   := 2;       << 2 = haven't seen "DATE" yet>>          24082000
                                                                        24084000
   BYTE ARRAY                                                           24086000
      SCRATCH'    (0:FILE'PART'SIZE-1);                                 24088000
                                                                        24090000
   LABEL                                                                24092000
      END'PARSE'OTHER'PARMS;                                            24094000
                                                                        24096000
   <<------------------->>                                              24098000
   SUBROUTINE ERR (ERRNUM);                                             24100000
         VALUE   ERRNUM;                                                24102000
         INTEGER ERRNUM;                                                24104000
      BEGIN                                                             24106000
            <<this will set PARSE'OTHER'PARMS                           24108000
              to FAILED and go to the end of the routine.>>             24110000
                                                                        24112000
      IF ERRNUM <> 0 THEN                                               24114000
         BEGIN                                                          24116000
         PRINT'CARROT (ITEMP'OFFSET);                                   24118000
         SENDMESSAGE (ERRNUM);                                          24120000
         END;                                                           24122000
                                                                        24124000
      PARSE'OTHER'PARMS:=FAILED;      <<indicates an error>>            24126000
                                                                        24128000
      GO END'PARSE'OTHER'PARMS;                                         24130000
                                                                        24132000
      END <<ERR SUB>>;                                                  24134000
                                                                        24136000
   <<------------------->>                                              24138000
   SUBROUTINE WARN (N);                                                 24140000
           VALUE    N;                                                  24142000
           INTEGER  N;                                                  24144000
      BEGIN                                                             24146000
                                                                        24148000
      SENDMESSAGE (N);                                                  24150000
                                                                        24152000
      END <<WARN SUB>>;                                                 24154000
                                                                        24156000
   <<------------------->>                                              24158000
   SUBROUTINE UNKNOWN'OPTION;                                           24160000
                                                                        24162000
      BEGIN                                                             24164000
                                                                        24166000
      IF STORING THEN                                                   24168000
         ERR (SR'UNKOPTION)                                             24170000
      ELSE                                                              24172000
         ERR (RS'UNKOPTION);                                            24174000
                                                                        24176000
      END <<UNKNOWN'OPTION SUB>>;                                       24178000
                                                                        24180000
   <<------------------->>                                              24182000
   SUBROUTINE ASSURE'RESTORING;                                         24184000
                                                                        24186000
      BEGIN                                                             24188000
                                                                        24190000
            <<we get here because we found a keyword used only          24192000
              by RESTORE.  Therefore, we now check to see if it is      24194000
              a STORE or SYSDUMP command using this keyword;  if        24196000
              it IS, we tell the user that this is an unknown           24198000
              STORE option...>>                                         24200000
                                                                        24202000
      IF NOT RESTORING THEN                                             24204000
         ERR (SR'UNKOPTION);                                            24206000
                                                                        24208000
      END <<ASSURE'RESTORING SUB>>;                                     24210000
                                                                        24212000
   <<------------------->>                                              24214000
   SUBROUTINE ASSURE'STORING;                                           24216000
                                                                        24218000
      BEGIN                                                             24220000
                                                                        24222000
            <<we get here because we found a keyword used only          24224000
              by STORE.  Therefore, we now check to see if it is        24226000
              a RESTORE command using this STORE-only keyword;  if      24228000
              it IS, we tell the user that this is an unknown           24230000
              RESTORE option...>>                                       24232000
                                                                        24234000
      IF NOT STORING THEN        <<STORE or SYSDUMP ok>>                24236000
         ERR (RS'UNKOPTION);                                            24238000
                                                                        24240000
      END <<ASSURE'STORING SUB>>;                                       24242000
                                                                        24244000
   <<------------------->>                                              24246000
   SUBROUTINE ASSURE'SYSDUMPING;                                        24248000
                                                                        24250000
      BEGIN                                                             24252000
                                                                        24254000
            <<we get here because we found a keyword used only          24256000
              by SYSDUMP.  Therefore, we now check to see if it is      24258000
              a being used by STORE or RESTORE.  If                     24260000
              it IS, we tell the user that this is an unknown           24262000
               STORE / RESTORE option...>>                              24264000
                                                                        24266000
      IF NOT SYSDUMPING THEN     <<STORE or RESTORE bad>>               24268000
         UNKNOWN'OPTION;                                                24270000
                                                                        24272000
      END <<ASSURE'STORING SUB>>;                                       24274000
                                                                        24276000
   <<------------------->>                                     <<04870>>24278000
   SUBROUTINE ASSURE'DBSTORING;                                <<04870>>24280000
                                                               <<04870>>24282000
      BEGIN                                                    <<04870>>24284000
                                                               <<04870>>24286000
           <<we get here because we found a keyword used only>><<04870>>24288000
           <<by DBSTORE.  Therefore, we now check to see if  >><<04870>>24290000
           <<it is being used by STORE or RESTORE.  If       >><<04870>>24292000
           <<it is, we tell the user that this is an unknown >><<04870>>24294000
           << STORE / RESTORE option...                      >><<04870>>24296000
                                                               <<04870>>24298000
      IF NOT DBSTORE'TOG THEN     <<STORE or RESTORE bad>>     <<04870>>24300000
         UNKNOWN'OPTION;                                       <<04870>>24302000
                                                               <<04870>>24304000
      END <<ASSURE'DBSTORING SUB>>;                            <<04870>>24306000
   <<------------------->>                                              24308000
   SUBROUTINE GET'FILE'PART (ERR1, ERR2);                               24310000
            VALUE   ERR1, ERR2;                                         24312000
            INTEGER ERR1, ERR2;                                         24314000
      BEGIN                                                             24316000
                                                                        24318000
      STEPIT;                                                           24320000
      IF ITEMP <> "=" THEN                                              24322000
         ERR (ERR1);                                                    24324000
                                                                        24326000
      STEPIT;                                                           24328000
                                                                        24330000
      IF ITEMP = "*" THEN                                               24332000
         ERR (ERR2);                                                    24334000
                                                                        24336000
      IF PARSE'NAME (ITEMP, ILEN) > 0 THEN                              24338000
         ERR (ERR2);                                                    24340000
                                                                        24342000
      END <<GET'FILE'PART SUB>>;                                        24344000
   <<------------------->>                                              24346000
                                                                        24348000
   PARSE'OTHER'PARMS := GOOD;            <<assume no problems>>         24350000
                                                                        24352000
   ITEMP'OFFSET:=OPTIONS'INX;                                           24354000
   UNSTEPIT;                                                            24356000
   STEPIT;                                                              24358000
                                                                        24360000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        24362000
   IF DEBUGGING THEN                                                    24364000
      BEGIN                                                             24366000
      SAY "INSIDE PARSEOTHER" ENDSAY;                                   24368000
      DEBUG'SCANNER;                                                    24370000
      END;                                                              24372000
$IF                           <<DEBUGGING CODE>>                        24374000
                                                                        24376000
   WHILE ICLASS ISNT ENDLINEv DO                                        24378000
      BEGIN                                                             24380000
                                                                        24382000
            <<allow redundant semicolons...>>                           24384000
                                                                        24386000
      WHILE ITEMP = ";" DO                                              24388000
         IF STEPIT IS ENDLINEv THEN                                     24390000
            GO END'PARSE'OTHER'PARMS;                                   24392000
                                                                        24394000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        24396000
      IF DEBUGGING THEN                                                 24398000
         BEGIN                                                          24400000
         SAY "   IN LOOP"ENDSAY;                                        24402000
         DEBUG'SCANNER;                                                 24404000
         END;                                                           24406000
$IF                           <<DEBUGGING CODE>>                        24408000
                                                                        24410000
         <<---------- ACCT parm ------------->>                         24412000
                                                                        24414000
      IF ILEN = 7 AND ITEMP = "ACCOUNT" OR                              24416000
              ILEN = 4 AND ITEMP = "ACCT"    THEN                       24418000
         BEGIN                                                          24420000
$IF X3 = OFF THEN             <<DON'T ALLOW UNLESS STAN'S DEBUGGING>>   24422000
         ASSURE'RESTORING;                                              24424000
$IF                                                                     24426000
                                                                        24428000
         IF SEEN'ACCT THEN                                              24430000
            ERR (SR'ACCT'REDUNDANT);                                    24432000
                                                                        24434000
         IF SEEN'LOCAL THEN                                             24436000
            ERR (SR'LOCAL'ACCT);                                        24438000
                                                                        24440000
         GET'FILE'PART (SR'ACCT'EQUAL, SR'ACCT'INVNAME);                24442000
                                                                        24444000
         MOVE RES'ACCT':=ITEMP,(ILEN);                                  24446000
                                                                        24448000
               <<do security check for account.  (see   >>              24450000
               <<if user is specifying logon account)...>>              24452000
                                                                        24454000
         IF NOT CAP'SM THEN                                             24456000
            IF SCRATCH' <> LOGON'ACCT', (FILE'PART'SIZE) THEN           24458000
               ERR (SR'NEED'SM);                                        24460000
                                                                        24462000
         SEEN'ACCT:=TRUE;                                               24464000
                                                                        24466000
         END                                                            24468000
                                                                        24470000
$IF X3=ON THEN                <<STAN'S STUFF>>                          24472000
      ELSE IF ILEN = 5 AND ITEMP = "ATTIO" THEN                         24474000
         SEEN'ATTIO:=TRUE                                               24476000
$IF                           <<STAN'S STUFF>>                          24478000
         <<---------- CREATE parm ---------->>                          24480000
                                                                        24482000
      ELSE IF ILEN = 6 AND ITEMP = "CREATE" THEN                        24484000
         BEGIN                                                          24486000
                                                                        24488000
         ASSURE'RESTORING;                                              24490000
                                                                        24492000
         IF NOT(CAP'SM) AND NOT(CAP'AM) THEN                            24494000
            ERR (RS'CREATE'SM'OR'AM);                                   24496000
                                                                        24498000
         IF SEEN'CREATE THEN                                            24500000
            WARN (RS'CREATE'REDUNDANT);                                 24502000
                                                                        24504000
         SEEN'CREATE := TRUE;                                           24506000
                                                                        24508000
         STEPIT;                                                        24510000
                                                                        24512000
         IF ITEMP = "=" THEN                                            24514000
            BEGIN                                                       24516000
            DO                                                          24518000
               BEGIN                                                    24520000
                                                                        24522000
               STEPIT;                                                  24524000
                                                                        24526000
                     <<If ICLASS <> TOKENv, we got a definite           24528000
                       error..>>                                        24530000
                                                                        24532000
               IF ICLASS ISNT TOKENv THEN                               24534000
                  ERR (RS'CREATE'OPT'EXPECTED);                         24536000
                                                                        24538000
               IF (ILEN = 4 LAND ITEMP = "ACCT") OR                     24540000
                  (ILEN = 7 LAND ITEMP = "ACCOUNT") THEN                24542000
                     BEGIN                                              24544000
                        IF NOT CAP'AM THEN                              24546000
                           ERR (RS'CREATE'SM);                          24548000
                        CREATE'ACCT'FLAG:=TRUE;                         24550000
                     END                                                24552000
                                                                        24554000
               ELSE IF ILEN = 5 AND ITEMP = "GROUP" THEN                24556000
                     CREATE'GROUP'FLAG:=TRUE                            24558000
                                                                        24560000
               ELSE IF ILEN = 7 AND ITEMP = "CREATOR" THEN              24562000
                  CREATE'USER'FLAG:=TRUE                                24564000
                                                                        24566000
                                                                        24568000
               ELSE                                                     24570000
                  ERR (RS'CREATE'OPT'UNKNOWN);                          24572000
                                                                        24574000
                     <<allow ",", ";", or end-of-line...>>              24576000
                                                                        24578000
               STEPIT;                                                  24580000
                                                                        24582000
               END                                                      24584000
            UNTIL                                                       24586000
               ITEMP <> ",";                                            24588000
            END                                                         24590000
         ELSE                                                           24592000
            BEGIN                                                       24594000
               IF CAP'SM THEN                                           24596000
                  BEGIN                                                 24598000
                  CREATE'ACCT'FLAG := TRUE;                             24600000
                  END;                                                  24602000
               IF CAP'AM THEN                                           24604000
                  BEGIN                                                 24606000
                  CREATE'GROUP'FLAG := TRUE;                            24608000
                  CREATE'USER'FLAG  := TRUE;                            24610000
                  END;                                                  24612000
            END;                                                        24614000
                                                                        24616000
                                                                        24618000
               <<we are either pointing at a semicolon (good)           24620000
                 an end-of-line (good) or something else (bad)...       24622000
                 so we UNSTEPIT so that the outer block will            24624000
                 re-examine the token...>>                              24626000
                                                                        24628000
         UNSTEPIT;                                                      24630000
                                                                        24632000
         END                                                            24634000
                                                                        24636000
         <<---------- CREATOR parm ------->>                            24638000
                                                                        24640000
      ELSE IF ILEN = 7 AND ITEMP = "CREATOR" THEN                       24642000
         BEGIN                                                          24644000
                                                                        24646000
         ASSURE'RESTORING;                                              24648000
                                                                        24650000
         IF SEEN'CREATOR THEN                                           24652000
            ERR (SR'CREATOR'REDUNDANT);                                 24654000
                                                                        24656000
               <<do further security checks in CXSTORERESTORE>>         24658000
                                                                        24660000
         STEPIT;                                                        24662000
         IF ITEMP <> "=" THEN                                  <<LB.RS>>24664000
            BEGIN                                              <<LB.RS>>24664100
            UNSTEPIT;                                          <<LB.RS>>24664200
            BLANK'CREATOR := TRUE;                             <<LB.RS>>24664300
            END                                                <<LB.RS>>24664400
         ELSE                                                           24666000
            BEGIN                                                       24668000
               UNSTEPIT;                                                24670000
               GET'FILE'PART (SR'CREATOR'EQUAL, SR'CREATOR'INVNAME);    24672000
               MOVE RES'CREATOR' := ITEMP,(ILEN);                       24674000
            END;                                                        24676000
                                                                        24678000
                                                                        24680000
         SEEN'CREATOR:=TRUE;                                            24682000
                                                                        24684000
         END                                                            24686000
                                                                        24688000
         <<---------- DATE parm ---------->>                            24690000
                                                                        24692000
      ELSE IF ILEN = 4 AND ITEMP = "DATE"  OR                           24694000
            ILEN = 5 AND ITEMP = "DATES" THEN                           24696000
         BEGIN                                                          24698000
         ASSURE'STORING;                                                24700000
                                                                        24702000
         STEPIT;                                                        24704000
                                                                        24706000
         IF SEEN'DATE THEN             <<already specified...>>         24708000
            WARN (SR'DATE'REDUNDANT);                                   24710000
                                                                        24712000
         IF ITEMP = "<" THEN                                            24714000
            USE'ADATE:=TRUE                                             24716000
         ELSE IF ITEMP = ">" THEN                                       24718000
            USE'ADATE:=FALSE                                            24720000
         ELSE                 <<unexpected delimiter>>                  24722000
            ERR (SR'DATE'LTGT);                                         24724000
                                                                        24726000
         STEPIT;          <<check for equal sign>>                      24728000
                                                                        24730000
         IF ITEMP <> "=" THEN                                           24732000
            ERR (SR'DATE'EQUAL);                                        24734000
                                                                        24736000
                              <<check for valid date...>>               24738000
         STEPIT;                                                        24740000
                                                                        24742000
         IF PARSE'DATE (PDATE) = FAILED THEN                            24744000
            ERR (0);                                                    24746000
                                                                        24748000
         IF USE'ADATE THEN                                              24750000
            ADATE'HIGH := PDATE                                         24752000
         ELSE                                                           24754000
            MDATE'LOW := PDATE;                                         24756000
                                                                        24758000
         SEEN'DATE:=TRUE;                                               24760000
                                                                        24762000
         END                                                            24764000
                                                                        24766000
         <<---------- DENSITY parm ---------->>                         24768000
                                                                        24770000
      ELSE IF ILEN = 7 AND ITEMP = "DENSITY" OR                         24772000
              ILEN = 3 AND ITEMP = "DEN" THEN                           24774000
         BEGIN                                                          24776000
                                                                        24778000
         ASSURE'SYSDUMPING;                                             24780000
                                                                        24782000
         IF SEEN'DENSITY THEN                                           24784000
            ERR (SR'DENSITY'REDUNDANT);                                 24786000
                                                                        24788000
         STEPIT;                                                        24790000
                                                                        24792000
         IF ITEMP <> "=" THEN                                           24794000
            ERR (SR'DENSITY'EQUAL);                                     24796000
                                                                        24798000
         STEPIT;                                                        24800000
                                                                        24802000
         IF ICLASS IS NUMBERv THEN                                      24804000
            BEGIN                                                       24806000
          <<IF SUBCLASS = 0 THEN                                        24808000
               ERR (SR'DENSITY'0); >>                                   24810000
            DENSITY:=SUBCLASS;                                          24812000
            END                                                         24814000
         ELSE                                                           24816000
            ERR (SR'DENSITY'EXPECTED);                                  24818000
                                                                        24820000
         SEEN'DENSITY:=TRUE;                                            24822000
         END                                                            24824000
                                                                        24826000
         <<---------- DEV parm ---------->>                             24828000
                                                                        24830000
      ELSE IF ILEN = 3 AND ITEMP = "DEV" THEN                           24832000
         BEGIN                                                          24834000
                                                                        24836000
         ASSURE'RESTORING;    <<someday, allow for STORE>>              24838000
                                                                        24840000
         IF SEEN'DEV THEN                                               24842000
            WARN (SR'DEV'REDUNDANT);                                    24844000
                                                                        24846000
         STEPIT;                                                        24848000
                                                                        24850000
         IF ITEMP <> "=" THEN                                           24852000
            ERR (SR'DEV'EQUAL);                                         24854000
                                                                        24856000
         STEPIT;                                                        24858000
                                                                        24860000
         IF ICLASS IS NUMBERv AND ILEN < 9 THEN                         24862000
            BEGIN                                                       24864000
            IF SUBCLASS = 0 THEN                                        24866000
               ZERO'DEV'FLAG:=TRUE                                      24868000
            ELSE IF STORING THEN                                        24870000
               ERR (SR'ONLY'0'DEV);                                     24872000
            END                                                         24874000
         ELSE IF STORING THEN                                           24876000
            ERR (SR'ONLY'0'DEV)                                         24878000
         ELSE                                                           24880000
            BEGIN                                                       24882000
            CASE PARSE'NAME (ITEMP, ILEN) OF                            24884000
               BEGIN                                                    24886000
                                                                        24888000
               <<PN'OK: (0) >>                                          24890000
                  ;                                                     24892000
                                                                        24894000
               <<PN'NAME'TOO'LONG:  (1) >>                              24896000
                  ERR (SR'DEV'TOO'LONG);                                24898000
                                                                        24900000
               <<PN'EMPTY'NAME:     (2) >>                              24902000
                  ERR (SR'DEV'NOT'FOUND);                               24904000
                                                                        24906000
               <<PN'BACK'ILLEGAL:   (3) >>                              24908000
                  ERR (SR'DEV'BACK'ILLEGAL);                            24910000
                                                                        24912000
               <<PN'MUST'START'WITH'ALPHA: (4) >>                       24914000
                  ERR (SR'DEV'MUST'START'WITH'ALPHA);                   24916000
                                                                        24918000
               <<PN'ILLEGAL'CHARACTER: (5) >>                           24920000
                  ERR (SR'DEV'SPECIAL);                                 24922000
                                                                        24924000
               <<PN'WILDCARDS'ILLEGAL: (6) >>                           24926000
                  ERR (SR'DEV'WILDCARDS)                                24928000
               END;                                                     24930000
            END;                                                        24932000
                                                                        24934000
         SEEN'DEV:=TRUE;                                                24936000
                                                                        24938000
         IF ZERO'DEV'FLAG THEN                                          24940000
            MOVE DEVICE':="DISC", 2                                     24942000
         ELSE                                                           24944000
            MOVE DEVICE':=ITEMP,(ILEN), 2;                              24946000
         MOVE *:=" ";                                                   24948000
                                                                        24950000
               <<validate DEVICE'...>>                                  24952000
                                                                        24954000
         IF GETDEVINFO (DEVICE', DEVICEINFO) <> 0 THEN                  24956000
            ERR (SR'DEV'CLASS'INVALID);                                 24958000
                                                                        24960000
         IF DEVICEINFO (1).(10:3) <> 0 THEN       <<NOT DISK>> <<LB.RS>>24962000
            ERR (SR'DEV'NOT'DISC);                                      24964000
                                                                        24966000
         END                                                            24968000
                                                                        24970000
         <<---------- FILES parm ---------->>                           24972000
                                                                        24974000
      ELSE IF ILEN = 5 AND ITEMP = "FILES" THEN                         24976000
         BEGIN                                                          24978000
         IF SEEN'FILES THEN             <<redundant specification>>     24980000
            WARN (SR'FILES'REDUNDANT);                                  24982000
                                                                        24984000
         STEPIT;                                                        24986000
                                                                        24988000
         IF ITEMP <> "=" THEN       <<missing count>>                   24990000
            ERR (SR'FILES'EQUAL);                                       24992000
                                                                        24994000
         IF STEPIT IS NUMBERv THEN                                      24996000
            G'NUM'FSIZE:=DOUBLE(SUBCLASS)                               24998000
         ELSE IF ICLASS IS DNUMBERv THEN                                25000000
            G'NUM'FSIZE:=SUBCLASS'D                                     25002000
         ELSE IF ICLASS IS TOKENv THEN                                  25004000
            IF SUBCLASS IS DNUMBERv THEN                                25006000
               ERR (SR'NUMBER'TOO'BIG)                                  25008000
            ELSE IF SUBCLASS IS DNUMBERv THEN                           25010000
               ERR (SR'DNUMBER'TOO'BIG)                                 25012000
            ELSE                                                        25014000
               ERR (SR'FILE'COUNT'EXPECTED)                             25016000
         ELSE                                                           25018000
            ERR (SR'FILE'COUNT'EXPECTED);                               25020000
                                                                        25022000
         IF G'NUM'FSIZE <= 0D THEN                                      25024000
            ERR (SR'FILE'COUNT'EXPECTED);                               25026000
                                                                        25028000
         SEEN'FILES:=TRUE;                                              25030000
                                                                        25032000
         END                                                            25034000
                                                                        25036000
         <<---------- GROUP parm ------------>>                         25038000
                                                                        25040000
      ELSE IF ILEN = 5 AND ITEMP = "GROUP" THEN                         25042000
         BEGIN                                                          25044000
$IF X3 = OFF THEN             <<DON'T ALLOW UNLESS STAN'S DEBUGGING>>   25046000
         ASSURE'RESTORING;                                              25048000
$IF                                                                     25050000
                                                                        25052000
         IF SEEN'GROUP THEN                                             25054000
            ERR (SR'GROUP'REDUNDANT);                                   25056000
                                                                        25058000
         IF SEEN'LOCAL THEN                                             25060000
            ERR (SR'LOCAL'GROUP);                                       25062000
                                                                        25064000
         GET'FILE'PART (SR'GROUP'EQUAL, SR'GROUP'INVNAME);              25066000
                                                                        25068000
         MOVE RES'GROUP':=ITEMP,(ILEN);                                 25070000
                                                                        25072000
               <<do security check...see if user has                    25074000
                 specified his/her logon group...    >>                 25076000
                                                                        25078000
         IF NOT (CAP'SM LOR CAP'AM) THEN                                25080000
            IF LOGON'GROUP' <> RES'GROUP', (FILE'PART'SIZE) THEN        25082000
               ERR (SR'NEED'AM);                                        25084000
                                                                        25086000
         SEEN'GROUP:=TRUE;                                              25088000
                                                                        25090000
         END                                                            25092000
         <<---------- HIGH  parm ---------->>                  <<04870>>25094000
                                                               <<04870>>25096000
      ELSE IF ILEN = 4 AND ITEMP = "HIGH" THEN                 <<04870>>25098000
         BEGIN                                                 <<04870>>25100000
                                                               <<04870>>25102000
         ASSURE'DBSTORING;                                     <<04870>>25104000
                                                               <<04870>>25106000
         IF SEEN'HIGH  THEN     <<redundant specification>>    <<04870>>25108000
            WARN (SR'HIGH'REDUNDANT);                          <<04870>>25110000
                                                               <<04870>>25112000
         STEPIT;                                               <<04870>>25114000
                                                               <<04870>>25116000
         IF ITEMP <> "=" THEN       <<missing count>>          <<04870>>25118000
            ERR (SR'HIGH'EQUAL);                               <<04870>>25120000
                                                               <<04870>>25122000
         IF STEPIT IS NUMBERv THEN                             <<04870>>25124000
            DBSTORE'HIGH := SUBCLASS                           <<04870>>25126000
         ELSE                                                  <<04870>>25128000
            ERR (SR'HIGH'NO'EXPECTED);                         <<04870>>25130000
                                                                        25132000
                                                               <<04870>>25134000
         IF (DBSTORE'HIGH < 0) OR (DBSTORE'HIGH > 99) THEN     <<04870>>25136000
            ERR (SR'HIGH'NO'EXPECTED);                         <<04870>>25138000
                                                               <<04870>>25140000
         IF (DBSTORE'HIGH < DBSTORE'LOW) THEN                  <<04870>>25142000
            ERR (SR'HIGH'IS'LOWER'THAN'LOW);                   <<04870>>25144000
                                                               <<04870>>25146000
         SEEN'HIGH :=TRUE;                                     <<04870>>25148000
                                                               <<04870>>25150000
         END                                                   <<04870>>25152000
                                                               <<04870>>25154000
         <<---------- KEEP parm ---------->>                            25156000
                                                                        25158000
      ELSE IF ILEN = 4 AND ITEMP = "KEEP" THEN                          25160000
         BEGIN                                                          25162000
         ASSURE'RESTORING;                                              25164000
                                                                        25166000
         IF SEEN'KEEP THEN                                              25168000
            SENDMESSAGE (SR'KEEP'REDUNDANT);                            25170000
                                                                        25172000
         IF SEEN'NOKEEP THEN                                            25174000
            ERR (SR'NOKEEP'KEEP);                                       25176000
                                                                        25178000
         KEEP'FLAG:= 1;                                                 25180000
                                                                        25182000
         SEEN'KEEP:=TRUE;                                               25184000
                                                                        25186000
         END                                                            25188000
                                                                        25190000
         <<---------- LDEV ---------->>                                 25192000
                                                                        25194000
      ELSE IF ILEN = 4 AND ITEMP = "LDEV" THEN                          25196000
         BEGIN                                                          25198000
         ASSURE'SYSDUMPING;                                             25200000
                                                                        25202000
         STEPIT;                                                        25204000
                                                                        25206000
         IF ITEMP <> "=" THEN                                           25208000
            ERR (SR'LDEV'EQUAL);                                        25210000
                                                                        25212000
         IF STEPIT ISNT NUMBERv THEN                                    25214000
            ERR (SR'LDEV'EXPECTED);                                     25216000
                                                                        25218000
         TAPE'LDEV:=SUBCLASS;                                           25220000
         END                                                            25222000
                                                                        25224000
         <<---------- LOCAL ------------->>                             25226000
                                                                        25228000
      ELSE IF ILEN = 5 AND ITEMP = "LOCAL" THEN                         25230000
         BEGIN                                                          25232000
$IF X3 = OFF THEN             <<DON'T ALLOW UNLESS STAN'S DEBUGGING>>   25234000
         ASSURE'RESTORING;                                              25236000
$IF                                                                     25238000
         LOCAL'FLAG:=1;       <<don't bother checking for prior LOCAL>> 25240000
                                                                        25242000
         IF SEEN'LOCAL THEN                                             25244000
            SENDMESSAGE (SR'LOCAL'REDUNDANT);                           25246000
                                                                        25248000
         IF SEEN'GROUP THEN                                             25250000
            ERR (SR'GROUP'LOCAL);     <<GROUP specified>>               25252000
                                                                        25254000
         IF SEEN'ACCT THEN                                              25256000
            ERR (SR'ACCT'LOCAL);                                        25258000
                                                                        25260000
               <<setup RES'GROUP', and RES'ACCT'...>>                   25262000
                                                                        25264000
         MOVE RES'GROUP':=LOGON'GROUP',(FILE'PART'SIZE);                25266000
         MOVE RES'ACCT':=LOGON'ACCT',(FILE'PART'SIZE);                  25268000
                                                                        25270000
         SEEN'LOCAL:=TRUE;                                              25272000
                                                                        25274000
         END                                                            25276000
                                                                        25278000
$IF X3=ON THEN                <<STAN'S STUFF>>                          25280000
         <<---------- LOCK parm ---------->>                            25282000
                                                                        25284000
      ELSE IF ILEN = 4 AND ITEMP = "LOCK" THEN                          25286000
         BEGIN                                                          25288000
         IF SEEN'LOCK THEN                                              25290000
            SENDMESSAGE (SR'LOCK'REDUNDANT);                            25292000
                                                                        25294000
         STEPIT;                                                        25296000
                                                                        25298000
         IF ITEMP <> "=" THEN                                           25300000
            ERR (SR'LOCK'EQUAL);                                        25302000
                                                                        25304000
         IF STEPIT IS ENDLINEv THEN                                     25306000
            ERR (SR'LOCK'EMPTY);                                        25308000
                                                                        25310000
         IF ILEN = 5 AND ITEMP = "DELAY" THEN                           25312000
            LOCKING'TYPE := LOCK'DELAYv                                 25314000
                                                                        25316000
         ELSE IF ILEN = 4 AND ITEMP = "WAIT" THEN                       25318000
            LOCKING'TYPE := LOCK'WAITv                                  25320000
                                                                        25322000
         ELSE IF ((ILEN = 2) LAND (ITEMP = "NO"))                       25324000
              OR ((ILEN = 4) LAND (ITEMP = "NONE")) THEN                25326000
            BEGIN                                                       25328000
            LOCKING'TYPE := LOCK'NONEv;                                 25330000
            SENDMESSAGE (SR'LOCK'INTEGRITY);                            25332000
            END                                                         25334000
         ELSE                                                           25336000
            ERR (SR'LOCK'EMPTY);                                        25338000
                                                                        25340000
         SEEN'LOCK:=TRUE;                                               25342000
                                                                        25344000
         END                                                            25346000
$IF                           <<STAN'S STUFF>>                          25348000
         <<---------- LOW  parm ---------->>                   <<04870>>25350000
                                                               <<04870>>25352000
      ELSE IF ILEN = 3 AND ITEMP = "LOW" THEN                  <<04870>>25354000
         BEGIN                                                 <<04870>>25356000
                                                               <<04870>>25358000
         ASSURE'DBSTORING;                                     <<04870>>25360000
                                                               <<04870>>25362000
         IF SEEN'LOW   THEN  <<redundant specification>>       <<04870>>25364000
            WARN (SR'LOW'REDUNDANT);                           <<04870>>25366000
                                                               <<04870>>25368000
         STEPIT;                                               <<04870>>25370000
                                                               <<04870>>25372000
         IF ITEMP <> "=" THEN       <<missing count>>          <<04870>>25374000
            ERR (SR'LOW'EQUAL);                                <<04870>>25376000
                                                               <<04870>>25378000
         IF STEPIT IS NUMBERv THEN                             <<04870>>25380000
            DBSTORE'LOW := SUBCLASS                            <<04870>>25382000
         ELSE                                                  <<04870>>25384000
            ERR (SR'LOW'NO'EXPECTED);                          <<04870>>25386000
                                                               <<04870>>25388000
         IF (DBSTORE'LOW < 0) OR (DBSTORE'LOW > 99) THEN       <<04870>>25390000
            ERR (SR'LOW'NO'EXPECTED);                          <<04870>>25392000
                                                               <<04870>>25394000
         IF (DBSTORE'HIGH < DBSTORE'LOW) THEN                  <<04870>>25396000
            ERR (SR'LOW'IS'HIGHER'THAN'HIGH);                  <<04870>>25398000
                                                               <<04870>>25400000
         SEEN'LOW :=TRUE;                                      <<04870>>25402000
                                                               <<04870>>25404000
         END                                                   <<04870>>25406000
                                                               <<04870>>25408000
         <<---------- NEWDATE parm ---------->>                         25410000
                                                                        25412000
      ELSE IF ILEN = 7 AND ITEMP = "NEWDATE" THEN                       25414000
         BEGIN                         <<opposite of OLDDATE>>          25416000
         ASSURE'RESTORING;                                              25418000
         IF SEEN'OLDDATE THEN                                           25420000
            ERR (SR'OLDDATE'NEWDATE);                                   25422000
         IF SEEN'NEWDATE THEN                                           25424000
            WARN (SR'NEWDATE'REDUNDANT);                                25426000
         OLDDATE'FLAG:= 0;                                              25428000
         SEEN'NEWDATE:=TRUE;                                            25430000
         END                                                            25432000
                                                                        25434000
         <<---------- NOKEEP parm ----------->>                         25436000
                                                                        25438000
      ELSE IF ILEN = 6 AND ITEMP = "NOKEEP" THEN                        25440000
         BEGIN                                                          25442000
         ASSURE'RESTORING;                                              25444000
         IF SEEN'KEEP THEN                                              25446000
            ERR (SR'KEEP'NOKEEP);                                       25448000
         IF SEEN'NOKEEP THEN                                            25450000
            WARN (SR'NOKEEP'REDUNDANT);                                 25452000
         KEEP'FLAG:=0;                                                  25454000
         SEEN'NOKEEP:=TRUE;                                             25456000
         END                                                            25458000
                                                                        25460000
         <<---------- OLDDATE parm ---------->>                         25462000
                                                                        25464000
      ELSE IF ILEN = 7 AND ITEMP = "OLDDATE" THEN                       25466000
         BEGIN                                                          25468000
         ASSURE'RESTORING;                                              25470000
         IF SEEN'NEWDATE THEN                                           25472000
            ERR (SR'NEWDATE'OLDDATE);                                   25474000
         IF SEEN'OLDDATE THEN                                           25476000
            WARN (SR'OLDDATE'REDUNDANT);                                25478000
         OLDDATE'FLAG:= 1;                                              25480000
         SEEN'OLDDATE:=TRUE;                                            25482000
         END                                                            25484000
                                                                        25486000
         <<---------- ONERROR/ONERR parm ------->>                      25488000
                                                                        25490000
      ELSE IF ILEN = 7 AND ITEMP = "ONERROR" OR                         25492000
              ILEN = 5 AND ITEMP = "ONERR" THEN                         25494000
         BEGIN                                                          25496000
                                                                        25498000
         STEPIT;                                                        25500000
                                                                        25502000
         IF SEEN'ONERR THEN                                             25504000
            WARN (SR'ONERR'REDUNDANT);                                  25506000
                                                                        25508000
         IF ITEMP <> "=" THEN                                           25510000
            ERR (SR'ONERR'EQUAL);                                       25512000
                                                                        25514000
         STEPIT;                                                        25516000
                                                                        25518000
         IF ILEN = 4 AND ITEMP = "QUIT" THEN                            25520000
            ON'ERR:= ONERR'QUIT                                         25522000
         ELSE IF ILEN = 4 AND ITEMP = "REDO" THEN                       25524000
            BEGIN                                                       25526000
            ASSURE'STORING;                                             25528000
            ON'ERR:= ONERR'REDO;                                        25530000
            END                                                         25532000
         ELSE IF ILEN = 4 AND ITEMP = "SKIP" THEN                       25534000
            BEGIN                                                       25536000
            ASSURE'RESTORING;                                           25538000
            ON'ERR:= ONERR'SKIPFILE;                                    25540000
            END                                                         25542000
         ELSE IF ILEN = 8 AND ITEMP = "SKIPFILE" THEN                   25544000
            BEGIN                                                       25546000
            ASSURE'RESTORING;                                           25548000
            ON'ERR:= ONERR'SKIPFILE;                                    25550000
            END                                                         25552000
         ELSE IF ILEN = 10 AND ITEMP = "SKIPRECORD" THEN                25554000
            BEGIN                                                       25556000
            ASSURE'RESTORING;                                           25558000
            ON'ERR:= ONERR'SKIPFILE;                                    25560000
            END                                                         25562000
         ELSE IF RESTORING THEN                                         25564000
            ERR (RS'ONERR'OPTION'UNKNOWN)                               25566000
         ELSE                                                           25568000
            ERR (SR'ONERR'OPTION'UNKNOWN);                              25570000
                                                                        25572000
         SEEN'ONERR:=TRUE;                                              25574000
                                                                        25576000
         END                                                            25578000
                                                                        25580000
         <<---------- RECSIZE parm ---------->>                         25582000
                                                                        25584000
      ELSE IF ILEN = 7 AND ITEMP = "RECSIZE" THEN                       25586000
         BEGIN                                                          25588000
                                                                        25590000
         ASSURE'SYSDUMPING;                                             25592000
                                                                        25594000
         IF SEEN'RECSIZE THEN                                           25596000
            ERR (SR'RECSIZE'REDUNDANT);                                 25598000
                                                                        25600000
         STEPIT;                                                        25602000
                                                                        25604000
         IF ITEMP <> "=" THEN                                           25606000
            ERR (SR'RECSIZE'EQUAL);                                     25608000
                                                                        25610000
         STEPIT;                                                        25612000
                                                                        25614000
         IF ICLASS IS NUMBERv THEN                                      25616000
            BEGIN                                                       25618000
            IF SUBCLASS = 0 THEN                                        25620000
               ERR (SR'RECSIZE'0);                                      25622000
            RECSIZE'INIT:=SUBCLASS;                                     25624000
            END                                                         25626000
         ELSE                                                           25628000
            ERR (SR'RECSIZE'EXPECTED);                                  25630000
                                                                        25632000
         SEEN'RECSIZE:=TRUE;                                            25634000
         END                                                            25636000
                                                                        25638000
         <<---------- PURGE   parm ---------->>                         25638100
                                                                        25638200
      ELSE IF ILEN = 5 AND ITEMP = "PURGE" THEN                         25638300
         BEGIN                                                          25638400
         ASSURE'STORING;                                                25638500
         SEEN'PURGE := TRUE;                                            25638600
         END                                                            25638700
                                                                        25638800
         <<---------- RELEASE parm ---------->>                         25640000
                                                                        25642000
      ELSE IF ILEN = 7 AND ITEMP = "RELEASE" THEN                       25644000
         BEGIN                                                          25646000
         ASSURE'STORING;                                                25648000
         IF SEEN'RELEASE THEN                                           25650000
            WARN (SR'RELEASE'REDUNDANT);                                25652000
         RELEASE'FLAG:=1;                                               25654000
         SEEN'RELEASE:=TRUE;                                            25656000
         END                                                            25658000
                                                                        25660000
         <<---------- SHOW parm ---------->>                            25662000
                                                                        25664000
      ELSE IF ILEN = 4 AND ITEMP = "SHOW" THEN                          25666000
         BEGIN                                                          25668000
                                                                        25670000
         IF SEEN'SHOW THEN                                              25672000
            WARN (SR'SHOW'REDUNDANT);                                   25674000
                                                                        25676000
         SHOW'FLAG:=1;                                                  25678000
                                                                        25680000
         STEPIT;                                                        25682000
                                                                        25684000
         IF ITEMP = "=" THEN                                            25686000
            BEGIN                                                       25688000
            DO                                                          25690000
               BEGIN                                                    25692000
               STEPIT;                                                  25694000
                                                                        25696000
                     <<If ICLASS <> TOKENv, we got a definite           25698000
                       error..>>                                        25700000
                                                                        25702000
               IF ICLASS ISNT TOKENv THEN                               25704000
                  ERR (SR'SHOW'OPT'EXPECTED);                           25706000
                                                                        25708000
               IF ILEN = 5 AND ITEMP = "DATES" THEN                     25710000
                  SHOW'DATES'FLAG:=TRUE                                 25712000
                                                                        25714000
               ELSE IF ILEN = 4 AND ITEMP = "LONG" THEN                 25716000
                  BEGIN                                                 25718000
                  IF SEEN'SHOW'SHORT THEN                               25720000
                     SENDMESSAGE (SR'SHORT'USED)                        25722000
                  ELSE                                                  25724000
                     BEGIN                                              25726000
                     SHOW'LONG'FLAG:=TRUE;                              25728000
                     SEEN'SHOW'LONG:=TRUE;                              25730000
                     END;                                               25732000
                  END                                                   25734000
                                                                        25736000
               ELSE IF ILEN = 7 AND ITEMP = "OFFLINE" THEN              25738000
                  SHOW'OFFLINE'FLAG:=TRUE                               25740000
                                                                        25742000
               ELSE IF ILEN = 8 AND ITEMP = "SECURITY" THEN             25744000
                  SHOW'SECURITY'FLAG:=TRUE                              25746000
                                                                        25748000
               ELSE IF ILEN = 5 AND ITEMP = "SHORT" THEN                25750000
                  BEGIN                                                 25752000
                  IF SEEN'SHOW'LONG THEN                                25754000
                     SENDMESSAGE (SR'LONG'USED)                         25756000
                  ELSE                                                  25758000
                     BEGIN                                              25760000
                     SHOW'SHORT'FLAG:=TRUE;                             25762000
                     SEEN'SHOW'SHORT:=TRUE;                             25764000
                     END;                                               25766000
                  END                                                   25768000
                                                                        25770000
               ELSE                                                     25772000
                  ERR (SR'SHOW'OPT'UNKNOWN);                            25774000
                                                                        25776000
                     <<allow ",", ";", or end-of-line...>>              25778000
                                                                        25780000
               STEPIT;                                                  25782000
                                                                        25784000
               END                                                      25786000
            UNTIL                                                       25788000
               ITEMP <> ",";                                            25790000
            END;                                                        25792000
                                                                        25794000
               <<we are either pointing at a semicolon (good)           25796000
                 an end-of-line (good) or something else (bad)...       25798000
                 so we UNSTEPIT so that the outer block will            25800000
                 re-examine the token...>>                              25802000
                                                                        25804000
         UNSTEPIT;                                                      25806000
                                                                        25808000
         SEEN'SHOW:=TRUE;                                               25810000
                                                                        25812000
         END                                                            25814000
                                                                        25816000
         <<---------- STARTHERE parm-------->>                          25818000
      ELSE IF ILEN = 9 AND ITEMP = "STARTHERE" THEN                     25820000
         BEGIN                                                          25822000
         ASSURE'RESTORING;                                              25824000
         SEEN'STARTHERE := TRUE;                                        25826000
         END                                                            25828000
                                                                        25830000
         <<---------- SYNTAX parm ---------->>                          25832000
                                                                        25834000
      ELSE IF ILEN = 6 AND ITEMP = "SYNTAX" THEN                        25836000
         SYNTAX'TOG:=TRUE                                               25838000
                                                                        25840000
         <<---------- TIME parm   ---------------->>                    25844000
                                                                        25846000
      ELSE IF ILEN = 4 AND ITEMP = "TIME" THEN                          25848000
         SEEN'TIME := TRUE                                              25850000
                                                                        25852000
$IF X3=ON THEN                                                          25853000
         <<---------- UPDATE parm ---------------->>                    25854000
                                                                        25856000
      ELSE IF ILEN = 6 AND ITEMP = "UPDATE" THEN                        25858000
         UPDATE'TOG:=TRUE                                               25860000
$IF                           <<STAN'S STUFF>>                          25862000
                                                                        25864000
         <<---------- unknown parm ---------->>                         25866000
                                                                        25868000
      ELSE IF ICLASS IS TOKENV THEN                                     25870000
         UNKNOWN'OPTION                                                 25872000
      ELSE                                                              25874000
         ERR (SR'SEMI'EXPECTED);                                        25876000
                                                                        25878000
                                                                        25880000
            <<we just parsed an option.  Options MUST be followed       25882000
              by either a semicolon (;) or and end-of-line...>>         25884000
                                                                        25886000
      IF STEPIT ISNT ENDLINEv THEN                                      25888000
         IF ITEMP <> ";" THEN                                           25890000
            ERR (SR'SEMI'EXPECTED)                                      25892000
         ELSE                                                           25894000
            STEPIT;           <<get token after ";">>                   25896000
                                                                        25898000
                                                                        25900000
      END;                                                              25902000
                                                                        25904000
                                                                        25906000
END'PARSE'OTHER'PARMS:                                                  25908000
                                                                        25910000
         <<if the user is interactive AND has a small line              25912000
           width (which he/she usually will) AND has not                25914000
           explicitly said SHOW=LONG, but has requested SHOW,           25916000
           then we want to give him/her one line outputs, which         25918000
           requires the SHORT flag to be set!...>>                      25920000
                                                                        25922000
   IF SHOW'FLAG AND NOT SHOW'LONG'FLAG THEN                             25924000
      IF \SYSLIST'RECSIZE\ < 99 AND MODE.INTERACTIVEbit THEN            25926000
         SHOW'SHORT'FLAG:=TRUE;                                         25928000
                                                                        25930000
   END <<PARSE'OTHER'PARMS PROC>>;                                      25932000
$PAGE ";STORMISC=  PRINT'CARROT --- PRINTS THE INPUT BUFFER AND A CARAT"25934000
$CONTROL SEGMENT=STORMISC                                               25936000
<<***************************************************************>>     25938000
PROCEDURE PRINT'CARROT (INX);                                           25940000
         VALUE INX;                                                     25942000
         INTEGER INX;                                                   25944000
         OPTION UNCALLABLE;                                             25946000
   BEGIN                                                                25948000
                                                                        25950000
                                                                        25952000
   INTEGER ARRAY                                                        25954000
      LINE        (0:36);            <<72 chars + 1 word>>              25956000
                                                                        25958000
   INTEGER                                                              25960000
      LEFT'TO'PRINT,                                                    25962000
      LEN;                                                              25964000
                                                                        25966000
   BYTE ARRAY                                                           25968000
      LINE'     (*) = LINE (0);                                         25970000
                                                                        25972000
   BYTE POINTER                                                         25974000
      PT;                                                               25976000
                                                                        25978000
   <<--------------->>                                                  25980000
   SUBROUTINE PRINT'LINE;                                               25982000
                                                                        25984000
      BEGIN                                                             25986000
                                                                        25988000
      SCAN LINE' UNTIL 0, 1;                                            25990000
      LEN:=TOS-LOGICAL(@LINE');                                         25992000
                                                                        25994000
      IF SYSLIST'NUM <> 0 THEN                                          25996000
         FWRITE (SYSLIST'NUM, LINE, -LEN, 0);                           25998000
                                                                        26000000
      IF OFFLINE'NUM <> 0 THEN                                          26002000
         FWRITE (OFFLINE'NUM, LINE, -LEN, 0);                           26004000
                                                                        26006000
      FILL (LINE, 37, 0);                                               26008000
                                                                        26010000
      END <<PRINT'LINE SUB>>;                                           26012000
   <<---------------->>                                                 26014000
                                                                        26016000
   FILL (LINE, 37, 0);                                                  26018000
                                                                        26020000
   LEFT'TO'PRINT:=INPUTLEN;                                             26022000
                                                                        26024000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        26026000
   IF DEBUGGING THEN                                                    26028000
      BEGIN                                                             26030000
      SAY "PRINT'CARROT ... " ENDSAY;                                   26032000
      SAY "LEFT'TO'PRINT=" ENDSAY;                                      26034000
      SAYNUM(LEFT'TO'PRINT);                                            26036000
      SAY ", INX=" ENDSAY;                                              26038000
      SAYNUM (INX);                                                     26040000
      SEND;                                                             26042000
      END;                                                              26044000
$IF                           <<DEBUGGING CODE>>                        26046000
                                                                        26048000
   @PT:=@COMMAND'TEXT';                                                 26050000
                                                                        26052000
   WHILE LEFT'TO'PRINT > 0 DO                                           26054000
      BEGIN                                                             26056000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        26058000
      IF DEBUGGING THEN                                                 26060000
         BEGIN                                                          26062000
         SAY "LEFT'TO'PRINT=" ENDSAY;                                   26064000
         SAYNUM (LEFT'TO'PRINT);                                        26066000
         SEND;                                                          26068000
         END;                                                           26070000
$IF                           <<DEBUGGING CODE>>                        26072000
      IF (LEN:=LEFT'TO'PRINT) > 72 THEN                                 26074000
         LEN:=72;                                                       26076000
      MOVE LINE':=PT,(LEN);                                             26078000
      @PT:=@PT(LEN);                                                    26080000
      LEFT'TO'PRINT:=LEFT'TO'PRINT-LEN;                                 26082000
      PRINT'LINE;                                                       26084000
      END;                                                              26086000
                                                                        26088000
         <<now print the carat... IFF INX >= 0!!! ...>>                 26090000
                                                                        26092000
   IF INX > INPUTLEN THEN                                               26094000
      LEFT'TO'PRINT:=INPUTLEN + 1                                       26096000
   ELSE                                                                 26098000
      LEFT'TO'PRINT:=INX;                                               26100000
                                                                        26102000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        26104000
   IF DEBUGGING THEN                                                    26106000
      BEGIN                                                             26108000
      SAY "NOW DO CARROT..." ENDSAY;                                    26110000
      SEND;                                                             26112000
      END;                                                              26114000
$IF                           <<DEBUGGING CODE>>                        26116000
                                                                        26118000
   WHILE LEFT'TO'PRINT >= 0 DO                                          26120000
      BEGIN                                                             26122000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        26124000
      IF DEBUGGING THEN                                                 26126000
         BEGIN                                                          26128000
         SAY "LEFT'TO'PRINT=" ENDSAY;                                   26130000
         SAYNUM (LEFT'TO'PRINT);                                        26132000
         SEND;                                                          26134000
         END;                                                           26136000
$IF                           <<DEBUGGING CODE>>                        26138000
                                                                        26140000
      IF LEFT'TO'PRINT < 72 THEN                                        26142000
         BEGIN                                                          26144000
         FILL' (LINE, LEFT'TO'PRINT, " ");                              26146000
         MOVE LINE'(LEFT'TO'PRINT):=("^", 0);                           26148000
         END;                                                           26150000
                                                                        26152000
      LEFT'TO'PRINT:=LEFT'TO'PRINT - 72;                                26154000
                                                                        26156000
      PRINT'LINE;                                                       26158000
      END;                                                              26160000
                                                                        26162000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        26164000
   IF DEBUGGING THEN                                                    26166000
      BEGIN                                                             26168000
      SAY "END PRINT'CARROT" ENDSAY;                                    26170000
      SEND;                                                             26172000
      END;                                                              26174000
$IF                           <<DEBUGGING CODE>>                        26176000
                                                                        26178000
   END <<PRINT'CARROT PROC>>;                                           26180000
$PAGE ";STORMISC=  PRINT'FILE'ERROR --- PRINTS FILE I/O ERRORS"         26182000
$CONTROL SEGMENT=STORMISC                                               26184000
<<***************************************************************>>     26186000
PROCEDURE PRINT'FILE'ERROR (FID);                                       26188000
         VALUE   FID;                                                   26190000
         INTEGER FID;                                                   26192000
   BEGIN                                                                26194000
                                                                        26196000
                                                                        26198000
   INTEGER                                                              26200000
      ERR         := 0;                                                 26202000
                                                                        26204000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        26206000
   IF DEBUGGING THEN                                                    26208000
      BEGIN                                                             26210000
      SAY "PRINT'FILE'ERROR (" ENDSAY;                                  26212000
      SAYNUM (FID);                                                     26214000
      SAY1 (")");                                                       26216000
      SEND;                                                             26218000
      END;                                                              26220000
$IF                           <<DEBUGGING CODE>>                        26222000
                                                                        26224000
   FCHECK (FID, ERR);                                                   26226000
                                                                        26228000
   IF = THEN                                                            26230000
      BEGIN                                                             26232000
      DISABLE'ARITHMETIC'TRAPS;                                         26234000
      IF STDLIST'NUM > 0 THEN                                           26236000
         GENMSG (IO'MESSAGE'SET, ERR, %133333, , , , , ,                26238000
                 -STDLIST'NUM);                                         26240000
      IF OFFLINE'NUM > 0 THEN                                           26242000
         GENMSG (IO'MESSAGE'SET, ERR, %133333, , , , , ,                26244000
                 -OFFLINE'NUM);                                         26246000
      END;                                                              26248000
                                                                        26250000
   END <<PRINT'FILE'ERROR PROC>>;                                       26252000
$PAGE                                                                   26252010
$CONTROL SEGMENT=STORMISC                                               26252020
PROCEDURE PURGE'FILES;                                                  26252030
                                                                        26252040
   ! This procedure purges files that were successfully                 26252050
   ! STOREd when the PURGE option is set.  The GOOD file                26252060
   ! is rewound and each record is read from it.  If the                26252070
   ! purge bit is set (the file was stored correctly) then              26252080
   ! the file is opened with write access.  If the open                 26252090
   ! succeeds then the file is closed with DISP=PURGE                   26252100
   ! If the purge succeeds then OK, otherwise close the                 26252110
   ! file as it previously existed.  If the open or close-purge         26252120
   ! fail then a message is sent to the user saying that the            26252130
   ! file was not purged and the file system error message              26252140
   ! explaining why it was not purged.                                  26252150
                                                                        26252160
BEGIN                                                                   26252170
   BYTE ARRAY                                                           26252180
      FILENAME' (0:5*FILE'PART'SIZE);                                   26252190
                                                                        26252200
   LOGICAL ARRAY                                                        26252210
      GBUF    (0:G'RECSIZE);                                            26252220
                                                                        26252230
   BYTE ARRAY                                                           26252240
      GBUF'   (*)  = GBUF;                                              26252250
                                                                        26252260
   INTEGER                                                              26252270
      LEN;                                                              26252280
                                                                        26252290
   LOGICAL                                                              26252300
      PURGE'WORKED;                                                     26252310
                                                                        26252320
   SUBROUTINE FILE'FAIL (FID, MSGN);                                    26252330
      VALUE FID, MSGN;                                                  26252340
      INTEGER FID, MSGN;                                                26252350
   BEGIN                                                                26252360
      IF FID <> NO'FILE THEN                                            26252370
         PRINT'FILE'ERROR (FID);                                        26252380
                                                                        26252390
      IF MSGN <> 0 THEN                                                 26252400
         SENDMESSAGE (MSGN);                                            26252410
                                                                        26252420
      GOTO END'PURGE'FILES;                                             26252430
   END;                                                                 26252440
   IF NOT SEEN'PURGE THEN                                               26252441
      RETURN;                                                           26252442
                                                                        26252450
   REWIND'GOOD'FILE;                                                    26252460
                                                                        26252470
   READ'GOOD'FILE;                                                      26252480
                                                                        26252490
   WHILE = DO                                                           26252500
      BEGIN                                                             26252510
                                                                        26252520
$IF X1=ON THEN                                                          26252530
      IF DEBUGGING THEN                                                 26252540
         SAY GBUF' (G'TITLE'INX'), (3*FILE'PART'SIZE) ENDSAY;           26252550
$IF                                                                     26252560
                                                                        26252570
      IF G'PURGE'BIT THEN                                               26252580
         BEGIN                                                          26252590
                                                                        26252600
$IF X1=ON THEN                                                          26252610
         IF DEBUGGING THEN                                              26252620
            SAY " PURGING " ENDSAY;                                     26252630
$IF                                                                     26252640
                                                                        26252650
         DISPLAY'3'TO'DISPLAY (FILENAME', LEN,                          26252660
                               GBUF' (G'FILE'INX'),                     26252670
                               GBUF' (G'GROUP'INX'),                    26252680
                               GBUF' (G'ACCT'INX'));                    26252690
                                                                        26252700
         FILENAME' (LEN) := " ";                                        26252710
                                                                        26252720
         PURGE'WORKED := FALSE;                                         26252730
                                                                        26252740
         PARMS'TEMPI'1 := FOPEN (FILENAME',                             26252750
                                 %2001,                                 26252760
                                 %101);                                 26252770
                                                                        26252780
         IF = THEN                                                      26252790
            BEGIN                                                       26252800
                                                                        26252810
$IF X1=ON THEN                                                          26252820
            IF DEBUGGING THEN                                           26252830
               SAY " - FILE OPENED " ENDSAY;                            26252840
$IF                                                                     26252850
                                                                        26252860
            FCLOSE (PARMS'TEMPI'1, 4, 0);                               26252870
            IF = THEN                                                   26252880
               BEGIN                                                    26252890
               PURGE'WORKED := TRUE;                                    26252900
                                                                        26252910
$IF X1=ON THEN                                                          26252920
               IF DEBUGGING THEN                                        26252930
                  SAY " - FILE PURGED " ENDSAY;                         26252940
$IF                                                                     26252950
                                                                        26252960
               END                                                      26252970
                                                                        26252980
            ELSE                                                        26252990
               FCLOSE (PARMS'TEMPI'1, 0, 0);                            26253000
            END;                                                        26253010
                                                                        26253020
         IF NOT PURGE'WORKED THEN                                       26253030
            SENDMESSAGE (M'NOT'PURGED);                                 26253040
                                                                        26253050
$IF X1=ON THEN                                                          26253060
         IF DEBUGGING THEN                                              26253061
            SEND;                                                       26253070
$IF                                                                     26253080
                                                                        26253090
         END;                                                           26253095
      READ'GOOD'FILE;                                                   26253100
      END;                                                              26253110
                                                                        26253120
END'PURGE'FILES:                                                        26253130
                                                                        26253140
END;                                                                    26253150
$PAGE ";STORMISC=  READ'DISK --- JACKET FOR ATTACHIO DISK READ"         26254000
$CONTROL SEGMENT=STORMISC                                               26256000
<<***************************************************************>>     26258000
LOGICAL PROCEDURE READ'DISK (LDEV, ADDRESS, DST, BUFFER, LEN, IOB);     26260000
         VALUE   LDEV, ADDRESS, DST, BUFFER, LEN;  <<NAME IOB;>>        26262000
         INTEGER LDEV, DST, BUFFER, LEN;                                26264000
         DOUBLE  ADDRESS, IOB;                                          26266000
         OPTION PRIVILEGED, UNCALLABLE;                                 26268000
                                                                        26270000
         <<This routine reads the specified number of                   26272000
           words/bytes from disk to the designated buffer.              26274000
           (If LEN >= 0, is in units of words; if < 0, is               26276000
           in units of bytes.)                                          26278000
           If DST = 0, then BUFFER is a DB relative stack               26280000
           address; if DST > 0 then BUFFER is the offset into           26282000
           the data segment.>>                                          26284000
                                                                        26286000
   BEGIN                                                                26288000
                                                                        26290000
   DOUBLE                                                               26292000
      LOCAL'IOB   := 0D;                                                26294000
                                                                        26296000
   INTEGER                                                              26298000
      A1          = ADDRESS + 0,                                        26300000
      A2          = ADDRESS + 1,                                        26302000
      ATTIO'STATUS= LOCAL'IOB + 0;                                      26304000
                                                                        26306000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        26308000
   IF DEBUG'DISK THEN                                                   26310000
      BEGIN                                                             26312000
      SAY "READ'DISK (" ENDSAY;                                         26314000
      SAYNUM (LDEV);                                                    26316000
      SAY1 ("%");                                                       26318000
      SAYDOCTAL (ADDRESS);                                              26320000
      SAY " -> " ENDSAY;                                                26322000
      SAYNUM (DST);                                                     26324000
      SAY " @ %" ENDSAY;                                                26326000
      SAYOCTAL (BUFFER);                                                26328000
      SAY " for " ENDSAY;                                               26330000
      SAYNUM (LEN);                                                     26332000
      SEND;                                                             26334000
      END;                                                              26336000
$IF                           <<DEBUGGING CODE>>                        26338000
                                                                        26340000
         <<read from disk...for explanation of ATTACHIO                 26342000
           parameters, see I/O system IMS...>>                          26344000
                                                                        26346000
   DISABLE'ARITHMETIC'TRAPS;                                            26348000
                                                                        26350000
   LOCAL'IOB:=ATTACHIO (                                                26352000
                  LDEV,                                                 26354000
                  0,          <<QMISC>>                                 26356000
                  DST,        << 0 = stack, >0 = dst>>                  26358000
                  BUFFER,     <<offset into stack/dst of data>>         26360000
                  ATTIO'READ, << 0 = read, 1 = write>>                  26362000
                  LEN,        << # of words to read>>                   26364000
                  A1,         << top half of disc address>>             26366000
                  A2,         << bottom half of disc address>>          26368000
                  1);         << request=blocked...wait til done>>      26370000
                                                                        26372000
   IOB:=LOCAL'IOB;                                                      26374000
                                                                        26376000
   IF ATTIO'STATUS.ATTIO'STATUSf = ATTIO'GOOD THEN                      26378000
      READ'DISK:=GOOD                                                   26380000
   ELSE                                                                 26382000
      READ'DISK:=FAILED;                                                26384000
                                                                        26386000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        26388000
   IF DEBUG'DISK THEN                                                   26390000
      BEGIN                                                             26392000
      SAY "   READ'DISK --> " ENDSAY;                                   26394000
      SAY1 ("%");                                                       26396000
      SAYOCTAL (ATTIO'STATUS);                                          26398000
      SAY " (status=" ENDSAY;                                           26400000
      SAYNUM (ATTIO'STATUS.ATTIO'STATUSf);                              26402000
      SAY1 (")");                                                       26404000
      SEND;                                                             26406000
      END;                                                              26408000
$IF                           <<DEBUGGING CODE>>                        26410000
                                                                        26412000
   <<ENABLE'ARITHMETIC'TRAPS;  ... not done because the                 26414000
     procedure exit will restore them to the caller's                   26416000
     old state.>>                                                       26418000
                                                                        26420000
   END <<READ'DISK PROC>>;                                              26422000
$PAGE ";STORMISC=  READ'LABEL --- FILE LABEL ROUTINES"                  26424000
$CONTROL SEGMENT=STORMISC                                               26426000
<<***************************************************************>>     26428000
LOGICAL PROCEDURE READ'LABEL (LDEV, ADDRESS, GOTIT);                    26430000
         VALUE GOTIT, LDEV, ADDRESS;                                    26432000
         LOGICAL GOTIT;    <<IF FALSE, WILL DO A GETSIR>>               26434000
         INTEGER LDEV;                                                  26436000
         DOUBLE ADDRESS;                                                26438000
         OPTION PRIVILEGED, UNCALLABLE;                                 26440000
                                                                        26442000
      <<This procedures reads the file label without doing a            26444000
        FLABIO.  Why? Because the caller (THUNK'STORE), does            26446000
        extensive checking on the label, and reports the                26448000
        exact error that was found.  FLABIO merely reports              26450000
        two flavors of error: hard (label was incorrect somehow)        26452000
        and soft (disc read error).                             >>      26454000
                                                                        26456000
   BEGIN                                                                26458000
                                                                        26460000
                                                                        26462000
   DOUBLE                                                               26464000
      IOB         := 0D;                                                26466000
                                                                        26468000
   INTEGER                                                              26470000
      LOCAL'FISIR'INFO;                                                 26472000
                                                                        26474000
   IF NOT GOTIT THEN                                                    26476000
      LOCAL'FISIR'INFO:=GETSIR (FISIR);      <<Get file label SIR>>     26478000
                                                                        26480000
         <<read the file label from disc...>>                           26482000
                                                                        26484000
   READ'LABEL:=READ'DISK (LDEV, ADDRESS, MY'STACK, @FLAB,               26486000
                          FILE'LABEL'SIZE, IOB);                        26488000
                                                                        26490000
   IF NOT GOTIT THEN                                                    26492000
      RELSIR (FISIR, LOCAL'FISIR'INFO);   <<Release label SIR>>         26494000
                                                                        26496000
   END <<READ'LABEL PROC>>;                                             26498000
$PAGE ";STORMISC=  RELEASE'SIRS --- RELEASE FILE-INTEG&DIRECTORY SIR"   26500000
$CONTROL SEGMENT=STORMISC                                               26502000
<<***************************************************************>>     26504000
PROCEDURE RELEASE'SIRS (REL'FISIR, REL'DSIR);                           26506000
         VALUE   REL'FISIR, REL'DSIR;                                   26508000
         LOGICAL REL'FISIR, REL'DSIR;                                   26510000
         OPTION UNCALLABLE;                                             26512000
                                                                        26514000
   BEGIN                                                                26516000
                                                                        26518000
                                                                        26520000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        26522000
   IF DEBUGGING THEN                                                    26524000
      BEGIN                                                             26526000
      SAY "   RELEASE'SIRS (" ENDSAY;                                   26528000
      IF REL'FISIR THEN                                                 26530000
         SAY "FISIR" ENDSAY;                                            26532000
      IF REL'FISIR AND REL'DSIR THEN                                    26534000
         SAY ", " ENDSAY;                                               26536000
      IF REL'DSIR THEN                                                  26538000
         SAY "DSIR" ENDSAY;                                             26540000
      SAY1 (")");                                                       26542000
      SAY "   have: " ENDSAY;                                           26544000
      IF GOT'FISIR THEN SAY "FISIR " ENDSAY;                            26546000
      IF GOT'DSIR THEN                                                  26548000
         BEGIN                                                          26550000
         SAY "DSIR (info=" ENDSAY; SAYNUM(DSIR'INFO);                   26552000
         SAY1 (")");                                                    26554000
         END;                                                           26556000
      SEND;                                                             26558000
                                                                        26560000
      IF DEBUG'SIRS THEN                                                26562000
         DEBUG;                                                         26564000
      END;                                                              26566000
$IF                           <<DEBUGGING CODE>>                        26568000
                                                                        26570000
   IF REL'DSIR AND GOT'DSIR THEN                                        26572000
      BEGIN                                                             26574000
      RELSIR (DSIR, DSIR'INFO);                                         26576000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        26578000
      IF DEBUG'SIRS THEN                                                26580000
         BEGIN                                                          26582000
         SAY "...rel DSIR" ENDSAY;                                      26584000
         SEND;                                                          26586000
         DEBUG;                                                         26588000
         END;                                                           26590000
$IF                           <<DEBUGGING CODE>>                        26592000
      GOT'DSIR:=FALSE;                                                  26594000
      END;                                                              26596000
                                                                        26598000
   IF REL'FISIR AND GOT'FISIR THEN                                      26600000
      BEGIN                                                             26602000
      RELSIR (FISIR, FISIR'INFO);                                       26604000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        26606000
      IF DEBUG'SIRS THEN                                                26608000
         BEGIN                                                          26610000
         SAY "...rel FISIR" ENDSAY;                                     26612000
         SEND;                                                          26614000
         DEBUG;                                                         26616000
         END;                                                           26618000
$IF                           <<DEBUGGING CODE>>                        26620000
      GOT'FISIR:=FALSE;                                                 26622000
      END;                                                              26624000
                                                                        26626000
   END <<RELEASE'SIRS PROC>>;                                           26628000
$PAGE ";STORMISC=  REOPEN'FILE --- FILE OPENING ROUTINE"                26630000
$CONTROL SEGMENT=STORMISC                                               26632000
<<***************************************************************>>     26634000
LOGICAL PROCEDURE REOPEN'FILE (FILENO,                                  26636000
                               DESIG, FOPTIONS, AOPTIONS, RECSIZE);     26638000
         VALUE FOPTIONS, AOPTIONS, RECSIZE;                             26640000
         INTEGER FILENO, RECSIZE;                                       26642000
         LOGICAL FOPTIONS, AOPTIONS;                                    26644000
         INTEGER ARRAY DESIG;                                           26646000
         OPTION UNCALLABLE;                                             26648000
      <<This routine FCLOSEs the file FILENO with a "close, no          26650000
        rewind" command.  It the re-opens the file.  If the FOPEN       26652000
        fails, FAILED is returned, ERROR'INFO is set to either          26654000
        ERR'CCL or ERR'CCG and ERROR'CODE is set to the error           26656000
        number (as given by FCHECK).  If the FOPEN succeeds,            26658000
        GOOD is returned, and ERROR'CODE and ERROR'INFO are set         26660000
        to 0.>>                                                         26662000
   BEGIN                                                                26664000
                                                                        26666000
                                                                        26668000
   BYTE ARRAY                                                           26670000
      DESIG'      (*) = DESIG (0);                                      26672000
                                                                        26674000
   REOPEN'FILE:=GOOD;                                                   26676000
   ERROR'CODE:=ERROR'INFO:=0;                                           26678000
                                                                        26680000
   FCLOSE (FILENO, 3, 0);     <<close, no rewind>>                      26682000
                                                                        26684000
   FILENO:=FOPEN (DESIG', FOPTIONS, AOPTIONS, RECSIZE);                 26686000
                                                                        26688000
   IF > THEN                                                            26690000
      BEGIN                                                             26692000
      ERROR'INFO:=ERR'CCG;    <<shouldn't happen>>                      26694000
      FCHECK (FILENO, ERROR'CODE);                                      26696000
      PARMS'TEMPI'1:=@DESIG';                                           26698000
      PARMS'TEMPI'2:=24;      <<title is 24 chars long>>                26700000
      SENDMESSAGE (M'OPEN'FAIL);                                        26702000
      REOPEN'FILE:=FAILED;                                              26704000
      END                                                               26706000
   ELSE IF < THEN                                                       26708000
      BEGIN                                                             26710000
      ERROR'INFO:=ERR'CCL;                                              26712000
      FCHECK (FILENO, ERROR'CODE);                                      26714000
      PARMS'TEMPI'1:=@DESIG';                                           26716000
      PARMS'TEMPI'2:=24;      <<title is 24 chars long>>                26718000
      SENDMESSAGE (M'OPEN'FAIL);                                        26720000
      REOPEN'FILE:=FAILED;                                              26722000
      END;                                                              26724000
                                                                        26726000
   END <<REOPEN'FILE PROC>>;                                            26728000
$PAGE ";STORMISC=  STEPIT' --- THE SCANNER"                             26730000
$CONTROL SEGMENT=STORMISC                                               26732000
<<***************************************************************>>     26734000
INTEGER PROCEDURE STEPIT';                                              26736000
         OPTION UNCALLABLE;                                             26738000
   BEGIN                                                                26740000
                                                                        26742000
   <<--------------------------------------------------------           26744000
      This is the scanner!                                              26746000
                                                                        26748000
      Uses:                                                             26750000
         ITEMP    a byte pointer (sort of)                              26752000
                  pointing to the first character of the current        26754000
                  token.                                                26756000
                                                                        26758000
         ITEMP'OFFSET controls where ITEMP points...this kludge         26760000
                  was used to convert STEPIT from a routine that        26762000
                  operates on globals to one that has all of its        26764000
                  parameters passed thru STORE/RESTORE's PARMS          26766000
                  array.                                                26768000
                  ITEMP'OFFSET ranges from 0 to INPUTLEN.               26770000
                  Thus, ITEMP always points within COMMAND'TEXT'.       26772000
                                                                        26774000
         ICLASS   the class of the current token, valid classes         26776000
                  are:                                                  26778000
                     ENDLINEv  ... ITEMP = %15 (carriage return)        26780000
                     TOKENv    ... ITEMP points to a token of           26782000
                        length ILEN.  Tokens are letter strings,        26784000
                        alphanumeric strings (beginning with a          26786000
                        letter), or either of the above with an         26788000
                        asterisk in front (*).  Thus, the               26790000
                        following are tokens: A, AB, aBcD4Z,            26792000
                        *a, *A, *A4; and the following are NOT:         26794000
                        *, 5, $A, 5a, 5A, *5, *5A, a#b.                 26796000
                                                                        26798000
         ILEN     the length of the current token, number, or           26800000
                  special character, or string.                         26802000
                                                                        26804000
         SUBCLASS extra information.  If ICLASS = NUMBERv, then         26806000
                  this is the actual binary value.  If ICLASS =         26808000
                  DNUMBERv, then SUBCLASS'D has the double              26810000
                  integer value.  If ICLASS is STRINGv, then            26812000
                  SUBCLASS is ILEN-2 (i.e: the length without the       26814000
                  (") characters.                                       26816000
                                                                        26818000
         INPUTLEN this is the number of characters in COMMAND'TEXT',    26820000
                  exclusive of the carriage-return.  It is never        26822000
                  altered by STEPIT'.                                   26824000
                                                                        26826000
      Deduces:                                                          26828000
         ILEFT    the number of characters between ITEMP and            26830000
                  the end of input, inclusive of the character          26832000
                  pointed to by ITEMP, exclusive of the carriage        26834000
                  return.  Thus, if "A",%15 is left, and ITEMP          26836000
                  points to "A", then ILEFT = 1.                        26838000
                  Note: ILEFT <--> INPUTLEN-ITEMP'OFFSET.               26840000
                                                                        26842000
      Note 1:                                                           26844000
                                                                        26846000
         The word 'token' is often used in this program.  It            26848000
         is defined as: an entity returned by STEPIT.  Thus,            26850000
         the following are each examples of a single token:             26852000
                                                                        26854000
               a  abw   A   a1  A1Bd   &  9   90   ^   /   *a   *A4     26856000
                                                                        26858000
         and the following are each examples of contiguous              26860000
         character strings that are 2 tokens:                           26862000
                                                                        26864000
               A#   a#   $A   $a   8A   @L   L@   //   :=   ()          26866000
                                                                        26868000
         The word 'token' and the ICLASS of TOKENv should not           26870000
         be confused.  TOKENv should probably have been called          26872000
         IDENTIFIERv, but was not for historical reasons.               26874000
                                                                        26876000
      Note 2:                                                           26878000
                                                                        26880000
         Tokens (ICLASS = TOKENv) are automatically upshifted.          26882000
         Numbers are automatically converted to single precision        26884000
         integers if possible, otherwise they are treated as            26886000
         doubles.  A "D" appearing after a number will force it         26888000
         to be returned as a double word value (DNUMBERv).              26890000
         (If a "D" is found, the value of ILEN includes it.)            26892000
         If a number is too big for a double, ICLASS will be            26894000
         TOKENv and SUBCLASS will be DNUMBERv.  (Normally,              26896000
         SUBCLASS for tokens is 0.)                                     26898000
                                                                        26900000
      Note 3:                                                           26902000
                                                                        26904000
         The text is assumed to have a carriage return as a             26906000
         delimiter.  Repeated calls on STEPIT when the prior call       26908000
         resulted in ENDLINEv will also return ENDLINEv.                26910000
                                                                        26912000
         STEPIT's result is a copy of ICLASS, thus the two              26914000
         statements:                                                    26916000
               STEPIT; IF ICLASS IS ENDLINEv ...                        26918000
         and                                                            26920000
               IF STEPIT IS ENDLINEv ...                                26922000
         are equivalent.                                                26924000
                                                                        26926000
      -------------------------------------------------------->>        26928000
                                                                        26930000
                                                                        26932000
   INTEGER                                                              26934000
      I,                                                                26936000
      LEN;                                                              26938000
                                                                        26940000
   BYTE POINTER                                                         26942000
      COPY'ITEMP,                                                       26944000
      PTR;                                                              26946000
                                                                        26948000
   DEFINE                                                               26950000
      INPUT'STOPPER = %15 #;    <<carriage return>>                     26952000
                                                                        26954000
   LABEL                                                                26956000
      END'STEPIT;                                                       26958000
                                                                        26960000
   <<--------------->>                                                  26962000
   <<  BUMP'ITEMP   >>                                                  26964000
   <<--------------->>                                                  26966000
                                                                        26968000
   SUBROUTINE BUMP'ITEMP (N);                                           26970000
            VALUE   N;                                                  26972000
            INTEGER N;                                                  26974000
      BEGIN                                                             26976000
                                                                        26978000
      ITEMP'OFFSET:=INTEGER(LOGICAL(ITEMP'OFFSET)+LOGICAL(N));          26980000
                                                                        26982000
      ILEFT:=INPUTLEN - ITEMP'OFFSET;                                   26984000
                                                                        26986000
            <<guarantee that we won't overflow our text buffer...>>     26988000
                                                                        26990000
      IF ITEMP'OFFSET > INPUTLEN OR ILEFT <= 0 THEN                     26992000
         BEGIN                                                          26994000
         ITEMP'OFFSET:=INPUTLEN;          <<point to %15>>              26996000
         ITEMP:=%15;       <<probably not needed>>                      26998000
         ILEFT:=0;                                                      27000000
         END;                                                           27002000
                                                                        27004000
      @COPY'ITEMP:=@ITEMP;                                              27006000
                                                                        27008000
      END <<BUMP'ITEMP SUB>>;                                           27010000
                                                                        27012000
   <<--------------->>                                                  27014000
   <<  RETURN'THEM  >>                                                  27016000
   <<--------------->>                                                  27018000
                                                                        27020000
   SUBROUTINE RETURN'THEM (IC, SC, L);                                  27022000
            VALUE   IC, SC, L;                                          27024000
            INTEGER IC, SC, L;                                          27026000
      BEGIN                                                             27028000
                                                                        27030000
      ICLASS:=IC;                                                       27032000
      ILEN:=L;                                                          27034000
      SUBCLASS:=SC;                                                     27036000
      STEPIT':=IC;                                                      27038000
                                                                        27040000
      GO END'STEPIT;                                                    27042000
                                                                        27044000
      END <<RETURN'THEM SUB>>;                                          27046000
                                                                        27048000
   <<------------------>>                                               27050000
   <<  RETURN'ENDLINE  >>                                               27052000
   <<------------------>>                                               27054000
                                                                        27056000
   SUBROUTINE RETURN'ENDLINE;                                           27058000
      BEGIN                                                             27060000
                                                                        27062000
      ILEN:=0;                                                          27064000
                                                                        27066000
      RETURN'THEM (ENDLINEv, 0, 0);                                     27068000
                                                                        27070000
      END <<RETURN'ENDLINE SUB>>;                                       27072000
                                                                        27074000
   <<------------------>>                                               27076000
   <<  RETURN'SPECIAL  >>                                               27078000
   <<------------------>>                                               27080000
                                                                        27082000
   SUBROUTINE RETURN'SPECIAL;                                           27084000
      BEGIN                                                             27086000
                                                                        27088000
      RETURN'THEM (SPECIALv, ITEMP, 1);                                 27090000
                                                                        27092000
      END <<RETURN'SPECIAL SUB>>;                                       27094000
                                                                        27096000
   <<--------------->>                                                  27098000
   <<  SCAN'NUMBER  >>                                                  27100000
   <<--------------->>                                                  27102000
                                                                        27104000
   SUBROUTINE SCAN'NUMBER;                                              27106000
      BEGIN                                                             27108000
                                                                        27110000
      MOVE ITEMP:=ITEMP WHILE N, 1;      <<leave dest pointer>>         27112000
      LEN:=LOGICAL(TOS)-LOGICAL(@ITEMP);                                27114000
      ILEN:=LEN;                                                        27116000
                                                                        27118000
      IF COPY'ITEMP(LEN) = "D" THEN                                     27120000
         ILEN:=ILEN+1;                                                  27122000
                                                                        27124000
      SUBCLASS'D:=DBINARY (ITEMP, LEN);                                 27126000
                                                                        27128000
      IF <> THEN                    <<number too big!>>                 27130000
         RETURN'THEM (TOKENv, DNUMBERv, LEN);                           27132000
                                                                        27134000
      IF SUBCLASS'D <= 32767D AND COPY'ITEMP(LEN) <> "D" THEN           27136000
         BEGIN           <<small enough to be single word...>>          27138000
         SUBCLASS:=INTEGER(SUBCLASS'D);                                 27140000
         RETURN'THEM (NUMBERv, SUBCLASS, ILEN);                         27142000
         END;                                                           27144000
                                                                        27146000
      RETURN'THEM (DNUMBERv, SUBCLASS, ILEN);                           27148000
                                                                        27150000
      END <<SCAN'NUMBER SUB>>;                                          27152000
                                                                        27154000
   <<--------------->>                                                  27156000
   <<  SCAN'STRING  >>                                                  27158000
   <<--------------->>                                                  27160000
                                                                        27162000
   SUBROUTINE SCAN'STRING;                                              27164000
      BEGIN                                                             27166000
                                                                        27168000
      I.(8:8):="""";                                                    27170000
      I.(0:8):=INPUT'STOPPER;          <<usually a carriage return>>    27172000
      SCAN COPY'ITEMP(1) UNTIL I, 1;    <<leave byte address>>          27174000
      @PTR:=TOS;                       <<pick up pointer>>              27176000
                                                                        27178000
      IF PTR = """" THEN               <<found trailing quote...>>      27180000
         BEGIN                                                          27182000
         LEN:=(LOGICAL(@PTR)-LOGICAL(@ITEMP)) - LOGICAL(1);             27184000
               <<length, including quotes>>                             27186000
         RETURN'THEM (STRINGv, LEN-2, LEN);                             27188000
         END                                                            27190000
      ELSE                                                              27192000
         RETURN'SPECIAL;                                                27194000
                                                                        27196000
      END <<SCAN'STRING SUB>>;                                          27198000
                                                                        27200000
   <<-------------->>                                                   27202000
   <<  SCAN'TOKEN  >>                                                   27204000
   <<-------------->>                                                   27206000
                                                                        27208000
   SUBROUTINE SCAN'TOKEN;                                               27210000
      BEGIN                                                             27212000
            <<see how many of the first 'ILEN' chars are                27214000
              alphanumeric...>>                                         27216000
                                                                        27218000
      IF ITEMP = "*" THEN              <<a back reference!>>            27220000
         MOVE COPY'ITEMP(1):=COPY'ITEMP(1) WHILE ANS, 1                 27222000
      ELSE                                                              27224000
         MOVE COPY'ITEMP(0):=COPY'ITEMP(0) WHILE ANS, 1;                27226000
                                                                        27228000
      LEN:=LOGICAL(TOS)-LOGICAL(@COPY'ITEMP);     <<# chars moved>>     27230000
                                                                        27232000
      RETURN'THEM (TOKENv, 0, LEN);                                     27234000
                                                                        27236000
      END <<SCAN'TOKEN SUB>>;                                           27238000
                                                                        27240000
   <<--------------->>                                                  27242000
   <<  SKIP'BLANKS  >>                                                  27244000
   <<--------------->>                                                  27246000
                                                                        27248000
   SUBROUTINE SKIP'BLANKS;                                              27250000
      BEGIN                                                             27252000
            <<find first non-blank...scan until " " or %15...>>         27254000
                                                                        27256000
      IF ITEMP = " " THEN                                               27258000
         BEGIN                                                          27260000
         SCAN ITEMP WHILE "  ",1;      <<leave byte address>>           27262000
         LEN:=LOGICAL(TOS)-LOGICAL(@ITEMP);                             27264000
         BUMP'ITEMP (LEN);             <<ITEMP points to 1st non " ">>  27266000
         END;                                                           27268000
                                                                        27270000
      IF ITEMP = INPUT'STOPPER THEN    <<is anything left?>>            27272000
         RETURN'ENDLINE;                                                27274000
                                                                        27276000
      END <<SKIP'BLANKS SUB>>;                                          27278000
                                                                        27280000
   <<------------------>>                                               27282000
   <<  SKIP'OLD'TOKEN  >>                                               27284000
   <<------------------>>                                               27286000
                                                                        27288000
   SUBROUTINE SKIP'OLD'TOKEN;                                           27290000
      BEGIN                                                             27292000
                                                                        27294000
      BUMP'ITEMP (ILEN);                                                27296000
                                                                        27298000
      IF ITEMP = INPUT'STOPPER THEN                                     27300000
         RETURN'ENDLINE;                                                27302000
                                                                        27304000
      END <<SKIP'OLD'TOKEN SUB>>;                                       27306000
                                                                        27308000
   <<--------------------------->>                                      27310000
                                                                        27312000
   SKIP'OLD'TOKEN;                                                      27314000
                                                                        27316000
   SKIP'BLANKS;                                                         27318000
                                                                        27320000
         <<examine the token...>>                                       27322000
                                                                        27324000
   IF "A" <= ITEMP AND ITEMP <= "Z" THEN                                27326000
      SCAN'TOKEN                                                        27328000
                                                                        27330000
   ELSE IF "a" <= ITEMP AND ITEMP <= "z"THEN                            27332000
      SCAN'TOKEN                                                        27334000
                                                                        27336000
   ELSE IF ITEMP = "*" THEN                                             27338000
      IF    "A" <= COPY'ITEMP(1) AND COPY'ITEMP(1) <= "Z" OR            27340000
            "a" <= COPY'ITEMP(1) AND COPY'ITEMP(1) <= "z" THEN          27342000
         SCAN'TOKEN                                                     27344000
      ELSE                                                              27346000
         RETURN'SPECIAL                                                 27348000
                                                                        27350000
   ELSE IF "0" <= ITEMP AND ITEMP <= "9" THEN                           27352000
      SCAN'NUMBER                                                       27354000
                                                                        27356000
   ELSE IF ITEMP="""" THEN                                              27358000
      SCAN'STRING                                                       27360000
                                                                        27362000
   ELSE                                                                 27364000
      RETURN'SPECIAL;                                                   27366000
                                                                        27368000
END'STEPIT:                                                             27370000
                                                                        27372000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        27374000
   IF DEBUGGING AND DEBUG'STEPIT THEN                                   27376000
      BEGIN                                                             27378000
      SAY "STEPIT': " ENDSAY;                                           27380000
      DEBUG'SCANNER;                                                    27382000
      END;                                                              27384000
$IF                           <<DEBUGGING CODE>>                        27386000
                                                                        27388000
   END <<STEPIT' PROC>>;                                                27390000
$PAGE ";STORMISC=  STRIP'SEQUENCE'NUMBER --- UTILITY"                   27392000
$CONTROL SEGMENT=STORMISC                                               27394000
<<***************************************************************>>     27396000
PROCEDURE STRIP'SEQUENCE'NUMBER (BUF', LEN);                            27398000
         BYTE ARRAY BUF';                                               27400000
         INTEGER LEN;         <<NAME LEN;>>                             27402000
         OPTION PRIVILEGED, UNCALLABLE;                                 27404000
                                                                        27406000
   << This procedure examines the last 8 characters of the              27408000
      text in BUF'.  If they are all digits, it is considered           27410000
      to be a "sequence number", and LEN will be reduced by 8.          27412000
                                                             >>         27414000
   BEGIN                                                                27416000
                                                                        27418000
   BYTE POINTER                                                         27420000
      P;                      <<points along BUF'>>                     27422000
                                                                        27424000
   BYTE                                                                 27426000
      SAVE'CHAR;              <<character at BUF'(LEN)>>                27428000
                                                                        27430000
                                                                        27432000
         <<if we don't have at least 9 characters, then                 27434000
           we arbitrarily state that there is no sequence               27436000
            number!...>>                                                27438000
                                                                        27440000
   IF LEN > 8 THEN                                                      27442000
      BEGIN                                                             27444000
                                                                        27446000
            <<save the character AFTER the LEN characters               27448000
              in BUF'...>>                                              27450000
                                                                        27452000
      SAVE'CHAR:=BUF'(LEN);                                             27454000
                                                                        27456000
            <<smash BUF'(LEN) to a non-digit...>>                       27458000
                                                                        27460000
      BUF'(LEN):=0;                                                     27462000
                                                                        27464000
            <<find out how many digits there are, starting              27466000
              at the first of the last 8 characters...>>                27468000
                                                                        27470000
      @P:=@BUF'(LEN-8);                                                 27472000
                                                                        27474000
      MOVE P:=P WHILE N, 1;   <<leave dest address>>                    27476000
                                                                        27478000
            <<restore the smashed character...>>                        27480000
                                                                        27482000
      BUF'(LEN):=SAVE'CHAR;                                             27484000
                                                                        27486000
            <<see how many digits there were...>>                       27488000
                                                                        27490000
      IF TOS - LOGICAL(@P) = 8 THEN                                     27492000
         LEN:=LEN-8;          <<aha...a sequence number!>>              27494000
      END;                                                              27496000
                                                                        27498000
   END <<STRIP'SEQUENCE'NUMBER PROC>>;                                  27500000
$PAGE ";STORMISC=  TAPE'RECSIZE'WAS'SPECIFIED --- UTILITY"              27502000
$CONTROL SEGMENT=STORMISC                                               27504000
<<***************************************************************>>     27506000
LOGICAL PROCEDURE TAPE'RECSIZE'WAS'SPECIFIED;                           27508000
         OPTION PRIVILEGED, UNCALLABLE;                                 27510000
                                                                        27512000
   <<--------------------------------------------------------------     27514000
                                                                        27516000
      This procedure handles a KLUDGE which is relevant only to         27518000
   those programs/procedures which open a new STORE tape.               27520000
                                                                        27522000
      The calling procedure opens the STORE/RESTORE tape (serial        27524000
   disc) file with a block size of 4096 words.  However, for 6250       27526000
   BPI tapes which use the ATTACHIO algorithm, the default block        27528000
   size really wants to be 8192 words.  (Default here means that the    27530000
   user has not used a file equation to specify the file's block        27532000
   size.)  In this case, the caller must signal FSTORE/IRESTORE         27534000
   that the block size returned by FGETINFO (4096 words) should be      27536000
   ignored and that the actual block size should be 8192 words.         27538000
   This procedure sets a flag when it detects this situation.           27540000
                                                                        27542000
   (The ATTACHIO algorithm is: use multiple parallel writes             27544000
   via ATTACHIO to write data to the tape.  The normal algorithm        27546000
   is to use FWRITE to write data to the tape.)                         27548000
                                                                        27550000
   Input:                                                               27552000
      PARMS --- defines the "global" environment...used various         27554000
                tape attributes like: ldev, density, name.              27556000
                                                                        27558000
   Result:                                                              27560000
      FALSE ---  The user has not specified a recsize for the           27562000
                 tape file.                                             27564000
                 (In this case, if the tape was a local & unlabeled     27566000
                 7976, STORE will write to it via ATTACHIO in blocks    27568000
                 of 8192 words rather than 4096 words.)                 27570000
                                                                        27572000
      TRUE  ---  A recsize was specified by the user.                   27574000
                                                                        27576000
   Note: the numbers "4096" and "8192" do not appear as magic           27578000
   numbers in the real code...DEFAULT'TAPE'RECSIZE is used              27580000
   instead of 4096, and MAX'7976'RECSIZE is used instead of             27582000
   8192.                                                                27584000
                                                                        27586000
   Called by:  CXSTORE'RESTORE                                          27588000
                                                                        27590000
   DB MUST BE AT STACK !!                                               27592000
                                                                        27594000
   ------------------------------------------------------------>>       27596000
                                                                        27598000
   BEGIN                                                                27600000
                                                                        27602000
                                                                        27604000
   INTEGER                                                              27606000
      I;                      <<scratch integer>>                       27608000
                                                                        27610000
   LOGICAL                                                              27612000
      MASKHI,                 <<1st word of FEQ option bits>>           27614000
      MASKLOW;                <<2nd word of FEQ option bits>>           27616000
                                                                        27618000
   BYTE POINTER                                                         27620000
      DESIG';                 <<points at tape name>>                   27622000
                                                                        27624000
   BYTE                                                                 27626000
      DUMMY'      := " ";     <<Dummy for XRETPMASK>>                   27628000
                                                                        27630000
                                                                        27632000
         <<Initialization -- no errors/no special case>>                27634000
                                                                        27636000
                                                                        27638000
   @DESIG':=@TAPE'NAME';                                                27640000
   IF DESIG' = "*" THEN                                                 27642000
      @DESIG':=@DESIG'(1);    <<skip the "*">>                          27644000
                                                                        27646000
         <<call XRETPMASK...if a non-zero value is returned,            27648000
           the it could not find a file equation...>>                   27650000
                                                                        27652000
   IF XRETPMASK (DESIG', DUMMY', DUMMY',                                27654000
                 MASKHI, MASKLOW) <> 0 THEN                             27656000
      TAPE'RECSIZE'WAS'SPECIFIED := FALSE                               27658000
   ELSE                                                                 27660000
      TAPE'RECSIZE'WAS'SPECIFIED := MASKHI.RECSIZE'FLAG;                27662000
                                                                        27664000
   END <<TAPE'RECSIZE'WAS'SPECIFIED PROC>>;                             27666000
$PAGE ";STORMISC=  UNLOCK'FILES --- UNLOCK FILES LOCKED BY STORE"       27668000
$CONTROL SEGMENT=STORMISC                                               27670000
<<***************************************************************>>     27672000
PROCEDURE UNLOCK'FILES (WHAT'FILES, PVINFO);                            27674000
         VALUE   WHAT'FILES, PVINFO;                                    27676000
         DOUBLE  WHAT'FILES;                                            27678000
         LOGICAL PVINFO;                                                27680000
         OPTION PRIVILEGED, UNCALLABLE;                                 27682000
   <<-------------------------------------------------------------->>   27684000
   <<                                                                   27686000
      UNLOCK'FILES is a routine which is invoked to unlock a subset     27688000
      of the files still locked by STORE.                               27690000
                                                                        27692000
      It will unlock all of the files from file #1 (in disk record 0)   27694000
      to file number WHAT'FILES.  If WHAT'FILES = 0D, then no files     27696000
      will be unlocked;  if WHAT'FILES = -1D, then all files will be    27698000
      unlocked.  (The unlock is done by reading the GOOD file           27700000
      to get the information about the files.)                          27702000
                                                                        27704000
           Any file which was already unlocked will not be              27706000
      unlocked again.  (This is detected by checking a bit              27708000
      in the G'FLAGS'INX word, called: G'LOCKED'bit.)                   27710000
      After unlocking, we set the record's bit, so we won't try         27712000
      to unlock the same file later (which would cause                  27714000
      problems if a DIFFERENT copy of STORE/RESTORE had                 27716000
      subsequently relocked it!).                               >>      27718000
    <<---------------------------------------------------------->>      27720000
                                                                        27722000
   BEGIN                                                                27724000
                                                                        27726000
                                                                        27728000
   DOUBLE ARRAY                                                         27730000
      GBUF'D      (0:G'RECSIZE/2);                                      27732000
                                                                        27734000
   DOUBLE                                                               27736000
      ADDR        := 0D,                                                27738000
      FILENO      := 0D;                                                27740000
                                                                        27742000
   INTEGER                                                              27744000
      ERR'CODE    := 0,                                                 27746000
      LDEV        := 0;                                                 27748000
                                                                        27750000
   INTEGER ARRAY                                                        27752000
      GBUF        (*) = GBUF'D (0),                                     27754000
      OLD'GBUF    (0:G'RECSIZE-1);                                      27756000
                                                                        27758000
   BYTE ARRAY                                                           27760000
      GBUF'       (*) = GBUF (0);                                       27762000
                                                                        27764000
                                                                        27766000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        27768000
   IF DEBUGGING THEN                                                    27770000
      BEGIN                                                             27772000
      SEND;                                                             27774000
      SAY "********* UNLOCK'FILES (" ENDSAY;                            27776000
      SAYDNUM (WHAT'FILES);                                             27778000
      SAY ") *********" ENDSAY;                                         27780000
      SEND;                                                             27782000
      SEND;                                                             27784000
      END;                                                              27786000
$IF                           <<DEBUGGING CODE>>                        27788000
                                                                        27790000
   IF WHAT'FILES = 0D OR G'NUM <= 0 THEN                                27792000
      RETURN;                                                           27794000
                                                                        27796000
   FPOINT (G'NUM, LAST'FILE'UNLOCKED);                                  27798000
   IF <> THEN RETURN;                                                   27800000
                                                                        27802000
         <<loop thru G'NUM...>>                                         27804000
                                                                        27806000
   FILENO := LAST'FILE'UNLOCKED;                                        27808000
   WHILE TRUE DO                                                        27810000
      BEGIN                                                             27812000
                                                                        27814000
      FILENO:=FILENO + 1D;                                              27816000
      IF WHAT'FILES <> ALL'FILES THEN                                   27818000
         IF FILENO > WHAT'FILES THEN                                    27820000
            BEGIN                                                       27822000
            LAST'FILE'UNLOCKED := WHAT'FILES;                           27824000
            RETURN;                                                     27826000
            END;                                                        27828000
                                                                        27830000
      FREAD (G'NUM, GBUF, G'RECSIZE);                                   27832000
                                                                        27834000
      IF <> THEN                                                        27836000
         BEGIN                                                          27838000
         IF > THEN               <<EOF>>                                27840000
            CHECK'FOR'DISMOUNT (PVINFO, 0, OLD'GBUF, ERR'CODE);         27842000
         RETURN;                                                        27844000
         END;                                                           27846000
                                                                        27848000
      ADDR:=GBUF'D(G'ADDRESS'INX'D);                                    27850000
      LDEV:=GBUF(G'LDEV'INX);                                           27852000
                                                                        27854000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        27856000
      IF DEBUGGING THEN                                                 27858000
         BEGIN                                                          27860000
         SAY "   Unlock: " ENDSAY;                                      27862000
         SAY GBUF'(G'TITLE'INX'), (3*FILE'PART'SIZE) ENDSAY;            27864000
         SAY " @ " ENDSAY;                                              27866000
         SAYNUM (LDEV);                                                 27868000
         SAY "%" ENDSAY;                                                27870000
         SAYDOCTAL (ADDR);                                              27872000
         IF G'LOCKED'bit = 0 THEN                                       27874000
            SAY " **not locked**" ENDSAY;                               27876000
         SEND;                                                          27878000
         END;                                                           27880000
$IF                           <<DEBUGGING CODE>>                        27882000
                                                                        27884000
      IF G'LOCKED'bit = 1 THEN                                          27886000
         BEGIN                                                          27888000
                                                                        27890000
         CHECK'FOR'DISMOUNT (PVINFO, GBUF(G'PVINFO'INX),                27892000
                         OLD'GBUF, ERR'CODE);                           27894000
                                                                        27896000
         MOVE OLD'GBUF:=GBUF, (G'RECSIZE);                              27898000
         PVINFO:=GBUF(G'PVINFO'INX);                                    27900000
                                                                        27902000
         LOCK'UNLOCK'FILE (UNLOCK'FILE, LDEV,                           27904000
                           ADDR, NOT GOT'SIR);                          27906000
                                                                        27908000
               <<we got a record ok, now mark it as having been         27910000
                 unlocked (so we won't try again later on)...>>         27912000
                                                                        27914000
         G'LOCKED'bit:=0;                                               27916000
                                                                        27918000
         FUPDATE (G'NUM, GBUF, G'RECSIZE);                              27920000
                                                                        27922000
         END;                                                           27924000
                                                                        27926000
      END;                                                              27928000
                                                                        27930000
   END <<UNLOCK'FILES PROC>>;                                           27932000
$PAGE ";STORMISC=  WRITE'LABEL --- FILE LABEL ROUTINES"                 27934000
$CONTROL SEGMENT=STORMISC                                               27936000
<<***************************************************************>>     27938000
LOGICAL PROCEDURE WRITE'LABEL (LDEV, ADDRESS, GOTIT);                   27940000
         VALUE GOTIT, LDEV, ADDRESS;                                    27942000
         LOGICAL GOTIT;                                                 27944000
         INTEGER LDEV;                                                  27946000
         DOUBLE ADDRESS;                                                27948000
         OPTION PRIVILEGED, UNCALLABLE;                                 27950000
                                                                        27952000
   BEGIN                                                                27954000
                                                                        27956000
                                                                        27958000
   INTEGER                                                              27960000
      LOCAL'FISIR'INFO;                                                 27962000
                                                                        27964000
   IF NOT GOTIT THEN                                                    27966000
      LOCAL'FISIR'INFO:=GETSIR (FISIR);      <<Get file label SIR>>     27968000
                                                                        27970000
         <<write the file label to disc...>>                            27972000
                                                                        27974000
   IF FLABIO (LDEV, ADDRESS, ATTIO'WRITE, FLAB) = FLABIO'OK THEN        27976000
      WRITE'LABEL:=GOOD                                                 27978000
   ELSE                                                                 27980000
      WRITE'LABEL:=FAILED;                                              27982000
                                                                        27984000
   IF NOT GOTIT THEN                                                    27986000
      RELSIR (FISIR, LOCAL'FISIR'INFO);   <<Release label SIR>>         27988000
                                                                        27990000
   END <<WRITE'LABEL PROC>>;                                            27992000
$PAGE ";CXSTORE=  CXSTORE'RESTORE --- STORE/RESTORE COMMAND EXECUTOR"   30000000
$CONTROL SEGMENT=CXSTORE                                                30002000
<<**************************************************************>>      30004000
PROCEDURE CXSTORE'RESTORE (P, STDLISTNUM, WANTS);                       30006000
         VALUE   STDLISTNUM, WANTS;                                     30008000
         INTEGER STDLISTNUM;                                            30010000
         LOGICAL WANTS;                                                 30012000
         BYTE ARRAY P;                                                  30014000
         OPTION PRIVILEGED, UNCALLABLE;                                 30016000
                                                                        30018000
                                                                        30020000
<<--------------------------------------------------------------->>     30022000
<< CXSTORE'RESTORE ...                                           >>     30024000
<< is invoked indirectly by the Command Interpreter of MPE when  >>     30026000
<< a STORE command is encountered.  The parameter P              >>     30028000
<< is a byte array containing the entire parameter list to the   >>     30030000
<< STORE command, in exactly the format in which the user        >>     30032000
<< specified it, except that the Command Interpreter has resolved>>     30034000
<< continuation lines.  CXSTORE'RESTORE sees P as one logical    >>     30036000
<< string consisting of up to about 250 characters.  The Command >>     30038000
<< Interpreter ensures that the last character of the string is  >>     30040000
<< a carriage return.  The length restriction is imposed solely  >>     30042000
<< by the CI and the MYCOMMAND intrinsic.                        >>     30044000
<<--------------------------------------------------------------->>     30046000
<<                                                                      30048000
   The syntax of the STORE command is as follows:                       30050000
                                                                        30052000
              *indirect                                                 30054000
     :STORE                        ;*dest ...                           30056000
             fileset[,fileset]...                                       30058000
                                                                        30060000
                   DATES     DATES                                      30062000
                   OFFLINE   OFFLINE                                    30064000
     ... [;SHOW [=[SHORT   [,SHORT    ...]]]]    ...                    30066000
                   SECURITY  SECURITY                                   30068000
                                                                        30070000
                   <=mm/dd/yy                                           30072000
     ... [;DATE[S]            ]    ...                                  30074000
                   >=mm/dd/yy                                           30076000
                                                                        30078000
     ... [;FILES = count ]                                              30080000
                                                                        30082000
                                                                        30084000
   --------------------------------------------------------------       30086000
                                                                        30088000
      For the format of a logical record on the good file (G'NUM),      30090000
      see the comment in the globals section declaring                  30092000
         the indices into GBUF!                                         30094000
                                                                  >>    30096000
   <<------------------------------------------------------------->>    30098000
                                                                        30100000
   BEGIN                                                                30102000
                                                                        30104000
                                                                        30106000
                                                                        30108000
   REAL                                                                 30110000
      SECS        := 0.1;     <<PAUSE time for SEND'MAIL'TO'PARENT>>    30112000
                                                                        30114000
   DOUBLE                                                               30116000
      I'NUM'RECS  := 0D,                                                30118000
      TEMP'D;                                                           30120000
                                                                        30122000
   INTEGER ARRAY                                                        30124000
      CANDIDAT'BUF  (0:CANDIDAT'RECSIZE),                               30126000
      FORMAL'NAME   (0:FILE'PART'WORDS),                                30128000
      INDIRECT'NAME (0:FILE'PART'WORDS),                                30130000
      REPLY'MESSAGE (0:MAIL'LENGTH-1);                                  30132000
                                                                        30134000
   INTEGER POINTER                                                      30136000
      TDBUF        := 0;                                                30138000
                                                                        30140000
   INTEGER                                                              30142000
      DUMMY'I,                                                          30144000
      FATHERS'PIN,                                             <<04870>>30146000
      G'NUM'EXTENTS:= 1,      <<number of sectors for GOOD file>>       30148000
      I           := 0,       <<scratch integer>>                       30150000
      LEN         := 0,       <<length of an FREAD>>                    30152000
      MAX'RECSIZE := 0,       <<max legal recsize for tape/disc>>       30154000
      RECSIZE     := 0,                                                 30156000
      REQ'TYPE    := 0,       <<Requisition type for MOUNT>>            30158000
      START'INX   := 0,       <<inx of first token after "STORE">>      30160000
      STATUS      := 0,       <<used in SEND'MAIL'TO'PARENT>>           30162000
      SUB'CODE    := 0,       <<used in PRE'CHECK'DIREC>>               30164000
      WHY         := 0,       <<why we returned from CXSTORE'RESTORE>>  30166000
      Z'SIZE      := 0;       <<for EXPAND'STACK                    >>  30168000
                                                                        30170000
   LOGICAL                                                              30172000
      AOPTIONS    := 0,                                                 30174000
      FOPTIONS    := 0,                                                 30176000
      OLDCRITICAL := FALSE,                                             30178000
      YES         := FALSE;   <<scratch logical>>                       30180000
                                                                        30182000
   BYTE ARRAY                                                           30184000
      FATHERS'NAME (0:PROCINFO'RET'SIZE),                      <<04870>>30186000
      FORMAL'NAME'  (*) = FORMAL'NAME (0),                              30188000
      INDIRECT'NAME'(*) = INDIRECT'NAME (0),                            30190000
      SCRATCH'      (0:FILE'PART'SIZE);                                 30192000
                                                                        30194000
   BYTE POINTER                                                         30196000
      PT;                     <<scratch byte pointer>>                  30198000
                                                                        30200000
   LABEL                                                                30202000
      END'CXSTORE;                                                      30204000
$PAGE                                                                   30206000
   <<----------------------------------------------------->>            30208000
   <<                                                     >>            30210000
   << SUBROUTINE Directory:                               >>            30212000
   <<                                                     >>            30214000
   <<   The subroutines used in CXSTORE are divided       >>            30216000
   <<   into 2 groups:  error handling routines;          >>            30218000
   <<   and parsers/workers.  This directory states       >>            30220000
   <<   at what sequence range each subroutine can        >>            30222000
   <<   be found in.                                      >>            30224000
   <<                                                     >>            30226000
   << Error handling routines:                            >>            30228000
   <<               FAIL                                  >>            30230000
   <<               FAIL2                                 >>            30232000
   <<               FILE'FAIL                             >>            30234000
   <<                                                     >>            30236000
   << Parsers/Workers (alphabetical order)                >>            30238000
   <<               BUILD'RESTORE'GOOD'FILE               >>            30240000
   <<               CHECK'FILESETS'SYNTAX                 >>            30242000
   <<               CHECK'INDIRECT'FILE                   >>            30244000
   <<               CHECK'TAPE'NAME                       >>            30246000
   <<               GENERATE'GOOD'FILE                    >>            30248000
   <<               INITIALIZE'CXSTORE                    >>            30250000
   <<               OPEN'FILES                            >>            30252000
   <<               OPEN'INDIRECT'FILE                    >>            30254000
   <<               OPEN'SYSLIST'FILE                     >>            30256000
   <<               OPEN'TAPE'FILE                        >>            30258000
   <<               PARSE'OPTIONS                         >>            30260000
   <<               PRE'PARSE'INPUT                       >>            30262000
   <<               PRINT'SUMMARY                         >>            30264000
   <<               READ'INDIRECT'AND'GENERATE'GOOD       >>            30266000
   <<               RESTORE'THE'FILES                     >>            30268000
   <<               SEND'MAIL'TO'PARENT                   >>            30270000
   <<               SET'JCW                               >>            30272000
   <<               SM'RESET                              >>            30274000
   <<               SM'SET                                >>            30276000
   <<               STORE'THE'FILES                       >>            30278000
   <<                                                     >>            30280000
   <<----------------------------------------------------->>            30282000
$PAGE ";CXSTORE=  CXSTORE'RESTORE --- ERROR SUBROUTINES"                30284000
   <<------------------------->>                                        30286000
   <<  FAIL                   >>                                        30288000
   <<------------------------->>                                        30290000
                                                                        30292000
   SUBROUTINE FAIL (ERRNUM);                                            30294000
            VALUE    ERRNUM;                                            30296000
            INTEGER  ERRNUM;                                            30298000
      BEGIN                                                             30300000
                                                                        30302000
      UNLOCK'FILES (ALL'FILES, 0);                                      30304000
                                                                        30306000
      IF ERRNUM <> 0 THEN                                               30308000
         SENDMESSAGE (ERRNUM);                                          30310000
                                                                        30312000
      CLOSE'FILES (NO'FILE);                                            30314000
                                                                        30316000
      REPLY'MESSAGE (MAIL'OVERALL):=FAILED;                             30318000
                                                                        30320000
      GO END'CXSTORE;                                                   30322000
                                                                        30324000
      END <<FAIL SUB>>;                                                 30326000
   <<------------------------->>                                        30328000
   <<  FAIL'NOT'CRITICAL      >>                                        30330000
   <<------------------------->>                                        30332000
                                                                        30334000
   SUBROUTINE FAIL'NOT'CRITICAL (ERRNUM);                               30336000
            VALUE    ERRNUM;                                            30338000
            INTEGER  ERRNUM;                                            30340000
      BEGIN                                                             30342000
                                                                        30344000
                                                                        30346000
      IF ERRNUM <> 0 THEN                                               30348000
         SENDMESSAGE (ERRNUM);                                          30350000
                                                                        30352000
                                                                        30354000
      REPLY'MESSAGE (MAIL'OVERALL):=FAILED;                             30356000
                                                                        30358000
      GO END'CXSTORE'NOT'CRITICAL;                                      30360000
                                                                        30362000
      END <<FAIL SUB>>;                                                 30364000
                                                                        30366000
   <<------------------------->>                                        30368000
   <<  FAIL2                  >>                                        30370000
   <<------------------------->>                                        30372000
                                                                        30374000
   SUBROUTINE FAIL2 (ERRNUM, ERRADR);                                   30376000
            VALUE    ERRNUM, ERRADR;                                    30378000
            INTEGER  ERRNUM, ERRADR;                                    30380000
      BEGIN                                                             30382000
                                                                        30384000
      IF ERRNUM <> 0 THEN                                               30386000
         PRINT'CARROT (ERRADR);                                         30388000
                                                                        30390000
      FAIL (ERRNUM);                                                    30392000
                                                                        30394000
      END <<FAIL2 SUB>>;                                                30396000
                                                                        30398000
   <<------------------------->>                                        30400000
   <<  FILE'FAIL              >>                                        30402000
   <<------------------------->>                                        30404000
                                                                        30406000
   SUBROUTINE FILE'FAIL (FID, ERRNUM);                                  30408000
            VALUE        FID, ERRNUM;                                   30410000
            INTEGER      FID, ERRNUM;                                   30412000
      BEGIN                                                             30414000
                                                                        30416000
      PRINT'FILE'ERROR (FID);                                           30418000
                                                                        30420000
      FAIL (ERRNUM);                                                    30422000
                                                                        30424000
      END <<FILE'FAIL SUB>>;                                            30426000
$PAGE ";CXSTORE=  CXSTORE'RESTORE --- UTILITY SUBROUTINES"              30428000
   <<--------------------------->>                                      30430000
   <<  BUILD'RESTORE'GOOD'FILE  >>                                      30432000
   <<--------------------------->>                                      30434000
                                                                        30436000
   SUBROUTINE BUILD'RESTORE'GOOD'FILE;                                  30438000
                                                                        30440000
      BEGIN                                                             30442000
                                                                        30444000
            <<This routine calls IRESTORE to process the candidate      30446000
              file (CANDIDAT) with the tape directory, to               30448000
              determine what files to RESTORE...>>                      30450000
                                                                        30452000
      WHY:=WHY'SCANNING;      <<remember "state">>                      30454000
                                                                        30456000
      IF IRESTORE (TDBUF) = FAILED THEN                                 30458000
         FAIL (0);                    <<message already printed>>       30460000
                                                                        30462000
      END <<BUILD'RESTORE'GOOD'FILE SUB>>;                              30464000
   <<------------------------->>                                        30466000
   <<   CHECK'FILESETS'SYNTAX >>                                        30468000
   <<------------------------->>                                        30470000
                                                                        30472000
   SUBROUTINE CHECK'FILESETS'SYNTAX (STAR'OK);                          30474000
            VALUE   STAR'OK;                                            30476000
            LOGICAL STAR'OK;                                            30478000
                                                                        30480000
      BEGIN                                                             30482000
                                                                        30484000
            <<This routine scans the fileset list, checking it          30486000
              for valid syntax.  This is done now, rather than          30488000
              later, so that any syntax errors will be detected         30490000
              BEFORE the first call on DIRECTORYSEARCH!!! >>            30492000
                                                                        30494000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        30496000
      IF DEBUGGING THEN                                                 30498000
         BEGIN                                                          30500000
         SAY "   check'filesets'syntax (" ENDSAY;                       30502000
         IF STAR'OK THEN                                                30504000
            SAY "true)" ENDSAY                                          30506000
         ELSE                                                           30508000
            SAY "false)" ENDSAY;                                        30510000
         SEND;                                                          30512000
         END;                                                           30514000
$IF                           <<DEBUGGING CODE>>                        30516000
                                                                        30518000
      ITEMP'OFFSET:=FILESET'INX;                                        30520000
      UNSTEPIT;                                                         30522000
      STEPIT;                                                           30524000
                                                                        30526000
<<    IF STAR'OK AND ITEMP = "*" THEN >>   <<!INDIRECT>>                30528000
<<       BEGIN       >>                                                 30530000
<<       STEPIT;     >>         <<step over indirect name>>             30532000
<<       END         >>                                                 30534000
                                                                        30536000
      IF STAR'OK AND ITEMP="!" THEN                                     30538000
         BEGIN                                                          30540000
            STEPIT;                   <<the indirect file name>>        30542000
            STEPIT;                   <<next token>>                    30544000
         END                                                            30546000
                                                                        30548000
      ELSE                                                              30550000
         BEGIN                <<parse filesets...>>                     30552000
         UNSTEPIT;                                                      30554000
                                                                        30556000
               <<at end of loop, look for a comma/return/semicolon>>    30558000
                                                                        30560000
         DO                                                             30562000
            BEGIN                                                       30564000
            STEPIT;                                                     30566000
                                                                        30568000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        30570000
            IF DEBUGGING THEN                                           30572000
               BEGIN                                                    30574000
               SAY "(1)CHECK'FILESETS'SYNTAX: " ENDSAY;                 30576000
               SEND;                                                    30578000
               DEBUG'SCANNER;                                           30580000
               END;                                                     30582000
$IF                           <<DEBUGGING CODE>>                        30584000
                                                                        30586000
            IF ITEMP <> ";" AND ICLASS ISNT ENDLINEv THEN               30588000
               IF PARSE'FILESET = FAILED THEN                           30590000
                  FAIL (0);   <<message already printed>>               30592000
                                                                        30594000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        30596000
            IF DEBUGGING THEN                                           30598000
               BEGIN                                                    30600000
               SAY "(2)check'filesets'syntax: " ENDSAY;                 30602000
               SEND;                                                    30604000
               DEBUG'SCANNER;                                           30606000
               END;                                                     30608000
$IF                           <<DEBUGGING CODE>>                        30610000
            END                                                         30612000
         UNTIL                                                          30614000
            ITEMP <> ",";                                               30616000
         END;                                                           30618000
                                                                        30620000
      IF ITEMP <> ";" AND ICLASS ISNT ENDLINEv THEN                     30622000
         FAIL2 (SR'SEMI'EXPECTED, ITEMP'OFFSET);                        30624000
                                                                        30626000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        30628000
      IF DEBUGGING THEN                                                 30630000
         BEGIN                                                          30632000
         SAY "END CHECK'FILESETS'SYNTAX" ENDSAY;                        30634000
         SEND;                                                          30636000
         END;                                                           30638000
$IF                           <<DEBUGGING CODE>>                        30640000
                                                                        30642000
      END <<CHECK'FILESETS'SYNTAX SUB>>;                                30644000
$PAGE                                                                   30646000
                                                                        30648000
   <<------------------------->>                                        30650000
   <<  CHECK'INDIRECT'FILE    >>                                        30652000
   <<------------------------->>                                        30654000
                                                                        30656000
   SUBROUTINE CHECK'INDIRECT'FILE;                                      30658000
                                                                        30660000
            <<This routine checks the indirect file, to see if          30662000
              it looks like a valid format file for S/R to be           30664000
              reading.  If it is not, an error is generated.            30666000
                                                                        30668000
              A "valid" format is:                                      30670000
                 open for input;                                        30672000
                 record size of at least 8 characters,                  30674000
                 and not more than 255 characters.                      30676000
              ASCII and BINARY are equally acceptable.   >>             30678000
                                                                        30680000
      BEGIN                                                             30682000
                                                                        30684000
      FGETINFO (I'NUM, , FOPTIONS, AOPTIONS, I'NUM'RECSIZE);            30686000
                                                                        30688000
      IF <> THEN                                                        30690000
         FILE'FAIL (I'NUM, SR'IND'FGETINFO);                            30692000
                                                                        30694000
            <<Dont rewind file...assume user has positioned it at       30696000
              the desired location.                                     30698000
              Do check to see if any records exist in it...>>           30700000
                                                                        30702000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        30704000
      IF DEBUGGING THEN                                                 30706000
         BEGIN                                                          30708000
         SAY "I'NUM RECSIZE=" ENDSAY;                                   30710000
         SAYNUM(I'NUM'RECSIZE);                                         30712000
         SEND;                                                          30714000
         END;                                                           30716000
$IF                           <<DEBUGGING CODE>>                        30718000
                                                                        30720000
      IF (AOPTIONS.(12:4) <> 0) AND                                     30722000
            (AOPTIONS.(12:4) <> %4) THEN    <<cant read!>>              30724000
         FAIL (SR'IND'NOT'INPUT);                                       30726000
                                                                        30728000
      IF I'NUM'RECSIZE < 0 THEN                                         30730000
         I'NUM'CHARS := \I'NUM'RECSIZE\                                 30732000
      ELSE                                                              30734000
         I'NUM'CHARS := 2*I'NUM'RECSIZE;                                30736000
                                                                        30738000
      IF NOT (FILE'PART'SIZE <= I'NUM'CHARS <= 255) THEN                30740000
         FAIL (SR'IND'RECSIZE'BAD);                                     30742000
                                                                        30744000
      END <<CHECK'INDIRECT'FILE SUB>>;                                  30746000
$PAGE                                                                   30748000
   <<------------------------->>                                        30750000
   <<  CHECK'TAPE'NAME        >>                                        30752000
   <<------------------------->>                                        30754000
                                                                        30756000
   SUBROUTINE CHECK'TAPE'NAME;                                          30758000
      BEGIN                                                             30760000
            <<Parses tape name.  If an error is found, it is            30762000
              reported and CXSTORE is terminated.  ITEMP points         30764000
              at the supposed name (or else ICLASS is ENDLINEv). >>     30766000
                                                                        30768000
            <<At the end of finding a good tapename, this               30770000
              will look for a semi-colon or an end-of-line;             30772000
              if neither are found, an error results!>>                 30774000
                                                                        30776000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        30778000
      IF DEBUGGING THEN                                                 30780000
         BEGIN                                                          30782000
         SEND;                                                          30784000
         SAY "CHECK'TAPE'NAME: " ENDSAY;                                30786000
         SEND;                                                          30788000
         DEBUG'SCANNER;                                                 30790000
         END;                                                           30792000
$IF                           <<DEBUGGING CODE>>                        30794000
                                                                        30796000
      FILL' (TAPE'NAME', FILE'PART'SIZE+1, " ");                        30798000
                                                                        30800000
$IF X2=OFF THEN                                                         30802000
      IF ICLASS IS ENDLINEv THEN                                        30804000
         FAIL2 (SR'TAPENAME'EXPECTED, ITEMP'OFFSET);                    30806000
$IF                                                                     30808000
                                                                        30810000
      TAPE'INX:=ITEMP'OFFSET;                                           30812000
                                                                        30814000
      IF ITEMP = "$" THEN                                               30816000
         BEGIN                                                          30818000
         STEPIT;                                                        30820000
         MOVE ITEMP:=ITEMP WHILE AS;     <<upcase>>                     30822000
         IF ITEMP = "NULL" AND ILEN = 4 THEN                            30824000
            BEGIN                                                       30826000
            MOVE TAPE'NAME':="$NULL ";                                  30828000
            TAPE'NULL'TOG:=TRUE;                                        30830000
            END                                                         30832000
         ELSE IF ITEMP = "CTUL" AND ILEN = 4 OR                         30834000
                 ITEMP = "CTUR" AND ILEN = 4 THEN                       30836000
            BEGIN                                                       30838000
            MOVE TAPE'NAME':="$", 2;   <<leave dest addr>>              30840000
            MOVE *:=ITEMP,(ILEN);      <<append CTUR/CTUL>>             30842000
            TAPE'CARTRIDGE'TOG:=TRUE;                                   30844000
            IF ITEMP = "CTUL" THEN                                      30846000
               CARTRIDGE:=CTULv                                         30848000
            ELSE                                                        30850000
               CARTRIDGE:=CTURv;                                        30852000
            END                                                         30854000
         ELSE                                                           30856000
            FAIL2 (SR'TAPE'BACK'REFERENCE'EXPECTED,                     30858000
                   ITEMP'OFFSET-1);                                     30860000
                                                                        30862000
         IF STEPIT ISNT ENDLINEv THEN                                   30864000
            IF ITEMP <> ";" THEN                                        30866000
               FAIL2 (SR'SEMI'EXPECTED, ITEMP'OFFSET);                  30868000
         RETURN;                                                        30870000
         END;                                                           30872000
                                                                        30874000
            <<see if the tapename is not prefaced with an               30876000
              asterisk (*) and that it doesnt consist solely            30878000
              of an asterisk...>>                                       30880000
                                                                        30882000
$IF X2=ON THEN                                                          30884000
      IF (ICLASS IS ENDLINEv) OR (ITEMP=";") THEN                       30886000
         BEGIN                                                          30888000
            MOVE TAPE'NAME' := LOGON'USER', (8);                        30890000
            BLANK'TAPE'NAME := TRUE;                                    30892000
         END                                                            30894000
      ELSE                                                              30896000
         BEGIN                                                          30898000
$IF                                                                     30900000
      IF ITEMP <> "*" THEN                                              30902000
         FAIL2 (SR'TAPE'BACK'REFERENCE'EXPECTED, ITEMP'OFFSET);         30904000
                                                                        30906000
      @PT:=@ITEMP;                                                      30908000
                                                                        30910000
      CASE PARSE'NAME (ITEMP, ILEN) OF                                  30912000
         BEGIN                                                          30914000
                                                                        30916000
         <<PN'OK: (0) >>                                                30918000
            ;      <<good result...handled after end of CASE>>          30920000
                                                                        30922000
         <<PN'NAME'TOO'LONG:  (1) >>                                    30924000
            FAIL2 (SR'TAPE'NAME'TOO'LONG, ITEMP'OFFSET);                30926000
                                                                        30928000
         <<PN'EMPTY'NAME:     (2) >>                                    30930000
            FAIL2 (SR'TAPENAME'EXPECTED, ITEMP'OFFSET);                 30932000
                                                                        30934000
         <<PN'BACK'ILLEGAL:   (3) >>   <<shouldnt happen>>              30936000
            FAIL2 (SR'TAPE'SPECIAL'CHAR, ITEMP'OFFSET);                 30938000
                                                                        30940000
         <<PN'MUST'START'WITH'ALPHA: (4) >>                             30942000
            FAIL2 (SR'TAPE'MUST'START'WITH'ALPHA,                       30944000
                   INTEGER((ITEMP'OFFSET)+1));                          30946000
                                                                        30948000
         <<PN'ILLEGAL'CHARACTER: (5) >>                                 30950000
            FAIL2 (SR'TAPE'SPECIAL'CHAR, ITEMP'OFFSET);                 30952000
                                                                        30954000
         <<PN'WILDCARDS'ILLEGAL: (6) >>                                 30956000
            FAIL2 (SR'TAPE'WILDCARDS, ITEMP'OFFSET)                     30958000
                                                                        30960000
         END;                                                           30962000
                                                                        30964000
            <<if we get here, PARSE'NAME liked our tape name            30966000
              so we want to save it away...>>                           30968000
                                                                        30970000
      MOVE TAPE'NAME':=PT(1), (ILEN-1);     <<don't store the "*">>     30972000
                                                                        30974000
            <<make sure the rest of the tape name area is               30976000
              clean...>>                                                30978000
                                                                        30980000
      IF STEPIT ISNT ENDLINEv THEN                                      30982000
         IF ITEMP <> ";" THEN                                           30984000
            FAIL2 (SR'SEMI'EXPECTED, ITEMP'OFFSET);                     30986000
                                                                        30988000
$IF X2=ON THEN                                                          30990000
      END;                                                              30992000
$IF                                                                     30994000
      END <<CHECK'TAPE'NAME SUB>>;                                      30996000
$PAGE                                                                   30998000
   <<------------------------->>                                        31000000
   <<  GENERATE'GOOD'FILE     >>                                        31002000
   <<------------------------->>                                        31004000
                                                                        31006000
   SUBROUTINE GENERATE'GOOD'FILE;                                       31008000
                                                                        31010000
            <<For STORE: this routine calls DIRECTORYSEARCH for         31012000
              each fileset, which builds up the GOOD file.              31014000
              For RESTORE: this routine writes each fileset to          31016000
              the CANDIDAT file for later processing by IRESTORE.>>     31018000
                                                                        31020000
      BEGIN                                                             31022000
                                                                        31024000
      CHECK'FILESETS'SYNTAX (FALSE <<"*" not ok>>);                     31026000
                                                                        31028000
            <<DO parse and DIRECTORYSEARCH now...>>                     31030000
                                                                        31032000
      ITEMP'OFFSET:=FILESET'INX;                                        31034000
      UNSTEPIT;                                                         31036000
                                                                        31038000
            <<loop until ITEMP <> "," ...>>                             31040000
                                                                        31042000
      DO                                                                31044000
         BEGIN                                                          31046000
                                                                        31048000
         CHECK'BREAK;         <<wont return if break sensed>>           31050000
                                                                        31052000
         STEPIT;                                                        31054000
                                                                        31056000
         IF PARSE'FILESET = FAILED THEN                                 31058000
            FAIL (0);     <<message already printed>>                   31060000
                                                                        31062000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        31064000
         IF DEBUGGING THEN                                              31066000
            BEGIN                                                       31068000
            SAY "TITLE = '" ENDSAY;                                     31070000
            SAY'STANDARD (LOOK'TITLE');                                 31072000
            SAY "'" ENDSAY;                                             31074000
            SEND;                                                       31076000
            END;                                                        31078000
$IF                           <<DEBUGGING CODE>>                        31080000
                                                                        31082000
         FILESET'NUMBER:=FILESET'NUMBER+1;                              31084000
                                                                        31086000
                                                                        31088000
         IF STORING THEN                                                31090000
            BEGIN                                                       31092000
            IF DIRECTORYSEARCH (RECIP'STORE) = FAILED THEN              31094000
               FAIL (0);                                                31096000
$IF X5=ON THEN                                                          31098000
            SAY "OLD'TOTAL'EXTENTS = " ENDSAY;                          31100000
            SAYDNUM (OLD'TOTAL'EXTENTS);                                31102000
            SEND;                                                       31104000
            SAY "OLD'DISC'READS = " ENDSAY;                             31106000
            SAYDNUM (OLD'DISC'READS);                                   31108000
            SEND;                                                       31110000
            SAY "OLD'TAPE'WRITES = " ENDSAY;                            31112000
            SAYDNUM (OLD'TAPE'WRITES);                                  31114000
            SEND;                                                       31116000
            SAY "NEW'TOTAL'EXTENTS = " ENDSAY;                          31118000
            SAYDNUM (NEW'TOTAL'EXTENTS);                                31120000
            SEND;                                                       31122000
            SAY "NEW'DISC'READS = " ENDSAY;                             31124000
            SAYDNUM (NEW'DISC'READS);                                   31126000
            SEND;                                                       31128000
            SAY "NEW'TAPE'WRITES = " ENDSAY;                            31130000
            SAYDNUM (NEW'TAPE'WRITES);                                  31132000
            SEND;                                                       31134000
            FAIL (0);                                                   31136000
$IF                                                                     31138000
            END                                                         31140000
         ELSE                                                           31142000
            BEGIN                      <<RESTOREing...>>                31144000
            IF PATTERN'BUILD'STANDARD (LOOK'TITLE',                     31146000
                     LOOK'FILE'PAT, LOOK'GROUP'PAT, LOOK'ACCT'PAT,      31148000
                     ERROR'CODE) = FAILED THEN                          31150000
               FAIL2 (SR'RESTORE'PATTERN'ERR, ITEMP'OFFSET);            31152000
                                                                        31154000
            CANDIDAT'USED := FALSE;                            <<LB.RS>>31155000
            MOVE CANDIDAT'BUF(1) :=                            <<LB.RS>>31156000
                      LOOK'LOCK, (FILE'PART'WORDS), 2;         <<LB.RS>>31157000
            MOVE *:=LOOK'PATTERNS,(LOOK'PATTERNS'LENGTH);               31158000
                                                                        31160000
            FWRITE (CANDIDAT, CANDIDAT'BUF, CANDIDAT'RECSIZE, 0);       31162000
                                                                        31164000
            IF > THEN                                                   31166000
               FILE'FAIL (CANDIDAT, SR'CANDIDAT'FULL)                   31168000
            ELSE IF < THEN                                              31170000
               FILE'FAIL (CANDIDAT, RS'WRITE'CANDIDAT'FAIL);            31172000
            C'REC'COUNT:=C'REC'COUNT + 1D;                              31174000
            END;                                                        31176000
                                                                        31178000
         END                                                            31180000
      UNTIL                                                             31182000
         ITEMP <> ",";                                                  31184000
                                                                        31186000
      IF ITEMP <> ";" AND ICLASS ISNT ENDLINEv THEN                     31188000
         FAIL2 (SR'SEMI'EXPECTED, ITEMP'OFFSET);                        31190000
                                                                        31192000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        31194000
      IF DEBUGGING THEN                                                 31196000
         BEGIN                                                          31198000
         SAY "END OF GENERATE'GOOD'FILE" ENDSAY;                        31200000
         SEND;                                                          31202000
         END;                                                           31204000
$IF                           <<DEBUGGING CODE>>                        31206000
                                                                        31208000
      CHECK'BREAK;            <<wont return if break sensed>>           31210000
                                                                        31212000
      END <<GENERATE'GOOD'FILE SUB>>;                                   31214000
$PAGE                                                                   31216000
   <<------------------------->>                                        31218000
   << INITIALIZE'CXSTORE      >>                                        31220000
   <<------------------------->>                                        31222000
                                                                        31224000
   SUBROUTINE INITIALIZE'CXSTORE;                                       31226000
                                                                        31228000
            <<This routine initializes the local/global stuff           31230000
              for STORE/RESTORE.>>                                      31232000
                                                                        31234000
      BEGIN                                                             31236000
                                                                        31238000
      FILL (REPLY'MESSAGE, MAIL'LENGTH, 0);                             31240000
      REPLY'MESSAGE (MAIL'OVERALL):=GOOD;                               31242000
      WHY:=WHY'SYNTAX;        <<remember "state">>                      31244000
                                                                        31246000
                                                                        31248000
      FILL (ZERO'BUF, @LAST'ZEROED - @FIRST'ZEROED, 0);                 31250000
$IF X5=ON THEN                                                          31252000
      OLD'TAPE'WRITES    := 0D;                                         31254000
      OLD'DISC'READS     := 0D;                                         31256000
      OLD'TOTAL'EXTENTS  := 0D;                                         31258000
      NEW'TAPE'WRITES    := 0D;                                         31260000
      NEW'DISC'READS     := 0D;                                         31262000
      NEW'TOTAL'EXTENTS  := 0D;                                         31264000
$IF                                                                     31266000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        31268000
      IF DEBUGGING THEN                                                 31270000
         BEGIN                                                          31272000
         SEND;                                                          31274000
         END;                                                           31276000
$IF                           <<DEBUGGING CODE>>                        31278000
                                                                        31280000
                                                                        31282000
                                                                        31284000
            <<  check out the text parameter ... >>                     31286000
                                                                        31288000
                                                                        31290000
      FILL' (COMMAND'TEXT', COMMAND'TEXT''LEN, %15);                    31292000
                                                                        31294000
            <<scan P...>>                                               31296000
                                                                        31298000
      SCAN P UNTIL %15, 1;             <<leave pointer>>                31300000
      LEN:= LOGICAL(TOS) - LOGICAL(@P);                                 31302000
                                                                        31304000
            <<strip trailing blanks...>>                                31306000
                                                                        31308000
      WHILE LEN > 1 AND P(LEN-1) = " " DO                               31310000
         LEN:=LEN-1;                                                    31312000
                                                                        31314000
      INPUTLEN:=LEN;                                                    31316000
      P(LEN) := %15;                   <<append a return>>              31318000
                                                                        31320000
      IF LEN > COMMAND'TEXT''LEN THEN                                   31322000
         FAIL (SR'COMMAND'TEXT'TOO'LONG);                               31324000
                                                                        31326000
            <<initialize scanner text & variables...>>                  31328000
                                                                        31330000
      MOVE COMMAND'TEXT':=P, (LEN+1);  <<transfer the text and %15>>    31332000
      ITEMP'OFFSET:=0;                                                  31334000
      UNSTEPIT;                                                         31336000
                                                                        31338000
            <<see if STORE or RESTORE was requested...>>                31340000
                                                                        31342000
      IF STEPIT IS ENDLINEv OR ICLASS ISNT TOKENv THEN                  31344000
         FAIL2 (SR'WHAT'KIND, 0);                                       31346000
                                                                        31348000
      IF ITEMP = "STORE" AND ILEN = 5 THEN                              31350000
         S'R'STATUS:=STORINGv                                           31352000
      ELSE IF ITEMP = "RESTORE" AND ILEN = 7 THEN                       31354000
         S'R'STATUS:=RESTORINGv                                         31356000
      ELSE IF ITEMP = "SYSDUMP" AND ILEN = 7 THEN              <<04870>>31358000
         BEGIN                                                 <<04870>>31360000
         IF USING'DRIVER THEN                                  <<04870>>31362000
            FAIL2 (SR'WHAT'KIND, ITEMP'OFFSET);                <<04870>>31364000
         FATHERS'PIN := FATHER;                                <<04870>>31366000
         IF <> THEN FAIL2 (SR'WHAT'KIND, ITEMP'OFFSET);        <<04870>>31368000
         S'R'STATUS:=SYSDUMPINGv                                        31370000
         END                                                   <<04870>>31372000
      ELSE IF ITEMP = "DBSTORE" AND ILEN = 7 THEN              <<04870>>31374000
         BEGIN                                                          31376000
         IF USING'DRIVER THEN FAIL(SR'DBSTORE'CALLED'BY'ALIEN);<<04870>>31378000
         FATHERS'PIN := FATHER;                                <<04870>>31380000
         IF <> THEN FAIL (SR'DBSTORE'CALLED'BY'ALIEN);         <<04870>>31382000
         PROCINFO (PARMS'TEMPI'1, PARMS'TEMPI'2, FATHERS'PIN,  <<04870>>31384000
                   10, FATHERS'NAME);                          <<04870>>31386000
         IF <> THEN FAIL (SR'CHECKING'FATHERS'NAME);           <<04870>>31388000
         IF FATHERS'NAME <> "DBSTORE.PUB.SYS " THEN            <<04870>>31390000
            FAIL (SR'DBSTORE'CALLED'BY'ALIEN);                 <<04870>>31392000
         DBSTORE'TOG:=TRUE;                                             31394000
         IGNORE'PRIV'CHECK'FLAG:=TRUE;                                  31396000
         S'R'STATUS:=STORINGv;                                          31398000
         END                                                            31400000
      ELSE                                                              31402000
         FAIL2 (SR'WHAT'KIND, ITEMP'OFFSET);                            31404000
                                                                        31406000
            <<NOTE: the code assumes that S'R'STATUS is setup           31408000
              such that the following is always true:                   31410000
                    STORING XOR RESTORING                               31412000
              since these are defines, this resolves to: either         31414000
              we are doing a RESTORE (so RESTORING is true because      31416000
              S'R'STATUS=RESTORINGv), or we are doing a STORE           31418000
              or a SYSDUMP (so STORING is true because S'R'STATUS       31420000
              is STORINGv or SYSDUMPINGv).  The differences between     31422000
              a STORE and a SYSDUMP are very small, mostly              31424000
              occuring before this program was started up.              31426000
              (One difference is: we do not recover errors on           31428000
              the first reel of a SYSDUMP tape.)                 >>     31430000
                                                                        31432000
                                                                        31434000
            <<find start of first token after STORE/RESTORE..>>         31436000
                                                                        31438000
      STEPIT;                                                           31440000
      START'INX:=ITEMP'OFFSET;                                          31442000
                                                                        31444000
                                                                        31446000
            <<setup other parms...>>                                    31448000
                                                                        31450000
      SYSLIST'NUM     := STDLISTNUM;                                    31452000
                                                                        31454000
      ADATE'HIGH      := %177777;                                       31456000
      ADATE'LOW       :=       0;                                       31458000
      CDATE'HIGH      := %177777;                                       31460000
      CDATE'LOW       :=       0;                                       31462000
      COLD'LOAD'ID    := ABSOLUTE(COLDLOADIDN);                         31464000
      DBSTORE'HIGH    := 99;                                   <<04870>>31466000
      DBSTORE'LOW     := 0;                                    <<04870>>31468000
      FILE'NUMBER     :=      0D;                                       31470000
      FILECODE'HIGH   :=   32767;                                       31472000
      FILECODE'LOW    :=  -32767;                                       31474000
      FILES'TO'HANDLE :=      0D;                                       31476000
      JCW'FLAG        := WANT'JCW;                                      31478000
      MAIL'TOG        := WANT'MAIL;                                     31480000
      MDATE'HIGH      := %177777;                                       31482000
      OFFLINE'RECSIZE :=     -72;      <<initial assumption>>           31484000
      ON'ERR          := IF STORING THEN ONERR'REDO            <<LB.RS>>31486000
                         ELSE ONERR'SKIPFILE;                  <<LB.RS>>31486100
      START'CLOCK'TIME:= TIMER;                                         31486300
      START'CPU'TIME  := PROCTIME;                                      31486400
      SYSLIST'RECSIZE :=     -72;      <<initial assumption>>           31488000
      TODAYS'DATE     := CALENDAR;                                      31490000
      USING'ATTIO     :=   FALSE;                                       31492000
      USING'FILESYS   :=    TRUE;                                       31494000
                                                               <<04870>>31496000
      IF DBSTORE'TOG THEN                                      <<04870>>31498000
         BEGIN                                                 <<04870>>31500000
         FILECODE'HIGH := -400;                                <<04870>>31502000
         FILECODE'LOW  := -404;                                <<04870>>31504000
         END;                                                  <<04870>>31506000
                                                                        31508000
      WHO (MODE,                                                        31510000
           CAPABILITY,                                                  31512000
           ,                                                            31514000
           LOGON'USER',                                                 31516000
           LOGON'GROUP',                                                31518000
           LOGON'ACCT',                                                 31520000
           HOME'GROUP');                                                31522000
                                                                        31524000
      FILL' (INDIRECT'NAME', FILE'PART'SIZE+1, " ");                    31526000
      FILL' (RES'ACCT',      FILE'PART'SIZE,   " ");                    31528000
      FILL' (RES'GROUP',     FILE'PART'SIZE,   " ");                    31530000
      FILL' (RES'CREATOR',   FILE'PART'SIZE,   " ");                    31532000
      FILL' (RES'FILE',      FILE'PART'SIZE,   " ");           <<LB.RS>>31532050
      FILL' (LAST'ACCT'  ,   FILE'PART'SIZE,   " ");           <<LB.RS>>31532100
      FILL' (LAST'GROUP' ,   FILE'PART'SIZE,   " ");           <<LB.RS>>31532200
      FILL' (LAST'USER'  ,   FILE'PART'SIZE,   " ");           <<LB.RS>>31532300
                                                                        31534000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        31536000
      IF INTERACTIVE THEN                                               31538000
         BEGIN                                                          31540000
         SAY "Turn on debugging? " ENDSAY;                              31542000
         SENDSTOP;                                                      31544000
         AFFIRM (DEBUGGING, FALSE);                                     31546000
         END;                                                           31548000
$IF                           <<DEBUGGING CODE>>                        31550000
                                                                        31552000
      IF RESTORING THEN                                                 31554000
         BEGIN                                                          31556000
         MOVE SCRATCH':="DISC.";                                        31558000
         IF GETDEVINFO (SCRATCH', DEVICEINFO) = 0 THEN                  31560000
            DISC'EXISTS:=TRUE                                           31562000
         ELSE                                                           31564000
            DISC'EXISTS:=FALSE;                                         31566000
                                                                        31568000
$IF X9=OFF THEN                                                         31570000
            FAIL (RS'DISABLED);                                         31572000
$IF                                                                     31574000
         END;                                                           31576000
                                                                        31578000
      END <<INITIALIZE'CXSTORE SUB>>;                                   31580000
$PAGE                                                                   31582000
   <<------------------------->>                                        31584000
   << OPEN'FILES              >>                                        31586000
   <<------------------------->>                                        31588000
                                                                        31590000
   SUBROUTINE OPEN'FILES (NUM'RECORDS);                        <<LB.RS>>31592000
      VALUE NUM'RECORDS;                                       <<LB.RS>>31592100
      DOUBLE NUM'RECORDS;                                      <<LB.RS>>31592200
                                                                        31594000
      BEGIN                                                             31596000
            <<OPEN'FILES opens all internal files other than the        31598000
              tape file, SYSLIST, and the indirect file.>>              31600000
                                                                        31602000
      WHY:=WHY'OPENING'FILES; <<remember "state">>                      31604000
                                                               <<LB.RS>>31604100
   IF NUM'RECORDS = 0D THEN                                    <<LB.RS>>31604200
      NUM'RECORDS := G'NUM'FSIZE;                              <<LB.RS>>31604300
                                                                        31606000
      CHECK'BREAK;            <<wont return if break sensed>>           31608000
                                                                        31610000
                                                                        31612000
            << Open GOOD file... >>                                     31614000
                                                                        31616000
      IF G'NUM'FSIZE = 0D THEN                                          31618000
         BEGIN                                                          31620000
         G'NUM'FSIZE:=DEFAULT'G'NUM'FSIZE;                              31622000
         G'NUM'EXTENTS:=1;                                              31624000
         END                                                            31626000
      ELSE IF G'NUM'FSIZE <= DEFAULT'G'NUM'FSIZE THEN                   31628000
         G'NUM'EXTENTS:=1                                               31630000
      ELSE                                                              31632000
         G'NUM'EXTENTS:=32;   <<ask for all extents!>>                  31634000
                                                                        31636000
      MOVE FORMAL'NAME':="GOOD ";                                       31638000
      IF OPEN'FILE (G'NUM,                                              31640000
                    FORMAL'NAME,                                        31642000
                    %2000, <<NO FEQ, NOCCTL, FIXED, BINARY, NEW>>       31644000
                    %105,  <<WAIT, NOMULTI, BUF, EXCL, NOMR, UPD>>      31646000
                    G'RECSIZE,                                          31648000
                    ,                  <<device>>                       31650000
                    16,                <<blockfactor>>                  31652000
                    ,                  <<buffer>>              <<LB.RS>>31654000
                    NUM'RECORDS,       <<# records>>           <<LB.RS>>31656000
                    32,                <<extents>>                      31658000
                    G'NUM'EXTENTS)     <<initial extents allocated>>    31660000
            = FAILED THEN        <<open failed on "GOOD" file>>         31662000
         FAIL (SR'G'NUM'ERROR);                                         31664000
                                                                        31666000
      <<Now open CANDIDATE file, maybe.  This file holds info on>>      31668000
      <<all the files in the intersection of the user's request and>>   31670000
      <<the tape directory.  It is created in IRESTORE and used>>       31672000
      <<in FRESTORE.  C'REC'COUNT (a.k.a. RETVAL) is the number of>>    31674000
      <<records in the CANDIDATE file.>>                                31676000
                                                                        31678000
      IF RESTORING THEN                                                 31680000
         BEGIN                                                          31682000
         MOVE FORMAL'NAME':="CANDIDAT ";                                31684000
                                                                        31686000
         IF OPEN'FILE (CANDIDAT,                                        31688000
                       FORMAL'NAME,                                     31690000
                       %2000,                                           31692000
                       %105,     <<excl, update>>                       31694000
                       CANDIDAT'RECSIZE,                                31696000
                       ,         <<device>>                             31698000
                       CANDIDAT'BLOCKFACTOR,                            31700000
                       ,                  <<buf>>              <<LB.RS>>31702000
                       NUM'RECORDS,       <<file size>>        <<LB.RS>>31704000
                       MAX'NUM'EXTENTS,   <<extents>>          <<LB.RS>>31706000
                       1)                                      <<LB.RS>>31708000
               = FAILED THEN     <<open of candidate file failed>>      31710000
            FAIL (SR'CANDIDAT'ERROR);                                   31712000
                                                                        31714000
         MOVE FORMAL'NAME':="DIREC ";                                   31716000
                                                                        31718000
         IF OPEN'FILE (D'NUM,                                           31720000
                       FORMAL'NAME,                                     31722000
                       %2000, <<NO FEQ, NOCCTL, FIXED,BINARY, NEW>>     31724000
                       %105,  <<WAIT, NOMULTI, BUF, EXCL, NOMR, UPD>>   31726000
                       D'BLOCKSIZE,                            <<LB.RS>>31728000
                       ,                  <<device>>                    31730000
                       1,                 <<We do the blking>> <<LB.RS>>31732000
                       ,                  <<buffer>>           <<LB.RS>>31734000
                       NUM'RECORDS/DOUBLE (D'BLOCKFACTOR + 1), <<LB.RS>>31736000
                       MAX'NUM'EXTENTS,   <<extents>>          <<LB.RS>>31738000
                       MAX'NUM'EXTENTS)   <<initial extents >> <<LB.RS>>31740000
               = FAILED THEN                                            31742000
            FAIL (RS'D'NUM'ERROR);                                      31744000
                                                                        31746000
         END;                                                           31748000
                                                                        31750000
            <<open OFFLINE now, maybe...>>                              31752000
                                                                        31754000
      IF SHOW'OFFLINE'FLAG = 1 THEN                                     31756000
         BEGIN                                                          31758000
         MOVE FORMAL'NAME':="OFFLINE ";                                 31760000
         MOVE SCRATCH':="LP ";                                          31762000
                                                                        31764000
         IF OPEN'FILE (OFFLINE'NUM,                                     31766000
                       FORMAL'NAME,                                     31768000
                       %504,  <<FEQ, CCTL, VAR, filename, ASCI, NEW>>   31770000
                       2,     <<WAIT, NOMULT, BUF, NOMR, WRITE(SAVE)>>  31772000
                       -132 <<recsize>>,                                31774000
                       SCRATCH'  <<device>> )                           31776000
               = FAILED THEN                                            31778000
                              <<open failed on list file>>              31780000
            FAIL (SR'BAD'OFFLINE);                                      31782000
                                                                        31784000
         FGETINFO (OFFLINE'NUM, , , , RECSIZE);                         31786000
                                                                        31788000
         IF = THEN                                                      31790000
            IF RECSIZE > 0 THEN                                         31792000
               OFFLINE'RECSIZE:=RECSIZE * -2                            31794000
            ELSE                                                        31796000
               OFFLINE'RECSIZE:=RECSIZE;                                31798000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        31800000
         IF DEBUGGING THEN                                              31802000
            BEGIN                                                       31804000
            SAY "OFFLINE'RECSIZE = " ENDSAY;                            31806000
            SAYNUM (OFFLINE'RECSIZE);                                   31808000
            SEND;                                                       31810000
            IF NOT (-133 <= OFFLINE'RECSIZE <= 66) THEN                 31812000
               PRINTFILEINFO (OFFLINE'NUM);                             31814000
            END;                                                        31816000
$IF                           <<DEBUGGING CODE>>                        31818000
         END;                                                           31820000
                                                                        31822000
            <<open PV file...>>                                         31824000
                                                                        31826000
      MOVE FORMAL'NAME':=" ";          <<nameless file>>                31828000
      MOVE SCRATCH':="DISC ";                                           31830000
                                                                        31832000
      IF OPEN'FILE (PV'NUM,                                             31834000
                    FORMAL'NAME,                                        31836000
                    PV'FOPTIONS,                                        31838000
                    PV'AOPTIONS,                                        31840000
                    PV'RECSIZE,                                         31842000
                    SCRATCH', <<device>>                                31844000
                    PV'BLOCKFACTOR,                                     31846000
                    PV'BUFFERS,                                         31848000
                    PV'FILESIZE,                                        31850000
                    PV'EXTENTS'MAX,                                     31852000
                    PV'EXTENTS'INITIAL)                                 31854000
            = FAILED THEN                                               31856000
         FAIL (SR'PV'OPEN'ERROR);                                       31858000
                                                                        31860000
                                                                        31862000
      END <<OPEN'FILES SUB>>;                                           31864000
$PAGE                                                                   31866000
   <<------------------------->>                                        31868000
   << OPEN'INDIRECT'FILE      >>                                        31870000
   <<------------------------->>                                        31872000
                                                                        31874000
   SUBROUTINE OPEN'INDIRECT'FILE;                                       31876000
      BEGIN                                                             31878000
            <<Attempts to open the user-specified indirect file.        31880000
              If the file fails to open, or any other error occurs,     31882000
              an error message will be generated and CXSTORE will       31884000
              terminate.>>                                              31886000
                                                                        31888000
      WHY:=WHY'INDIRECT;      <<remember "state">>                      31890000
                                                                        31892000
      ITEMP'OFFSET:=FILESET'INX;                                        31894000
      UNSTEPIT;                                                         31896000
                                                                        31898000
      STEPIT;                                                           31900000
                                                                        31902000
<<    IF ITEMP <> "*" THEN >>                                           31904000
<<       RETURN;           >>     <<no indirect file to open>>          31906000
<<                         >>     <<!INDIRECT>>                         31908000
<<    @PT:=@ITEMP'1;       >>                                           31910000
                                                                        31912000
      IF ITEMP <> "!" THEN                                              31914000
         RETURN;                                                        31916000
                                                                        31918000
      IF ITEMP'1 <> ALPHA THEN                                          31920000
         FAIL2 (SR'IND'MUST'START'WITH'ALPHA,                           31922000
                INTEGER ((ITEMP'OFFSET)+1));                            31924000
                                                                        31926000
      STEPIT;                                                           31928000
      @PT:=@ITEMP;                                                      31930000
$IF                                                                     31932000
                                                                        31934000
      CASE PARSE'NAME (ITEMP, ILEN) OF                                  31936000
         BEGIN                                                          31938000
                                                                        31940000
         <<OK: (0) >>                                                   31942000
            ;                                                           31944000
                                                                        31946000
         <<PN'NAME'TOO'LONG:  (1) >>                                    31948000
            FAIL2 (SR'IND'NAME'TOO'LONG, ITEMP'OFFSET);                 31950000
                                                                        31952000
         <<PN'EMPTY'NAME:     (2) >>                                    31954000
            FAIL2 (SR'IND'NAME'EXPECTED, ITEMP'OFFSET);                 31956000
                                                                        31958000
         <<PN'BACK'ILLEGAL:   (3) >>   <<shouldnt happen>>              31960000
            FAIL2 (SR'IND'SPECIAL'CHAR, ITEMP'OFFSET);                  31962000
                                                                        31964000
         <<PN'MUST'START'WITH'ALPHA: (4) >>                             31966000
            FAIL2 (SR'IND'MUST'START'WITH'ALPHA,                        31968000
                   INTEGER((ITEMP'OFFSET)+1));                          31970000
                                                                        31972000
         <<PN'ILLEGAL'CHARACTER: (5) >>                                 31974000
            FAIL2 (SR'IND'SPECIAL'CHAR, ITEMP'OFFSET);                  31976000
                                                                        31978000
         <<PN'WILDCARDS'ILLEGAL: (6) >>                                 31980000
            FAIL2 (SR'IND'WILDCARDS, ITEMP'OFFSET)                      31982000
                                                                        31984000
         END;                                                           31986000
                                                                        31988000
            <<PT points to the file name (which starts with             31990000
              an asterisk).  We now want to check to see if             31992000
              any other filesets appear after this name (if             31994000
              so, this is an error)... >>                               31996000
                                                                        31998000
<<    MOVE INDIRECT'NAME' := PT,(ILEN); >> <<!INDIRECT>>                32000000
                                                                        32002000
      MOVE INDIRECT'NAME' := PT, (ILEN);                                32004000
                                                                        32006000
      IF STEPIT IS ENDLINEv OR ITEMP = ";" THEN                         32008000
      ELSE                                                              32010000
         FAIL2 (SR'IND'NAME'NOT'ALONE, ITEMP'OFFSET);                   32012000
                                                                        32014000
      IF OPEN'FILE (I'NUM,                                              32016000
                    INDIRECT'NAME,                                      32018000
                    %7, <<feq, unlab, nocctl, fix, ascii, oldu>>        32020000
                    %1300,   <<multi, share, ro>>                       32022000
                    -255)                                               32024000
            = FAILED THEN                                               32026000
         FAIL (SR'IND'OPEN'FAILED);                                     32028000
                                                                        32030000
      CHECK'INDIRECT'FILE;                                              32032000
                                                                        32034000
      END <<OPEN'INDIRECT'FILE SUB>>;                                   32036000
$PAGE                                                                   32038000
   <<------------------------->>                                        32040000
   <<  OPEN'SYSLIST'FILE      >>                                        32042000
   <<------------------------->>                                        32044000
                                                                        32046000
   SUBROUTINE OPEN'SYSLIST'FILE;                                        32048000
                                                                        32050000
      BEGIN                                                             32052000
                                                                        32054000
            << Open SYSLIST file, verify its attributes...>>            32056000
                                                                        32058000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        32060000
      IF DEBUGGING THEN                                                 32062000
         BEGIN                                                          32064000
         SAY "OPEN SYSLIST.  (SYSLIST'NUM = " ENDSAY;                   32066000
         SAYNUM (SYSLIST'NUM);                                          32068000
         SAY1 (")");                                                    32070000
         SEND;                                                          32072000
         END;                                                           32074000
$IF                           <<DEBUGGING CODE>>                        32076000
                                                                        32078000
                                                                        32080000
      IF SYSLIST'NUM <> 0 THEN                                          32082000
         BEGIN                <<check passed-in SYSLIST...>>            32084000
         FGETINFO (SYSLIST'NUM, , I <<fopt>>, , RECSIZE);               32086000
         IF <> THEN                                                     32088000
            BEGIN                                                       32090000
            PRINT'FILE'ERROR (SYSLIST'NUM);                             32092000
            SENDMESSAGE (SR'BAD'PNUM);                                  32094000
            SYSLIST'NUM:=0;                                             32096000
            END                                                         32098000
         ELSE IF I.(10:3) = %6               <<it is $NULL !!!>>        32100000
                  OR RECSIZE <= -72                                     32102000
                  OR RECSIZE >= 36 THEN      <<good recsize>>           32104000
            SYSLIST'SUPPLIED:=TRUE                                      32106000
         ELSE                  <<bad recsize and not $NULL>>            32108000
            BEGIN                                                       32110000
            SENDMESSAGE (SR'BAD'PNUM);                                  32112000
            SYSLIST'NUM:=0;                                             32114000
            END;                                                        32116000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        32118000
         IF DEBUGGING THEN                                              32120000
            BEGIN                                                       32122000
            SAY "SYSLIST RECSIZE = " ENDSAY;                            32124000
            SAYNUM (RECSIZE);                                           32126000
            SEND;                                                       32128000
            END;                                                        32130000
$IF                           <<DEBUGGING CODE>>                        32132000
         END;                                                           32134000
                                                                        32136000
      IF SYSLIST'NUM = 0 THEN                                           32138000
         BEGIN                                                          32140000
         IF SYSDUMPING THEN                                    <<04103>>32142000
            MOVE FORMAL'NAME':="SYSDLIST "                     <<04103>>32142100
         ELSE                                                  <<04103>>32142200
            MOVE FORMAL'NAME':="SYSLIST ";                     <<04103>>32142300
                                                                        32144000
         IF OPEN'FILE (SYSLIST'NUM,                                     32146000
                       FORMAL'NAME,                                     32148000
                       %514,  <<FEQ, CCTL, VAR, $STDLIST, ASCI, NEW>>   32150000
                       %1302, <<WAIT,MULT,SHR,BUF,WRITE(SAVE)>><<04103>>32152000
                       (IF INTERACTIVE THEN                             32154000
                           -72                                          32156000
                        ELSE                                            32158000
                           -132)  )                                     32160000
               = FAILED THEN                                            32162000
            BEGIN             <<open failed on list file>>              32164000
                  <<try plain $STDLIST...>>                             32166000
            IF OPEN'FILE (SYSLIST'NUM,                                  32168000
                          FORMAL'NAME,                                  32170000
                          %2514,   <<as above, but no FEQ>>             32172000
                          %2,      <<as above>>                <<04103>>32174000
                          -72)                                          32176000
                  = FAILED THEN                                         32178000
               FAIL (SR'BADSYSLIST)                                     32180000
            ELSE                                                        32182000
               SENDMESSAGE (SR'BADSYSLIST);                             32184000
            END;                                                        32186000
         END;                                                           32188000
                                                                        32190000
      FGETINFO (SYSLIST'NUM, , I <<fopt>>, , RECSIZE);                  32192000
                                                                        32194000
      IF = THEN                                                         32196000
         IF RECSIZE > 0 THEN                                            32198000
            SYSLIST'RECSIZE:=RECSIZE * -2                               32200000
         ELSE                                                           32202000
            SYSLIST'RECSIZE:=RECSIZE;                                   32204000
                                                                        32206000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        32208000
      IF DEBUGGING THEN                                                 32210000
         BEGIN                                                          32212000
         SAY "SYSLIST'RECSIZE = " ENDSAY;                               32214000
         SAYNUM (SYSLIST'RECSIZE);                                      32216000
         SEND;                                                          32218000
         END;                                                           32220000
$IF                           <<DEBUGGING CODE>>                        32222000
                                                                        32224000
      END <<OPEN'SYSLIST'FILE SUB>>;                                    32226000
$PAGE                                                                   32228000
   <<------------------------->>                                        32230000
   <<  OPEN'TAPE'FILE         >>                                        32232000
   <<------------------------->>                                        32234000
                                                                        32236000
   SUBROUTINE OPEN'TAPE'FILE;                                           32238000
                                                                        32240000
      BEGIN                                                             32242000
            << Open tape, check its characteristics... >>               32244000
            << If the tape is $CTUL or $CTUR, then     >>               32246000
            << the file "CARTFILE " is opened.         >>               32248000
                                                                        32250000
               <<open the tape file...>>                                32252000
                                                                        32254000
      WHY:=WHY'OPENING'TAPE;  <<remember "state">>                      32256000
                                                                        32258000
      IF TAPE'NULL'TOG THEN                                             32260000
         BEGIN                                                          32262000
               <<fopt = $NULL, BINARY, NEW>>                            32264000
         FOPTIONS:=%60;                                                 32266000
               <<aopt = WAIT, WRITE>>                                   32268000
         AOPTIONS:=%1;                                                  32270000
         END                                                            32272000
      ELSE IF STORING THEN                                              32274000
         BEGIN                                                          32276000
               <<fopt = FEQ, NOCCTL, UNDEF, BINARY, NEW>>               32278000
         FOPTIONS:=%200;                                                32280000
               <<aopt = WAIT, NOMULTI, BUF, EXCL, NOMR, WRITE>>         32282000
         AOPTIONS:=%105;                                                32284000
         IF SYSDUMPING THEN                                             32286000
            AOPTIONS.(08:02):=3;       <<SHARE>>                        32288000
         END                                                            32290000
      ELSE                                                              32292000
         BEGIN                                                          32294000
               <<fopt = FEQ, NOCCTL, UNDEF, BINARY, OLD>>               32296000
         FOPTIONS:=%201;                                                32298000
               <<aopt = EXCL, BUF, NOMR, READ>>                         32300000
         AOPTIONS:=%100;                                                32302000
         END;                                                           32304000
                                                                        32306000
            <<setup default recsize...>>                                32308000
                                                                        32310000
      IF TAPE'CARTRIDGE'TOG THEN                                        32312000
         TAPE'RECSIZE:=128                                              32314000
      ELSE                                                              32316000
         TAPE'RECSIZE:=DEFAULT'TAPE'RECSIZE;                            32318000
                                                                        32320000
      IF TAPE'LDEV <> 0 THEN                                            32322000
         BEGIN                <<Convert desired ldev to text>>          32324000
         MOVE SCRATCH':="         ";                                    32326000
         ASCII (TAPE'LDEV, 10, SCRATCH');                               32328000
         FOPTIONS.(05:01):=1;          <<disallow :FILE>>               32330000
                                                                        32332000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        32334000
         IF DEBUGGING THEN                                              32336000
            BEGIN                                                       32338000
            SAY "asking for dev = " ENDSAY;                             32340000
            SAY SCRATCH', (8) ENDSAY;                                   32342000
            SEND;                                                       32344000
            END;                                                        32346000
$IF                           <<DEBUGGING CODE>>                        32348000
         END                                                            32350000
$IF X2=ON THEN                                                          32352000
           << if using default tape name >>                             32354000
      ELSE IF BLANK'TAPE'NAME THEN                                      32356000
         BEGIN                                                          32358000
            FOPTIONS. (05:01) := 1;  << :FILE disallowed >>             32360000
            MOVE SCRATCH' := "TAPE    " ;                               32362000
         END                                                            32364000
$IF                                                                     32366000
      ELSE IF DBSTORE'TOG THEN                                          32368000
         MOVE SCRATCH':="TAPE "                                         32370000
      ELSE                                                              32372000
         MOVE SCRATCH':="DISC ";                                        32374000
                                                                        32374100
      IF SEEN'TIME THEN          <<TIME>>                               32374200
         BEGIN                                                          32374300
         SENDMESSAGE (M'TIME'INFO,TRUE);                                32374310
         SENDMESSAGE (SR'TIM'BEFORE'FOPEN);                             32374400
         END;                                                           32374600
                                                                        32376000
      IF OPEN'FILE (T'NUM,                                              32378000
                    TAPE'NAME,                                          32380000
                    FOPTIONS,                                           32382000
                    AOPTIONS,                                           32384000
                    TAPE'RECSIZE,                                       32386000
                    SCRATCH' <<device>> )                               32388000
            = FAILED THEN           <<tape open failed>>                32390000
         BEGIN                                                          32392000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        32394000
         IF DEBUGGING THEN                                              32396000
            BEGIN                                                       32398000
            SAY "FAILED TO OPEN TAPE FILE" ENDSAY;                      32400000
            SAY ", ERR#" ENDSAY;                                        32402000
            SAYNUM (ERROR'CODE);                                        32404000
            SEND;                                                       32406000
            END;                                                        32408000
$IF                           <<DEBUGGING CODE>>                        32410000
         FAIL (SR'CANT'OPEN'TAPE);                                      32412000
         END;                                                           32414000
                                                                        32416000
      IF SEEN'TIME THEN          <<TIME>>                               32416100
         BEGIN                                                          32416200
         SENDMESSAGE (M'TIME'INFO,TRUE);                                32416210
         SENDMESSAGE (SR'TIM'AFTER'FOPEN);                              32416300
         END;                                                           32416500
                                                                        32416600
      FGETINFO (T'NUM, , TAPE'FOPTIONS, TAPE'AOPTIONS,                  32418000
                TAPE'RECSIZE, TAPE'DEVINFO);                            32420000
      IF <> THEN                                                        32422000
         FAIL (SR'TAPE'FGETINFO'FAIL);                                  32424000
   FFILEINFO (T'NUM, ITEM'LDEV, TAPE'LDEV,                              32424100
                     ITEM'VIRT, PARMS'TEMPI'1);                         32424110
   IF <> THEN                                                           32424200
      FAIL (RS'T'FGETINFO'FAIL);                                        32424300
   VIRTDEV := (PARMS'TEMPI'1 <> 0);                                     32424400
                                                                        32426000
      FFILEINFO (T'NUM, DEN'OPTION, TAPE'DENSITY);                      32428000
      IF <> OR TAPE'DENSITY <= 0 THEN                                   32430000
         TAPE'DENSITY:=1600;                                            32432000
                                                                        32434000
      IF TAPE'FOPTIONS.(10:3) = %6 AND STORING THEN                     32436000
         TAPE'NULL'TOG:=TRUE;       <<$NULL>>                           32438000
                                                                        32440000
            <<now that we have the tape opened, check its >>            32442000
            <<attributes (or, for NULL, set attributes)...>>            32444000
                                                                        32446000
      IF TAPE'NULL'TOG THEN                                             32448000
         BEGIN                                                          32450000
         TAPE'NULL'TOG:=TRUE;          <<$NULL>>                        32452000
         TAPE'RECSIZE:=1024;           <<force good recsize>>           32454000
         END                                                            32456000
                                                                        32458000
      ELSE                                                              32460000
         BEGIN                         <<examine tape attributes..>>    32462000
                  <<check foptions...>>                                 32464000
                                                                        32466000
         IF (TAPE'FOPTIONS LAND (IF STORING THEN %2777                  32468000
                                 ELSE %176777)) <> FOPTIONS THEN        32470000
            FAIL (SR'TFILFOPTION);                                      32472000
                                                                        32474000
                  <<check aoptions..>>                                  32476000
                                                                        32478000
         IF (TAPE'AOPTIONS LAND %177377) <> AOPTIONS THEN               32480000
            FAIL (SR'TFILAOPTION);                                      32482000
                                                                        32484000
               <<see if the tape is a 7976 and if 6250bpi               32486000
                 is being used...>>                                     32488000
                                                                        32490000
         IF TAPE'DEVINFO.DEVTYPEf = MAGTAPE                             32492000
               AND TAPE'DEVINFO.SUBTYPEf = SUBTYPE'7976 THEN            32494000
            BEGIN                                                       32496000
            A'7976:=TRUE;                                               32498000
            IF TAPE'DENSITY = 6250 THEN                                 32500000
               USE'6250BPI:=TRUE;                                       32502000
            END;                                                        32504000
                                                                        32506000
         IF TAPE'DEVINFO.DEVTYPEf = MAGTAPE THEN                        32508000
            BEGIN                                                       32510000
                  <<disallow labeled tapes over DS/3000...>>            32512000
            IF LABELED AND VIRTDEV THEN                                 32514000
               FAIL (SR'NO'LABELED'DS);                                 32516000
            END                                                         32518000
         ELSE IF TAPE'DEVINFO.DEVTYPEf = SDISC THEN                     32520000
            TAPE'SDISC'TOG:=TRUE                                        32522000
         ELSE                 <<not a tape or a serial disc...>>        32524000
            FAIL (SR'XPCTTAPEDEV);                                      32526000
                                                                        32528000
         IF ( (TAPE'RECSIZE MOD 256) <> 0) THEN                         32530000
            FAIL (SR'RECSIZEBAD);                                       32532000
                                                                        32534000
         IF TAPE'CARTRIDGE'TOG THEN                                     32536000
            IF TAPE'RECSIZE <> 128 AND TAPE'RECSIZE <> -256 THEN        32538000
               FAIL (SR'CART'RECSIZE'BAD);                              32540000
                                                                        32542000
               <<check recsize...>>                                     32544000
                                                                        32546000
         IF TAPE'DEVINFO.DEVTYPEf = SDISC THEN                          32548000
            MAX'RECSIZE:=MAX'SDISC'RECSIZE                              32550000
         ELSE IF TAPE'DENSITY = 6250 AND (NOT VIRTDEV)                  32552000
               AND (NOT LABELED) THEN                                   32554000
            MAX'RECSIZE:=MAX'7976'RECSIZE                               32556000
         ELSE                                                           32558000
            MAX'RECSIZE:=MAX'7970'RECSIZE;                              32560000
                                                                        32562000
         IF NOT (256 <= TAPE'RECSIZE <= MAX'RECSIZE) THEN               32564000
            FAIL (SR'RECSIZEBAD);                                       32566000
                                                                        32568000
               <<if user specified ATTIO, make sure that the            32570000
                 output device is a tape...>>                           32572000
                                                                        32574000
         IF SEEN'ATTIO THEN                                             32576000
            IF TAPE'DEVINFO.DEVTYPEf <> MAGTAPE THEN                    32578000
               SEEN'ATTIO:=FALSE;                                       32580000
                                                                        32582000
               <<decide whether or not to use attachio                  32584000
                 output method (instead of the file system)...>>        32586000
                                                                        32588000
         IF (NOT LABELED) AND (NOT VIRTDEV) AND                         32590000
               (A'7976 OR SEEN'ATTIO) THEN                              32592000
            BEGIN                                                       32594000
            USING'ATTIO:=TRUE;                                          32596000
            USING'FILESYS:=FALSE;                                       32598000
            END                                                         32600000
         ELSE                                                           32602000
            BEGIN                                                       32604000
            USING'ATTIO:=FALSE;                                         32606000
            USING'FILESYS:=TRUE;                                        32608000
            END;                                                        32610000
                                                                        32612000
               <<see if we should use the larger HP7976 (8192           32614000
                 words) recsize even if the tape was opened             32616000
                 with a default recsize (4096 words)...>>               32618000
                                                                        32620000
         IF USING'ATTIO AND TAPE'RECSIZE = DEFAULT'TAPE'RECSIZE AND     32622000
               TAPE'DEVINFO.TAPE'TYPEf = TYPE'7976 AND                  32624000
               TAPE'DENSITY = 6250 THEN                                 32626000
            IF NOT TAPE'RECSIZE'WAS'SPECIFIED THEN                      32628000
               BEGIN                                                    32630000
               TAPE'RECSIZE:=MAX'7976'RECSIZE;                          32632000
               END;                                                     32634000
                                                                        32636000
         END;                                                           32638000
                                                                        32640000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        32642000
      IF DEBUGGING THEN                                                 32644000
         BEGIN                                                          32646000
         SAY "   TAPE OPENED OK, RECSIZE = " ENDSAY;                    32648000
         SAYNUM (TAPE'RECSIZE);                                         32650000
         SAY ", MAX'RECSIZE = " ENDSAY;                                 32652000
         SAYNUM (MAX'RECSIZE);                                          32654000
         SEND;                                                          32656000
         SAY "   DENSITY = " ENDSAY;                                    32658000
         SAYNUM (TAPE'DENSITY);                                         32660000
         SAY ", DEVINFO=%" ENDSAY;                                      32662000
         SAYOCTAL (TAPE'DEVINFO);                                       32664000
         SEND;                                                          32666000
         SAY "   LDEV = " ENDSAY;                                       32668000
         SAYNUM (TAPE'LDEV);                                            32670000
         SEND;                                                          32672000
         END;                                                           32674000
$IF                           <<DEBUGGING CODE>>                        32676000
                                                                        32678000
      IF LABELED THEN                                                   32680000
         BEGIN                                                          32682000
         IF SEEN'ONERR AND ON'ERR <> ONERR'QUIT THEN                    32684000
            SENDMESSAGE (SR'CANT'RECOVER'LABELED'TAPES);                32686000
         ON'ERR:=ONERR'QUIT;                                            32688000
         END;                                                           32690000
                                                                        32692000
      IF TAPE'NULL'TOG THEN                                             32694000
         BEGIN                                                          32696000
         IF SEEN'ONERR AND ON'ERR <> ONERR'QUIT THEN                    32698000
            SENDMESSAGE (SR'NULL'CANT'RECOVER);                         32700000
         ON'ERR:=ONERR'QUIT;                                            32702000
         END;                                                           32704000
                                                                        32706000
      END <<OPEN'TAPE'FILE SUB>>;                                       32708000
$PAGE                                                                   32710000
   <<------------------------->>                                        32712000
   << PARSE'OPTIONS           >>                                        32714000
   <<------------------------->>                                        32716000
                                                                        32718000
   SUBROUTINE PARSE'OPTIONS;                                            32720000
      BEGIN                                                             32722000
            <<Parse the various STORE options appearing after the       32724000
              tape name.>>                                              32726000
                                                                        32728000
      IF OPTIONS'INX > 0 THEN                                           32730000
         IF PARSE'OTHER'PARMS                                           32732000
                  = FAILED THEN                                         32734000
            BEGIN                                                       32736000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        32738000
            IF DEBUGGING THEN                                           32740000
               BEGIN                                                    32742000
               SAY "PARSE'OTHER' FAILED" ENDSAY;                        32744000
               SEND;                                                    32746000
               END;                                                     32748000
$IF                           <<DEBUGGING CODE>>                        32750000
            FAIL (0);     <<error messages already printed>>            32752000
            END;                                                        32754000
                                                                        32756000
      END <<PARSE'OPTIONS SUB>>;                                        32758000
$PAGE                                                          <<05012>>32760000
SUBROUTINE PRE'ASSERT'SAVE'ACCESS;                                      32762000
BEGIN                                                                   32764000
                                                                        32766000
   G'SECURITY'1 := GROUP'ENTRY (G'SEC);                                 32768000
   G'SECURITY'2 := GROUP'ENTRY (G'SEC + 1);                             32770000
                                                                        32772000
   IF NOT (SM'TOG) THEN                                                 32774000
      IF RES'ACCT' = LOGON'ACCT',(8) THEN                               32776000
         BEGIN                                                          32778000
            IF CAP'AM OR SAVE'ANY OR SAVE'ACCOUNT THEN                  32780000
            ELSE IF CAP'AL AND SAVE'ACCT'LIB THEN                       32782000
            ELSE IF RES'GROUP' = HOME'GROUP',(8) LAND                   32784000
                    (SAVE'GROUP LOR (CAP'GL LAND SAVE'GROUP'LIB)) THEN  32786000
            ELSE IF (RES'GROUP' = LOGON'GROUP',(8)) AND SAVE'GROUP THEN 32788000
            ELSE FAIL(M'PRE'NO'SAVE'ACCESS);                            32790000
         END << RES'ACCT = LOGON'ACCT >>                                32792000
      ELSE FAIL(M'PRE'ACCROSS'ACCOUNTS);                                32794000
                                                                        32796000
                                                                        32798000
END; << ASSERT'SAVE'ACCESS >>                                           32800000
SUBROUTINE PRE'CHECK'DIREC;                                             32802000
BEGIN                                                                   32804000
                                                                        32806000
   IF NOT SM'TOG THEN                                                   32808000
      MOVE RES'ACCT' := LOGON'ACCT', (8);                               32810000
                                                                        32812000
   IF SEEN'LOCAL OR SEEN'ACCT OR NOT SM'TOG THEN                        32814000
      BEGIN                                                             32816000
         DONT'CHK'ACCT := TRUE;                                         32830000
         CHANGE'JIT'ACCT (GET'JITDST, RES'ACCT);                        32832000
                                                                        32834000
                                                                        32836000
         SUB'CODE := LOCK'DIRECTORY;                           <<LB.RS>>32838000
         IF SUB'CODE = M'NO'ACCT THEN                          <<LB.RS>>32840000
            SUB'CODE := M'RES'ACCT'DOESNT'EXIST                <<LB.RS>>32842000
         ELSE IF SUB'CODE = M'NO'GROUP THEN                    <<LB.RS>>32844000
            SUB'CODE := M'RES'GROUP'DOESNT'EXIST;              <<LB.RS>>32846000
         IF SUB'CODE <> 0 THEN FAIL (SUB'CODE);                <<LB.RS>>32848000
                                                                        32860000
         IF SEEN'CREATOR AND NOT BLANK'CREATOR THEN                     32862000
            IF CHECK'USER (RES'ACCT', RES'CREATOR', SUB'CODE)  <<LB.RS>>32864000
                                                  = GOOD THEN  <<LB.RS>>32866000
               DONT'CHK'USER := TRUE                                    32868000
            ELSE IF SUB'CODE = USERLEVEL THEN                           32870000
               FAIL (M'RES'USER'DOESNT'EXIST)                           32872000
            ELSE IF SUB'CODE = NOCREATE THEN FAIL (M'NO'CREATE)         32874000
            ELSE FAIL (M'RES'USER'VERIFY);                              32876000
      END;                                                              32878000
                                                                        32880000
END;                                                                    32896000
$PAGE                                                                   32898000
   <<------------------------->>                                        32900000
   <<   PRE'PARSE'INPUT       >>                                        32902000
   <<------------------------->>                                        32904000
                                                                        32906000
   SUBROUTINE PRE'PARSE'INPUT (GLOBAL'PARSE);                           32908000
         VALUE GLOBAL'PARSE;                                            32910000
         LOGICAL GLOBAL'PARSE;                                          32912000
                                                                        32914000
            <<This routine scans the input, looking for the             32916000
              start of the following "areas": tape name,                32918000
              fileset list, options.  Note that for STORE these         32920000
              areas occur in the order:                                 32922000
                    fileset list, tape name, [ options ]                32924000
              and for RESTORE they occur in the order:                  32926000
                    tape name, fileset list, [ options ]                32928000
              (the options "area" is optional for both commands).       32930000
                                                                        32932000
              As each area is found, the appropriate index is           32934000
              setup (FILESET'INX, TAPE'INX, OPTIONS'INX) so             32936000
              that later routines can point the scanner to the          32938000
              start of the stuff they are interested in.>>              32940000
                                                                        32942000
      BEGIN                                                             32944000
                                                                        32946000
            <<reset scanner to start...>>                               32948000
                                                                        32950000
      ITEMP'OFFSET:=0;                                                  32952000
      UNSTEPIT;                                                         32954000
                                                                        32956000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        32958000
      IF DEBUGGING THEN                                                 32960000
         BEGIN                                                          32962000
         SAY "PRE'PARSE OF: '" ENDSAY;                                  32964000
         SAY ITEMP,(ILEFT) ENDSAY;                                      32966000
         SAY1("'");                                                     32968000
         SEND;                                                          32970000
         END;                                                           32972000
$IF                           <<DEBUGGING CODE>>                        32974000
                                                                        32976000
            <<skip to first token...>>                                  32978000
                                                                        32980000
      ITEMP'OFFSET:=START'INX;                                          32982000
      UNSTEPIT;                                                         32984000
      STEPIT;       <<first token after 'STORE' or 'RESTORE'!!!>>       32986000
                                                                        32988000
                                                                        32990000
            <<This section scans the input text for the first           32992000
              two semicolons, if any.  ITEMP points to the first        32994000
              non-blank character (if any). >>                          32996000
                                                                        32998000
      OPTIONS'INX:=-1;        <<default value!>>                        33000000
      TAPE'INX:=-1;                                                     33002000
      FILESET'INX:=-1;                                                  33004000
                                                                        33006000
                                                                        33008000
      IF GLOBAL'PARSE THEN                                              33010000
                                                                        33012000
         BEGIN                                                          33014000
                                                                        33016000
         IF RESTORING THEN                                              33018000
            BEGIN                                                       33020000
                                                                        33022000
                  <<look for:  *tape;fileset[[,fileset]][;options]>>    33024000
                                                                        33026000
            CHECK'TAPE'NAME;     <<won't return on error>>              33028000
                                                                        33030000
                  <<note: ITEMP now = ";" or end-of-line>>              33032000
                                                                        33034000
            FILESET'INX:=ITEMP'OFFSET + 1;                              33036000
                                                                        33038000
                  <<get next token after the semicolon (if              33040000
                    there was one) that followed the tape               33042000
                    name...>>                                           33044000
                                                                        33046000
            STEPIT;                                                     33048000
                                                                        33050000
            IF ICLASS IS ENDLINEv OR ITEMP = ";" THEN                   33052000
               BEGIN                                                    33054000
                     <<found one of the following:                      33056000
                              RESTORE *T                                33058000
                              RESTORE *T;                               33060000
                              RESTORE *T;;...                           33062000
                       which may, or may not, be legal...>>             33064000
                                                                        33066000
               IF ALLOW'EMPTY'FILESET THEN                              33068000
                  UNSTEPIT    <<back off the ";", if any>>              33070000
               ELSE                                                     33072000
                  FAIL2 (RS'FILESET'EXPECTED, FILESET'INX);             33074000
               END;                                                     33076000
                                                                        33078000
                  <<now find OPTIONS'INX for RESTORE...>>               33080000
                                                                        33082000
                  <<if a one or more filesets were specified,           33084000
                    ITEMP is now pointing to the first character        33086000
                    of the first fileset.  If NO filesets were          33088000
                    found, ITEMP is either a ";" or end-of-line.        33090000
                    We now want to find the semicolon separating        33092000
                    the fileset list and the options...        >>       33094000
                                                                        33096000
                                                                        33098000
            IF ITEMP <> ";" THEN                                        33100000
               WHILE STEPIT ISNT ENDLINEv AND ITEMP <> ";" DO           33102000
                  ;           <<loop till ";" or end-of-line>>          33104000
                                                                        33106000
            IF ITEMP = ";" THEN                                         33108000
               OPTIONS'INX:=ITEMP'OFFSET + 1;                           33110000
                                                                        33112000
            END                                                         33114000
                                                                        33116000
         ELSE                                                           33118000
            BEGIN             <<STORING...>>                            33120000
                                                                        33122000
            FILESET'INX:=ITEMP'OFFSET;                                  33124000
                                                                        33126000
                  <<look for: fileset[[,fileset]];*tape[;opt]...>>      33128000
                                                                        33130000
            IF ITEMP = ";" THEN                                         33132000
               IF ALLOW'EMPTY'FILESET THEN                              33134000
                  <<don't do anything...user said: STORE ;*T>>          33136000
               ELSE                                                     33138000
                  FAIL2 (RS'FILESET'EXPECTED, ITEMP'OFFSET)             33140000
                                                                        33142000
            ELSE              <<found something other than ";">>        33144000
               BEGIN                                                    33146000
               WHILE STEPIT ISNT ENDLINEv AND ITEMP <> ";" DO           33148000
                  ;                                                     33150000
               END;           <<end scanning thru filesets>>            33152000
                                                                        33154000
                  <<at this point, for legal syntax, ITEMP              33156000
                    must be either ";" or end-of-line...>>              33158000
                                                                        33160000
$IF X2=OFF THEN                                                         33162000
            IF ITEMP <> ";" THEN                                        33164000
               FAIL2 (SR'TAPENAME'EXPECTED, INPUTLEN);                  33166000
$IF                                                                     33168000
                                                                        33170000
                  <<check the tape name..>>                             33172000
                                                                        33174000
            STEPIT;                                                     33176000
            CHECK'TAPE'NAME;                                            33178000
                                                                        33180000
                  <<now pointing at either ";" or endline>>             33182000
                                                                        33184000
            IF ITEMP = ";" THEN                                         33186000
               OPTIONS'INX:=ITEMP'OFFSET + 1;                           33188000
                                                                        33190000
            END                                                         33192000
         END                  <<end global parse stuff>>                33194000
                                                                        33196000
      ELSE                                                              33198000
         BEGIN                <<not global parse...>>                   33200000
                                                                        33202000
         IF ITEMP = ";" THEN                                            33204000
            OPTIONS'INX:=ITEMP'OFFSET+1    <<FILESET'INX:=-1>>          33206000
         ELSE                                                           33208000
            BEGIN                                                       33210000
            FILESET'INX:=ITEMP'OFFSET;                                  33212000
            WHILE STEPIT ISNT ENDLINEv AND ITEMP <> ";" DO              33214000
               ;                                                        33216000
            IF ITEMP = ";" THEN                                         33218000
               OPTIONS'INX:=ITEMP'OFFSET+1;                             33220000
            END;                                                        33222000
         END;                                                           33224000
                                                                        33226000
      IF FILESET'INX >= 0 THEN                                 <<06157>>33227000
         CHECK'FILESETS'SYNTAX (TRUE <<"*" ok>>);              <<06157>>33228000
                                                                        33230000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        33232000
      IF DEBUGGING THEN                                                 33234000
         BEGIN                                                          33236000
         SAY "END OF PRE'PARSE'INPUT" ENDSAY;                           33238000
         SEND;                                                          33240000
         SAY "FSET=" ENDSAY; SAYNUM (FILESET'INX);                      33242000
         SAY ", TAPE=" ENDSAY; SAYNUM (TAPE'INX);                       33244000
         SAY ", OPT=" ENDSAY; SAYNUM (OPTIONS'INX);                     33246000
         SEND;                                                          33248000
         END;                                                           33250000
$IF                           <<DEBUGGING CODE>>                        33252000
                                                                        33254000
      END <<PRE'PARSE'INPUT SUB>>;                                      33256000
$PAGE                                                                   33258000
   <<------------------------->>                                        33260000
   << PRINT'SUMMARY           >>                                        33262000
   <<------------------------->>                                        33264000
                                                                        33266000
   SUBROUTINE PRINT'SUMMARY;                                            33268000
                                                                        33270000
            <<This routine prints a blank line and then the             33272000
              summary of the number of files STOREd or RESTOREd>>       33274000
                                                                        33276000
      BEGIN                                                             33278000
                                                                        33280000
      SENDMESSAGE (M'BLANK'LINE);                                       33282000
                                                                        33284000
      SENDMESSAGE (M'STORE'SUMMARY);                                    33286000
                                                                        33288000
      END <<PRINT'SUMMARY SUB>>;                                        33290000
$PAGE                                                                   33292000
   <<--------------------------------->>                                33294000
   << READ'INDIRECT'AND'GENERATE'GOOD >>                                33296000
   <<--------------------------------->>                                33298000
                                                                        33300000
   SUBROUTINE READ'INDIRECT'AND'GENERATE'GOOD;                          33302000
                                                                        33304000
            <<This routine reads the indirect file (I'NUM) and          33306000
              handles any options or filesets found.  It first          33308000
              strips the sequence number (if any) from the end          33310000
              and then calls PRE'PARSE'INPUT.  If the first two         33312000
              characters of the input are "//", then the                33314000
              routine terminates.  (Just like EDITOR/3000's             33316000
              ADD command!)   >>                                        33318000
                                                                        33320000
      BEGIN                                                             33322000
                                                                        33324000
      I'NUM'RECS:=0D;                                                   33326000
      START'INX:=0;           <<no more 'STORE'/'RESTORE' at front!>>   33328000
                                                                        33330000
         <<loop, reading I'NUM, until an EOF or "//" is found...>>      33332000
                                                                        33334000
      WHILE TRUE DO                                                     33336000
         BEGIN                                                          33338000
         FILL' (COMMAND'TEXT', COMMAND'TEXT''LEN, %15);                 33340000
         @PT:=@COMMAND'TEXT';                                           33342000
                                                                        33344000
         LEN:=FREAD (I'NUM, COMMAND'TEXT, I'NUM'RECSIZE);               33346000
                                                                        33348000
         IF < THEN                                                      33350000
            FAIL (SR'IND'IO'ERROR);                                     33352000
                                                                        33354000
         IF > OR PT = "//" THEN   <<eof on indirect file>>              33356000
            BEGIN                                                       33358000
            IF I'NUM'RECS = 0D THEN                                     33360000
               FAIL (SR'IND'EMPTY);                                     33362000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        33364000
            IF DEBUGGING THEN                                           33366000
               BEGIN                                                    33368000
               SAY "I'NUM EOF" ENDSAY;                                  33370000
               SEND;                                                    33372000
               END;                                                     33374000
$IF                           <<DEBUGGING CODE>>                        33376000
            FCLOSE (I'NUM, 0, 0);                                       33378000
            RETURN;                                                     33380000
            END;                                                        33382000
                                                                        33384000
         I'NUM'RECS:=I'NUM'RECS + 1D;                                   33386000
                                                                        33388000
               <<determine number of characters read...>>               33390000
               <<do this each FREAD...file may be variable!>>           33392000
                                                                        33394000
         IF I'NUM'RECSIZE < 0 THEN                                      33396000
            I'NUM'CHARS:=LEN                                            33398000
         ELSE                                                           33400000
            I'NUM'CHARS:=LEN*2;                                         33402000
                                                                        33404000
               <<"drop" the sequence number, if any...>>                33406000
                                                                        33408000
         STRIP'SEQUENCE'NUMBER (PT, I'NUM'CHARS);                       33410000
                                                                        33412000
         WHILE (I'NUM'CHARS > 1) AND (PT(I'NUM'CHARS-1)=" ") DO         33414000
            I'NUM'CHARS:=I'NUM'CHARS-1;  <<strip trailing blanks>>      33416000
                                                                        33418000
               <<append stopper for scanner...>>                        33420000
                                                                        33422000
         PT(I'NUM'CHARS):=%15;                                          33424000
         ILEFT:=INPUTLEN:=I'NUM'CHARS;                                  33426000
                                                                        33428000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        33430000
         IF DEBUGGING THEN                                              33432000
            BEGIN                                                       33434000
            SAY "READ I'NUM, LEN=" ENDSAY;                              33436000
            SAYNUM(LEN);                                                33438000
            SAY ", CHARS=" ENDSAY;                                      33440000
            SAYNUM(I'NUM'CHARS);                                        33442000
            SEND;                                                       33444000
            SAY "TEXT: '" ENDSAY;                                       33446000
            SAY COMMAND'TEXT',(I'NUM'CHARS) ENDSAY;                     33448000
            SAY1("'");                                                  33450000
            SEND;                                                       33452000
            END;                                                        33454000
$IF                           <<DEBUGGING CODE>>                        33456000
                                                                        33458000
            <<do some parsing...an error in either of these             33460000
              will kick us out of this subroutine & procedure>>         33462000
                                                                        33464000
         PRE'PARSE'INPUT (FALSE);   <<preparse indirect>>               33466000
                                                                        33468000
         IF OPTIONS'INX > 0 THEN                                        33470000
            PARSE'OPTIONS;                                              33472000
                                                                        33474000
         IF FILESET'INX >= 0 THEN                                       33476000
            BEGIN                                                       33478000
            ITEMP'OFFSET:=FILESET'INX;                                  33480000
            IF ITEMP <> ";" THEN                                        33482000
               GENERATE'GOOD'FILE;                                      33484000
            END;                                                        33486000
                                                                        33488000
         END;                                                           33490000
                                                                        33492000
      END <<READ'INDIRECT'AND'GENERATE'GOOD SUB>>;                      33494000
$PAGE                                                                   33496000
   <<------------------------->>                                        33498000
   <<  RESTORE'THE'FILES      >>                                        33500000
   <<------------------------->>                                        33502000
                                                                        33504000
   SUBROUTINE RESTORE'THE'FILES;                                        33506000
                                                                        33508000
            <<This routine calls FRESTORE to restore the files          33510000
              selected by IRESTORE.>>                                   33512000
                                                                        33514000
      BEGIN                                                             33516000
                                                                        33518000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        33520000
      IF DEBUGGING THEN                                                 33522000
         BEGIN                                                          33524000
         SAY "RESTORE'THE'FILES" ENDSAY;                                33526000
         SEND;                                                          33528000
         END;                                                           33530000
$IF                           <<DEBUGGING CODE>>                        33532000
                                                                        33534000
      WHY:=WHY'DOING;         <<remember "state">>                      33536000
                                                                        33538000
      IF FRESTORE (TDBUF) = FAILED THEN                                 33540000
         BEGIN                                                          33542000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        33544000
         IF DEBUGGING THEN                                              33546000
            BEGIN                                                       33548000
            SAY "FRESTORE FAILED!" ENDSAY;                              33550000
            SEND;                                                       33552000
            END;                                                        33554000
$IF                           <<DEBUGGING CODE>>                        33556000
         PRINT'SUMMARY;                                                 33558000
         FAIL (0);           <<message already printed>>                33560000
         END;                                                           33562000
                                                                        33564000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        33566000
      IF DEBUGGING THEN                                                 33568000
         BEGIN                                                          33570000
         SAY "FRESTORE GOOD!" ENDSAY;                                   33572000
         SEND;                                                          33574000
         END;                                                           33576000
$IF                           <<DEBUGGING CODE>>                        33578000
                                                                        33580000
      END <<RESTORE'THE'FILES SUB>>;                                    33582000
$PAGE                                                                   33584000
   <<----------------------->>                                          33586000
   <<  SEND'MAIL'TO'PARENT  >>                                          33588000
   <<----------------------->>                                          33590000
                                                                        33592000
   SUBROUTINE SEND'MAIL'TO'PARENT;                                      33594000
                                                                        33596000
         <<This routine sends a reply, via SENDMAIL, to                 33598000
           the caller.  The information sent is: overall                33600000
           result (GOOD/FAILED), GOOD'FILE'COUNT,                       33602000
           and FAILED'FILE'COUNT.                                       33604000
                                                                        33606000
           Note: this must be the last thing done by this               33608000
           procedure, as the caller is not guaranteed to                33610000
           wait around after receiving mail from us to                  33612000
           allow us to clean up nicely!!!!                              33614000
                                                       >>               33616000
                                                                        33618000
      BEGIN                                                             33620000
                                                                        33622000
      REPLY'MESSAGE (MAIL'GOOD):=INTEGER(GOOD'FILE'COUNT);              33624000
      REPLY'MESSAGE (MAIL'BAD) :=INTEGER(FAILED'FILE'COUNT);            33626000
      REPLY'MESSAGE (MAIL'WHY) :=WHY;                                   33628000
                                                                        33630000
            <<note: REPLY'MESSAGE (MAIL'OVERALL) is already             33632000
              set up by INITIALIZE and (maybe) by FAIL!>>               33634000
                                                                        33636000
      STATUS:=SENDMAIL (0, MAIL'LENGTH, REPLY'MESSAGE, FALSE);          33638000
                                                                        33640000
      IF = THEN               <<mail sent>>                             33642000
         BEGIN                <<wait for ack...>>                       33644000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        33646000
         IF DEBUGGING THEN                                              33648000
            BEGIN                                                       33650000
            SAY "sendmail status = " ENDSAY;                            33652000
            SAYNUM (STATUS);                                            33654000
            SEND;                                                       33656000
            END;                                                        33658000
$IF                           <<DEBUGGING CODE>>                        33660000
                                                                        33662000
               <<wait awhile (but not too long) for father              33664000
                 to read mail and reply...>>                            33666000
                                                                        33668000
         I:=MAX'PAUSE'LOOPS;                                            33670000
                                                                        33672000
         WHILE (I:=I-1) >= 0 DO                                         33674000
            BEGIN                                                       33676000
            STATUS:=MAIL (0, LEN);                                      33678000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        33680000
            IF DEBUGGING THEN                                           33682000
               BEGIN                                                    33684000
               SAY "'mail' status = " ENDSAY;                           33686000
               SAYNUM (STATUS);                                         33688000
               SEND;                                                    33690000
               END;                                                     33692000
$IF                           <<DEBUGGING CODE>>                        33694000
            IF STATUS = 1 OR STATUS = 4 THEN                            33696000
               PAUSE (SECS);                                            33698000
            END;                                                        33700000
                                                                        33702000
         STATUS:=RECEIVEMAIL (0, REPLY'MESSAGE, TRUE);                  33704000
                                                                        33706000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        33708000
         IF DEBUGGING THEN                                              33710000
            BEGIN                                                       33712000
            SAY "received mail reply, status = " ENDSAY;                33714000
            SAYNUM (STATUS);                                            33716000
            SEND;                                                       33718000
            END;                                                        33720000
$IF                           <<DEBUGGING CODE>>                        33722000
         END                                                            33724000
      ELSE                                                              33726000
         SENDMESSAGE (SR'SENDMAIL'FAIL);                                33728000
                                                                        33730000
      END <<SEND'MAIL'TO'PARENT SUB>>;                                  33732000
$PAGE                                                                   33734000
   <<----------->>                                                      33736000
   <<  SET'JCW  >>                                                      33738000
   <<----------->>                                                      33740000
                                                                        33742000
   SUBROUTINE SET'JCW;                                                  33744000
                                                                        33746000
         <<This routine sets the STOREJCW jcw to the current>>          33748000
         <<value of WHY.  (WHY reflects the state of STORE, >>          33750000
         <<a value <> WHY'GOOD means STORE failed.)         >>          33752000
                                                                        33754000
      BEGIN                                                             33756000
                                                                        33758000
            <<set the STOREJCW JCW to flag an error...>>                33760000
                                                                        33762000
      MOVE SCRATCH':="STOREJCW ";                                       33764000
                                                                        33766000
      I:=WHY;                                                           33768000
                                                                        33770000
      PUTJCW (SCRATCH', I, DUMMY'I);                                    33772000
                                                                        33774000
      END <<SET'JCW SUB>>;                                              33776000
$PAGE                                                                   33778000
   <<------------>>                                                     33780000
   <<  SM'RESET  >>                                                     33782000
   <<------------>>                                                     33784000
                                                                        33786000
   SUBROUTINE SM'RESET;                                                 33788000
                                                                        33790000
      BEGIN                                                             33792000
                                                                        33794000
            <<If OP but not SM, then we earlier set the SM              33796000
              bit for this user...reset it now...>>                     33798000
                                                                        33800000
      IF NEED'TO'RESET'SM THEN                                          33802000
         BEGIN                                                          33804000
         PUSH(DL);                                                      33806000
         I:=TOS-PS0(-1);                 <<displacement of PCBX>>       33808000
         DB2(I).(00:01):=0;            <<reset SM bit>>                 33810000
         END;                                                           33812000
                                                                        33814000
      END <<SM'RESET SUB>>;                                             33816000
$PAGE                                                                   33818000
   <<---------->>                                                       33820000
   <<  SM'SET  >>                                                       33822000
   <<---------->>                                                       33824000
                                                                        33826000
   SUBROUTINE SM'SET;                                                   33828000
                                                                        33830000
         <<Will set the SM bit in the user's session capabilities,      33832000
           but only if the user already has the OP bit set.>>           33834000
                                                                        33836000
      BEGIN                                                             33838000
                                                                        33840000
      NEED'TO'RESET'SM:=FALSE;                                          33842000
                                                                        33844000
      IF CAP'SM THEN          <<SM>>                                    33846000
         SM'TOG:=TRUE                                                   33848000
                                                                        33850000
      ELSE IF CAP'OP THEN     <<OP>>                                    33852000
         BEGIN                                                          33854000
         PUSH(DL);                                                      33856000
         I:=TOS-PS0(-1);                                                33858000
         DB2(I).(00:01):=1;            <<set SM capability>>            33860000
         CAP'SM:=1;                                                     33862000
         NEED'TO'RESET'SM:=TRUE;                                        33864000
         SM'TOG:=TRUE;                                                  33866000
         END                                                            33868000
                                                                        33870000
      ELSE                    <<NEITHER>>                               33872000
         SM'TOG:=FALSE;                                                 33874000
                                                                        33876000
      END <<SM'SET SUB>>;                                               33878000
$PAGE                                                                   33880000
   <<------------------------->>                                        33882000
   <<  STORE'THE'FILES        >>                                        33884000
   <<------------------------->>                                        33886000
                                                                        33888000
   SUBROUTINE STORE'THE'FILES;                                          33890000
                                                                        33892000
            <<This routine calls FSTORE to do the actual storing        33894000
              of the selected files.  It then checks to see if          33896000
              we HAVE stored all the files we thought we should!>>      33898000
                                                                        33900000
      BEGIN                                                             33902000
                                                                        33904000
      WHY:=WHY'DOING;         <<remember "state">>                      33906000
                                                                        33908000
      IF FSTORE (TDBUF) = FAILED THEN                                   33910000
         BEGIN                                                          33912000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        33914000
         IF DEBUGGING THEN                                              33916000
            BEGIN                                                       33918000
            SAY "FSTORE FAILED, ERROR'CODE=" ENDSAY;                    33920000
            SAYNUM (ERROR'CODE);                                        33922000
            SEND;                                                       33924000
            END;                                                        33926000
$IF                           <<DEBUGGING CODE>>                        33928000
         FAIL (0);                     <<already printed msg>>          33930000
         END;                                                           33932000
                                                                        33934000
            <<see if we exhausted the GOOD file...if we did,            33936000
              the number of files we stored plus the number we          33938000
              failed to store will match FILES'TO'HANDLE...   >>        33940000
                                                                        33942000
      IF FILES'TO'HANDLE <> FAILED'FILE'COUNT + GOOD'FILE'COUNT THEN    33944000
         FAIL (SR'BAD'GOOD'COUNT);                                      33946000
                                                                        33948000
      IF NOT LABELED THEN                                               33950000
         BEGIN                <<unlabeled tape only>>                   33952000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        33954000
         IF DEBUGGING THEN                                              33956000
            BEGIN                                                       33958000
            SAY "FILES STORED OK...CLOSE TAPE NOW" ENDSAY;              33960000
            SEND;                                                       33962000
            END;                                                        33964000
$IF                           <<DEBUGGING CODE>>                        33966000
                                                                        33968000
               <<close tape WITHOUT rewinding it, if    >>              33970000
               <<possible...note that the TEMP'NOREWIND >>              33972000
               <<will leave tape where it is IFF someone>>              33974000
               <<else in our process tree has the same  >>              33976000
               <<device open, otherwise it will cause   >>              33978000
               <<the tape to rewind after an EOF is     >>              33980000
               <<written to the tape!!!!                >>              33982000
                                                                        33984000
         IF T'NUM > 0 AND NOT TAPE'NULL'TOG THEN                        33986000
            FCLOSE (T'NUM, TAPE'CLOSE'DISP, 0);                <<04726>>33988000
         END;                                                           33990000
                                                                        33992000
      T'NUM:=0;                <<stop any future close on tape>>        33994000
                                                                        33996000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        33998000
      IF DEBUGGING THEN                                                 34000000
         BEGIN                                                          34002000
         SAY "STORE'THE'FILES ENDED OK" ENDSAY;                         34004000
         SEND;                                                          34006000
         END;                                                           34008000
$IF                           <<DEBUGGING CODE>>                        34010000
                                                                        34012000
      END <<STORE'THE'FILES SUB>>;                                      34014000
$PAGE "WRITE'TAPEMARKS'ONLY of CXSTORE"                        <<05012>>34014100
<<---------------------->>                                     <<05012>>34014110
<< WRITE'TAPEMARKS'ONLY >>                                     <<05012>>34014120
<<---------------------->>                                     <<05012>>34014130
                                                               <<05012>>34014140
SUBROUTINE WRITE'TAPEMARKS'ONLY;                               <<05012>>34014200
BEGIN                                                          <<05012>>34014300
   OPEN'TAPE'FILE;                                             <<05012>>34014400
   WRITE'TAPE'MARK (PARMS'TEMPI'1);                            <<05012>>34014500
   WRITE'TAPE'MARK (PARMS'TEMPI'1);                            <<05012>>34014600
   FAIL (M'NO'FILES'TO'STORE);                                 <<05012>>34014650
END;                                                           <<05012>>34014700
$PAGE ";CXSTORE=  CXSTORE'RESTORE --- OUTER BLOCK"                      34016000
   <<=====================================================>>            34018000
   <<     O U T E R   B L O C K   O F   C X S T O R E     >>            34020000
   <<=====================================================>>            34022000
   <<First step is to parse the parameters to the command.>>            34024000
   <<To begin with, we do crude check of command.         >>            34026000
   <<=====================================================>>            34028000
                                                                        34030000
   ENABLE'ARITHMETIC'TRAPS;                                             34032000
                                                                        34034000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        34036000
   AHEM;                                                                34038000
$IF                           <<DEBUGGING CODE>>                        34040000
                                                                        34042000
   INITIALIZE'CXSTORE;                                                  34044000
                                                                        34046000
        << Make sure we have a big enough stack >>                      34048000
   ZSIZE (MAX'TAPE'BUF'SIZE + MIN'STACK'SIZE);                          34050000
   IF <> THEN FAIL'NOT'CRITICAL (SR'INSUFSTACK);                        34052000
                                                                        34054000
         <<We dont want to be ABORTed except under our own              34056000
           control, so set critical mode...>>                           34058000
                                                                        34060000
   OLDCRITICAL:=SETCRITICAL;                                            34062000
                                                                        34064000
   SM'SET;                    <<sets SM iff OP set>>                    34066000
                                                                        34068000
   OPEN'SYSLIST'FILE;                                                   34070000
                                                                        34072000
   IF SEEN'TIME THEN          <<TIME>>                                  34072100
      BEGIN                                                             34072200
      SENDMESSAGE (M'TIME'INFO,TRUE);                                   34072210
      SENDMESSAGE (SR'TIM'START);                                       34072300
      END;                                                              34072500
                                                                        34072600
         <<preparse the input, which may result in INDIRECT being       34074000
           opened...>>                                                  34076000
                                                                        34078000
   PRE'PARSE'INPUT (TRUE);                                              34080000
                                                                        34082000
   PARSE'OPTIONS;                                                       34084000
                                                                        34086000
                                                               <<04870>>34088000
   IF DBSTORE'TOG THEN                                         <<04870>>34090000
      IF (NOT SEEN'HIGH) OR (NOT SEEN'LOW) THEN                <<04870>>34092000
         FAIL (SR'DBSTORE'WO'HIGH'AND'LOW);                    <<04870>>34094000
         <<---------------------------------------------------->>       34096000
         << This concludes the parse.  If we made it this far, >>       34098000
         << the rough outline of the command is good.  The next>>       34100000
         << step is to set up the environment of the store by  >>       34102000
         << opening the files...                               >>       34104000
         <<---------------------------------------------------->>       34106000
                                                                        34108000
                                                                        34110000
                                                                        34112000
   IF SYNTAX'TOG THEN                                                   34114000
      BEGIN                                                             34116000
      WHY:=WHY'GOOD;          <<remember "state">>                      34118000
      GO END'CXSTORE;                                                   34120000
      END;                                                              34122000
                                                                        34124000
   OPEN'INDIRECT'FILE;        <<only if it was specified by user>>      34126000
                                                                        34128000
   OPEN'FILES (0D);           <<open all files but tape file>> <<LB.RS>>34130000
                                                               <<05012>>34130100
   IF SYSDUMPING AND ITEMP="NOFILES-NOFILES" THEN              <<05012>>34130200
      WRITE'TAPEMARKS'ONLY;                                    <<05012>>34130400
                                                                        34132000
   SENDMESSAGE (SR'STORE'VERSION);                                      34134000
   SENDMESSAGE (M'DATELINE);                                            34136000
                                                                        34138000
   IF RELEASE'FLAG THEN                                                 34140000
      SENDMESSAGE (SR'PUBLIC'TAPE);                                     34142000
                                                                        34144000
   SENDMESSAGE (M'BLANK'LINE);                                          34146000
                                                                        34148000
         <<we are now ready to do the STORE or RESTORE...>>             34150000
                                                                        34152000
$PAGE ";CXSTORE=  CXSTORE'RESTORE --- RESTORE OUTER BLOCK"              34154000
                                                                        34156000
   IF RESTORING THEN                                                    34158000
      BEGIN                                                             34160000
                                                                        34162000
            <<generate the CANDIDAT file ... (not the GOOD              34164000
              file, but the CANDIDAT file!!)...>>                       34166000
                                                                        34168000
      IF I'NUM <> 0 THEN           <<read recs from INDIRECT...>>       34170000
         READ'INDIRECT'AND'GENERATE'GOOD                                34172000
      ELSE                                                              34174000
         GENERATE'GOOD'FILE;                                            34176000
                                                                        34178000
      IF C'REC'COUNT = 0D THEN                                          34180000
         BEGIN                                                          34182000
         SENDMESSAGE (M'NO'FILES'TO'RESTORE);                           34184000
         PRINT'SUMMARY;                                                 34186000
         CLOSE'FILES (NO'FILE);                                         34188000
         GO END'CXSTORE;                                                34190000
         END;                                                           34192000
                                                                        34194000
      PRE'CHECK'DIREC;                                                  34196000
      OPEN'TAPE'FILE;                                                   34198000
                                                                        34200000
      BUILD'TAPE'BUFFER;                                                34202000
                                                                        34204000
      IF CHECK'STORE'RESTORE'LABEL = FAILED THEN                        34206000
         FAIL (0);                                                      34208000
                                                                        34210000
      BUILD'RESTORE'GOOD'FILE;                                          34212000
                                                                        34214000
      RESTORE'THE'FILES;                                                34216000
                                                                        34218000
      END                                                               34220000
                                                                        34222000
$PAGE ";CXSTORE=  CXSTORE'RESTORE --- STORE OUTER BLOCK"                34224000
                                                                        34226000
   ELSE                                                                 34228000
      BEGIN                                                             34230000
      WHY:=WHY'SCANNING;      <<remember "state">>                      34232000
      IF I'NUM <> 0 THEN           <<read recs from INDIRECT...>>       34234000
         READ'INDIRECT'AND'GENERATE'GOOD                                34236000
      ELSE                                                              34238000
         GENERATE'GOOD'FILE;                                            34240000
                                                                        34242000
      IF FILES'TO'HANDLE = 0D THEN                                      34244000
         IF SYSDUMPING THEN                                    <<05012>>34245000
            WRITE'TAPEMARKS'ONLY                               <<05012>>34245200
         ELSE                                                  <<05012>>34245500
            SENDMESSAGE (M'NO'FILES'TO'STORE)                  <<05012>>34246000
      ELSE IF DBSTORE'TOG AND FILES'REJECTED <> 0D THEN        <<04870>>34248000
         FAIL (0)                                              <<04870>>34250000
      ELSE IF DBSTORE'TOG AND                                  <<04870>>34252000
           (FILES'TO'HANDLE <>                                 <<04870>>34254000
               DOUBLE (DBSTORE'HIGH - DBSTORE'LOW + 2) ) THEN  <<04870>>34256000
         FAIL (SR'INCORRECT'NUMBER'OF'FILES)                   <<04870>>34258000
                                                               <<04870>>34260000
      ELSE                                                              34262000
         BEGIN                                                          34264000
         OPEN'TAPE'FILE;                                                34266000
                                                                        34268000
            <<------------------------------------------------>>        34270000
            << Files parsed, put in file GOOD, tape open,     >>        34272000
            << first EOFs written.  Now put files on tape.    >>        34274000
            <<------------------------------------------------>>        34276000
                                                                        34278000
         BUILD'TAPE'BUFFER;                                             34280000
                                                                        34282000
         STORE'THE'FILES;                                               34284000
                                                                        34284100
         IF SEEN'PURGE THEN                                             34284200
            PURGE'FILES;                                                34284300
         END;                                                           34286000
                                                                        34288000
      END;                                                              34290000
                                                                        34292000
$PAGE ";CXSTORE=  CXSTORE'RESTORE --- WRAPUP"                           34294000
                                                                        34296000
   PRINT'SUMMARY;                                                       34298000
                                                                        34300000
   IF SEEN'TIME THEN          <<TIME>>                                  34300100
      BEGIN                                                             34300200
      SENDMESSAGE (M'TIME'INFO,TRUE);                                   34300210
      SENDMESSAGE (SR'TIM'DONE);                                        34300300
      END;                                                              34300500
                                                                        34300600
   CLOSE'FILES (NO'FILE);             <<ALL OF THEM>>                   34302000
                                                                        34304000
   WHY:=WHY'GOOD;             <<remember "state">>                      34306000
                                                                        34308000
$PAGE                                                                   34310000
END'CXSTORE:                                                            34312000
                                                               <<LB.RS>>34312100
         <<unlock the directory if not already done>>          <<LB.RS>>34312200
                                                               <<LB.RS>>34312300
   RES'ACCT' := " ";                                           <<LB.RS>>34312400
   IF GROUP'INDEX'PTR <> 0 THEN                                <<LB.RS>>34312500
      LOCK'DIRECTORY;                                          <<LB.RS>>34312600
                                                               <<LB.RS>>34312700
         <<set jit acct back>>                                 <<LB.RS>>34312800
   IF SM'TOG AND RESTORING THEN                                <<LB.RS>>34312900
      CHANGE'JIT'ACCT (GET'JITDST, LOGON'ACCT);                <<LB.RS>>34313000
                                                                        34314000
         <<dismount any and all private volumes we may                  34316000
           have mounted prior to this point...>>                        34318000
                                                                        34320000
   IF PV'NUM > 0 THEN                                                   34322000
      DISMOUNT'PRIVATE'VOLUMES;                                         34324000
                                                                        34326000
         <<if we made ourselves SM because we had OP but                34328000
           not SM, reset SM...                          >>              34330000
                                                                        34332000
   SM'RESET;                                                            34334000
                                                                        34336000
         <<now, we can reset critical mode...before this we             34338000
           could not afford to be aborted.                 >>           34340000
                                                                        34342000
   RESETCRITICAL (OLDCRITICAL);                                         34344000
                                                                        34346000
END'CXSTORE'NOT'CRITICAL:                                               34348000
         <<if the caller wanted information communicated                34350000
           through the jcw called STOREJCW, place it                    34352000
           there now...                                    >>           34354000
                                                                        34356000
   IF JCW'FLAG THEN                                                     34358000
      SET'JCW;                                                          34360000
                                                                        34362000
         <<note: the SEND'MAIL'TO'PARENT must be the last               34364000
           executable code in this procedure...all files                34366000
           should be closed, all resources released, before             34368000
           calling it...our parent is not guaranteed to                 34370000
           wait for us to terminate after we send him                   34372000
           mail...if the caller terminates quickly after                34374000
           getting the mail, we terminate too!             >>           34376000
                                                                        34378000
   IF MAIL'TOG THEN                                                     34380000
      SEND'MAIL'TO'PARENT;                                              34382000
                                                                        34384000
   END <<CXSTORE'RESTORE PROC>>;                                        34386000
$PAGE ";THUNK'STORE=  RECIP'STORE --- CLEAN DIRECSCAN INTERFACE"        34388000
$CONTROL SEGMENT=THUNK'STORE                                            34390000
<<*****************************************************************>>   34392000
INTEGER PROCEDURE RECIP'STORE (X'ELEMENT, LEVEL, PARMS'OFFSET, SIR);    34394000
         VALUE LEVEL, PARMS'OFFSET, SIR;                                34396000
         INTEGER LEVEL, PARMS'OFFSET;                                   34398000
         INTEGER ARRAY X'ELEMENT;                                       34400000
         DOUBLE SIR;                                                    34402000
         OPTION PRIVILEGED, UNCALLABLE;                                 34404000
<<----------------------------------------------------------------->>   34406000
<<  RECIP'STORE runs with its DB set to the base of the disk       >>   34408000
<<  directory stack at first.                                      >>   34410000
<<----------------------------------------------------------------->>   34412000
<<                                                                 >>   34414000
<< Parameters to RECIP'STORE                                       >>   34416000
<<                                                                 >>   34418000
<<   X'ELEMENT  -  A directory data segment pointer to file/group/ >>   34420000
<<                 acct entry.                                     >>   34422000
<<                                                                 >>   34424000
<<     LEVEL    -  0=file,  1=group,  2=acct,  3=user (should not  >>   34426000
<<                                                     happen!)    >>   34428000
<< PARMS'OFFSET -  Caller's Q-relative negative displacement of    >>   34430000
<<                 stack parameters passed to DIRECSCAN;           >>   34432000
<<                 Delta-Q must be subtracted to reference as:     >>   34434000
<<                 ARQ (PARMS'OFFSET).                             >>   34436000
<<                                                                 >>   34438000
<<     SIR      -  DSIR and DSIR'INFO                              >>   34440000
<<                                                                 >>   34442000
<<  RECIP'STORE returns (to DIRECSCAN) :                           >>   34444000
<<                                                                 >>   34446000
<<     0 + L   -   continue scan                                   >>   34448000
<<     2 + L   -   skip this tree (scan brother)                   >>   34450000
<<     4 + L   -   stop scan                                       >>   34452000
<<                                                                 >>   34454000
<<           Where  L = 0 if directory not locked down             >>   34456000
<<                            (RECIP'STORE unlocked it).           >>   34458000
<<                  L = 1 if directory is still locked down.       >>   34460000
<<                                                                 >>   34462000
<<----------------------------------------------------------------->>   34464000
<<                                                                 >>   34466000
<< RECIP'STORE is called with DB set to DDS (the stack of the file >>   34468000
<< directory.                                                      >>   34470000
<<  The directory is always locked down when RECIP'STORE is called,>>   34472000
<<  and will stay locked down unless RECIP'STORE unlocks it.       >>   34474000
<<                                                                 >>   34476000
<<----------------------------------------------------------------->>   34478000
   BEGIN                                                                34480000
                                                                        34482000
   INTEGER ARRAY                                                        34484000
      ARQ         (*) = Q + 0,         <<address Q-relative>>           34486000
      ELEMENT     (0:64) = Q;          <<direct Q array...important!>>  34488000
                                                                        34490000
   INTEGER POINTER                                                      34492000
      PARMS;                                                            34494000
                                                                        34496000
   INTEGER                                                              34498000
      LEN         := 0,                                                 34500000
      SIR'1       = SIR + 0,                                            34502000
      SIR'2       = SIR + 1;                                            34504000
                                                                        34506000
   EQUATE                                                               34508000
      DIRDST      = 20;                                                 34510000
                                                                        34512000
         <<--------------------- SPLIT DB ----------------------->>     34514000
                                                                        34516000
         <<subtract delta Q to get total distance>>                     34518000
                                                                        34520000
   PARMS'OFFSET:=PARMS'OFFSET - ARQ;                                    34522000
                                                                        34524000
         <<copy X'ELEMENT into the Q-relative direct array ELEMENT..>>  34526000
                                                                        34528000
   LEN:=64;                                                             34530000
   WHILE (LEN:=LEN-1) >= 0 DO                                           34532000
      ELEMENT(LEN):=X'ELEMENT(LEN);                                     34534000
                                                                        34536000
         <<Now go back to the user's DB...>>                            34538000
                                                                        34540000
   EXCHANGEDB (0);                                                      34542000
                                                                        34544000
         <<pick up PARMS...>>                                           34546000
                                                                        34548000
<< @PARMS:=@ARQ (PARMS'OFFSET); >>                                      34550000
                                                                        34552000
         <<call the non-splitstack procedure to examine this            34554000
           directory entry...>>                                         34556000
                                                                        34558000
   RECIP'STORE:=THUNK'STORE (ELEMENT, LEVEL,                            34560000
                             SIR'1, SIR'2);                             34562000
                                                                        34564000
         <<switch back to the directory stack and exit...>>             34566000
                                                                        34568000
   EXCHANGEDB (DIRDST);                                                 34570000
                                                                        34572000
   END <<RECIP'STORE PROC>>;                                            34574000
$IF X5=ON THEN                                                          40000000
$PAGE "STATISTICS ROUTINE"                                              40002000
$CONTROL SEGMENT=THUNK'STORE                                            40004000
PROCEDURE IOCOUNT;                                                      40006000
BEGIN                                                                   40008000
   DOUBLE ARRAY                                                         40010000
      DISJ'EXT'ADDR(0:31),                                              40012000
      DISJ'EXT'LEN(0:31),                                               40014000
      FL'EXTMAP'D (*) = FLEXTMAP'D;                                     40016000
   INTEGER                                                              40018000
      EXT,                                                              40020000
      NUM'DISJ'EXTS;                                                    40022000
   DOUBLE                                                               40024000
      SECTORS'TO'WRITE,                                                 40026000
      SECTORS'THIS'WRITE;                                               40028000
                                                                        40030000
   SECTORS'TO'WRITE := FILE'SECTORS;                                    40032000
   EXT := -1;                                                           40034000
                                                                        40036000
   WHILE ((EXT:=EXT+1) <= FLNUMEXTS) AND (SECTORS'TO'WRITE<>0D) DO      40038000
      BEGIN                                                             40040000
         IF FLEXTSIZE'D <= SECTORS'TO'WRITE THEN                        40042000
            SECTORS'THIS'WRITE := FLEXTSIZE'D                           40044000
         ELSE SECTORS'THIS'WRITE := SECTORS'TO'WRITE;                   40046000
         SECTORS'TO'WRITE := SECTORS'TO'WRITE - SECTORS'THIS'WRITE;     40048000
         OLD'TAPE'WRITES := OLD'TAPE'WRITES +                           40050000
            (SECTORS'THIS'WRITE-1D)/TAPE'WRITE'SECTORS+1D;              40052000
         OLD'DISC'READS := OLD'DISC'READS  +                            40054000
            (SECTORS'THIS'WRITE-1D)/DISC'READ'SECTORS+1D;               40056000
      END;                                                              40058000
                                                                        40060000
   OLD'TOTAL'EXTENTS := OLD'TOTAL'EXTENTS + DOUBLE(EXT);                40062000
                                                                        40064000
   JOIN'CONTIGUOUS'EXTENTS (NUM'DISJ'EXTS, DISJ'EXT'ADDR,               40066000
                            DISJ'EXT'LEN,  FL'EXTMAP'D   );             40068000
                                                                        40070000
   SECTORS'TO'WRITE := FILE'SECTORS;                                    40072000
   EXT := -1;                                                           40074000
                                                                        40076000
   WHILE ((EXT:=EXT+1) <= NUM'DISJ'EXTS) AND (SECTORS'TO'WRITE<>0D) DO  40078000
      BEGIN                                                             40080000
         IF DISJ'EXT'LEN(EXT) <= SECTORS'TO'WRITE THEN                  40082000
            SECTORS'THIS'WRITE := DISJ'EXT'LEN(EXT)                     40084000
         ELSE SECTORS'THIS'WRITE := SECTORS'TO'WRITE;                   40086000
         SECTORS'TO'WRITE := SECTORS'TO'WRITE - SECTORS'THIS'WRITE;     40088000
         NEW'TAPE'WRITES := NEW'TAPE'WRITES +                           40090000
            (SECTORS'THIS'WRITE-1D)/TAPE'WRITE'SECTORS+1D;              40092000
         NEW'DISC'READS  := NEW'DISC'READS  +                           40094000
            (SECTORS'THIS'WRITE-1D)/DISC'READ'SECTORS+1D;               40096000
      END;                                                              40098000
                                                                        40100000
   NEW'TOTAL'EXTENTS := NEW'TOTAL'EXTENTS + DOUBLE(EXT);                40102000
                                                                        40104000
END;                                                                    40106000
$IF                                                                     40108000
$PAGE ";THUNK'STORE=  THUNK'STORE --- EXAMINES DIRECTORY ENTRIES"       40110000
$CONTROL SEGMENT=THUNK'STORE                                            40112000
<<*****************************************************************>>   40114000
INTEGER PROCEDURE THUNK'STORE (ELEMENT, LEVEL, DSIRNUMBER,              40116000
                               DSIRINFO);                               40118000
         VALUE   LEVEL, DSIRNUMBER, DSIRINFO;                           40120000
         INTEGER LEVEL, DSIRNUMBER, DSIRINFO;                           40122000
         INTEGER ARRAY ELEMENT;                                         40124000
         OPTION PRIVILEGED, UNCALLABLE;                                 40126000
<<----------------------------------------------------------------->>   40128000
<<  THUNK'STORE runs with the original DB, not the DDS DB!         >>   40130000
<<----------------------------------------------------------------->>   40132000
<<                                                                 >>   40134000
<< Parameters to THUNK'STORE                                       >>   40136000
<<                                                                 >>   40138000
<<     ELEMENT  -  A directory data segment pointer to file/group/ >>   40140000
<<                 acct entry.                                     >>   40142000
<<                                                                 >>   40144000
<<     LEVEL    -  0=file,  1=group,  2=acct,  3=user (should not  >>   40146000
<<                                                     happen!)    >>   40148000
<<     PARMS    -  Integer array passed to RECIP'STORE by ISTORE...>>   40150000
<<                 has a lot of information needed by this routine.>>   40152000
<<                                                                 >>   40154000
<<     DSIRNUMBER - Number of (presumably) directory SIR.         >>    40156000
<<     DSIRINFO -  Info returned by GETSIR that got above SIR.    >>    40158000
<<                                                                 >>   40160000
<<  THUNK'STORE returns to RECIP'STORE:                            >>   40162000
<<                                                                 >>   40164000
<<     0 + L   -   continue scan                                   >>   40166000
<<     2 + L   -   skip this tree (scan brother)                   >>   40168000
<<     4 + L   -   stop scan                                       >>   40170000
<<                                                                 >>   40172000
<<           Where  L = 0 if directory not locked down             >>   40174000
<<                     (THUNK'STORE unlocked it).               >  >>   40176000
<<                  L = 1 if directory is still locked down.       >>   40178000
<<                                                                 >>   40180000
<<----------------------------------------------------------------->>   40182000
<<  The directory is always locked down when THUNK'STORE is called,>>   40184000
<<  and will stay locked down unless THUNK'STORE unlocks it.       >>   40186000
<<                                                                 >>   40188000
<<----------------------------------------------------------------->>   40190000
<<                                                                 >>   40192000
<< Only two errors encountered herein are handled out at the       >>   40194000
<< CXSTORE level:  user hit 'break', and the 'GOOD' file got an    >>   40196000
<< I/O error.  These two terminate THUNK'STORE, RECIP'STORE,       >>   40198000
<< DIRECSCAN, DIRECTORY'SEARCH and ISTORE with no messages, then   >>   40200000
<< CXSTORE will call CIERR with the appropriate message number.    >>   40202000
<<                                                                 >>   40204000
<< All other errors are reported from within here via the          >>   40206000
<< SENDMESSAGE routine.  A few errors will abort scanning the      >>   40208000
<< directory FOR THIS FILE ONLY! (E.g: a DIRECSCAN logic error)    >>   40210000
<< Other errors (e.g: failing to read a file label) result in      >>   40212000
<< warning messages and the non-storing of the particular file.    >>   40214000
<<                                                                      40216000
<< NOTE: before ANY output call, THUNK'STORE unlocks all SIRs!!    >>   40218000
<<                                                                 >>   40220000
<<----------------------------------------------------------------->>   40222000
<<----------------------------------------------------------------->>   40224000
<<           !F.G.A returned  !   # of calls    !LEVEL value passed>>   40226000
<<Fileset in !by PRODUCEPARMS ! of THUNK'STORE  !  to THUNK'STORE  >>   40228000
<<LOOK'TITLE'! (- = blank)    !  by DIRECSCAN   !  per call        >>   40230000
<<-----------+----------------+-----------------+------------------>>   40232000
<<           !                !                 !                  >>   40234000
<< F.G.A     !     F.G.A      !        1        !       0          >>   40236000
<<           !                !                 !                  >>   40238000
<< F.G       !     F.G.-      !        1        !       0          >>   40240000
<<           !                !                 !                  >>   40242000
<< F         !     F.-.-      !        1        !       0          >>   40244000
<<           !                !                 !                  >>   40246000
<< @         !     -.-.-      !  #Files         !    0,0,0,...,0   >>   40248000
<<           !                !                 !                  >>   40250000
<< @.G       !     -.G.-      !  #Files         !    0,0,0,...,0   >>   40252000
<<           !                !                 !                  >>   40254000
<< @.G.A     !     -.G.A      !  #Files         !    0,0,0,...,0   >>   40256000
<<           !                !                 !                  >>   40258000
<< @.@       !     -.-.-      !  (#Files+1)     !  1,0,0,0,...,0   >>   40260000
<<           !                !  * #Groups      !  1,0,0,0,...,0   >>   40262000
<<           !                !                 !      etc.        >>   40264000
<<           !                !                 !                  >>   40266000
<< @.@.A     !     -.-.A      !  (#Files+1)     !  1,0,0,0,...,0   >>   40268000
<<           !                !  * #Groups      !  1,0,0,0,   ,0   >>   40270000
<<           !                !                 !      etc.        >>   40272000
<<           !                !                 !                  >>   40274000
<< @.@.@     !     -.-.-      !  ((#Files+1)    !2,1,0,0,0,...,0   >>   40276000
<<           !                !  * (#Groups+1)  !  1,0,0,0,...,0   >>   40278000
<<           !                !  * #Accounts    !  1,0,0,0,...,0   >>   40280000
<<           !                !                 !      etc.        >>   40282000
<<           !                !                 !2,1,0,0,0,...,0   >>   40284000
<<           !                !                 !  1,0,0,0,...,0   >>   40286000
<<           !                !                 !  1,0,0,0,...,0   >>   40288000
<<           !                !                 !      etc.        >>   40290000
<<----------------------------------------------------------------->>   40292000
                                                                        40294000
   BEGIN                                                                40296000
                                                                        40298000
   DOUBLE ARRAY                                                         40300000
      ELEMENT'D   (*) = ELEMENT (0),                                    40302000
      EXTENT'ADDR'D (0:32),                                             40304000
      GBUF'D      (0:G'RECSIZE/2);                                      40306000
                                                                        40308000
   DOUBLE                                                               40310000
      IOB,                                                              40312000
      LABEL'ADDRESS := 0D;                                              40314000
                                                                        40316000
                                                                        40318000
   INTEGER ARRAY                                                        40320000
      GBUF        (*) = GBUF'D (0),                                     40322000
      PVBUF       (0:PV'RECSIZE-1);                                     40324000
                                                                        40326000
   INTEGER                                                              40328000
      HVSIND      := [8/"*", 8/" "],                                    40330000
      I           := 0,       <<scratch integer>>                       40332000
      LABEL'ADDRESS'1 = LABEL'ADDRESS + 0,                              40334000
      LABEL'ADDRESS'2 = LABEL'ADDRESS + 1,                              40336000
      LABEL'LDEV,                                                       40338000
      LEN,                                                              40340000
      REQTYPE,                                                          40342000
      X           := 0;       <<used by CHECKSUM>>                      40344000
                                                                        40346000
   LOGICAL ARRAY                                                        40348000
      MESS        (0:MAX'TITLE'LEN*2);                                  40350000
                                                                        40352000
   LOGICAL                                                              40354000
      LOCKED'THE'FILE:=FALSE,                                           40356000
      MATCHED'PATTERN:=FALSE,                                           40358000
      NEED'REL'DSIR := FALSE, <<if true, RELSIR(DSIR) at end>>          40360000
      YES;                                                              40362000
                                                                        40364000
   BYTE ARRAY                                                           40366000
      ELEMENT'    (*) = ELEMENT (0),                                    40368000
      GBUF'       (*) = GBUF (0),                                       40370000
      MESS'       (*) = MESS (0),                                       40372000
      TEMP'       (0:9);                                                40374000
                                                                        40376000
   EQUATE                                                               40378000
      DTIMU       =  5;  <<frequency of unlocking DDS by THUNK'STORE>>  40380000
                                                                        40382000
   LABEL                                                                40384000
      THUNK'STORE'EXIT;                                                 40386000
                                                                        40388000
   <<---------------->>                                                 40390000
   <<  FAIL          >>                                                 40392000
   <<---------------->>                                                 40394000
                                                                        40396000
   SUBROUTINE FAIL (THUNK'STOREVAL, MNUM);                              40398000
         VALUE   MNUM, THUNK'STOREVAL;                                  40400000
         INTEGER MNUM, THUNK'STOREVAL;                                  40402000
      BEGIN                                                             40404000
                                                                        40406000
      IF MNUM <> 0 THEN                                                 40408000
         BEGIN                                                          40410000
         RELEASE'SIRS (GOT'FISIR, GOT'DSIR);                            40412000
         SENDMESSAGE (MNUM);                                            40414000
         END;                                                           40416000
                                                                        40418000
      IF MATCHED'PATTERN THEN                                           40420000
         FILES'REJECTED:=FILES'REJECTED + 1D;                           40422000
                                                                        40424000
      IF THUNK'STOREVAL = RC'STOP THEN                                  40426000
         THUNK'STORE'ERR:=TRUE;                                         40428000
                                                                        40430000
      THUNK'STORE:=THUNK'STOREVAL;                                      40432000
                                                                        40434000
      GO THUNK'STORE'EXIT;                                              40436000
                                                                        40438000
      END <<FAIL SUB>>;                                                 40440000
                                                                        40442000
   <<----------------->>                                                40444000
   <<  LOCK'THE'FILE  >>                                                40446000
   <<----------------->>                                                40448000
                                                                        40450000
   SUBROUTINE LOCK'THE'FILE;                                            40452000
      BEGIN                                                             40454000
                                                                        40456000
      IF FLCLID <> COLD'LOAD'ID THEN                                    40458000
         BEGIN                <<COLD LOAD ID NOT VALID>>                40460000
         COUNT'REWRITES'COLD'LOAD'ID:=COUNT'REWRITES'COLD'LOAD'ID+1;    40462000
         FLSTORERESTORE := 0;                                           40464000
         FLWRITE:=0;                                                    40466000
         FLRW := 0;                                                     40468000
         FLLOADED := 0;                                                 40470000
         FLFCBVECT := 0D;                                      <<LB.36>>40472000
         FLPVINFO  := 0;                                       <<LB.36>>40473000
         FLCLID := COLD'LOAD'ID;                                        40474000
         FLAB'CHECKSUM;                                                 40476000
         END;                                                           40478000
                                                                        40480000
      IF FLSTORE <> 0 THEN                                              40482000
         FAIL (0, M'OPEN'FOR'STORE);                                    40484000
                                                                        40486000
      IF FLRESTORE <> 0 THEN                                            40488000
         FAIL (0, M'OPEN'FOR'RESTORE);                                  40490000
                                                                        40492000
      IF FLWRITE <> 0 THEN                                              40494000
         FAIL (0, M'OPEN'FOR'WRITE);                                    40496000
                                                                        40498000
            <<we get here also if we need to rewrite coldloadid!>>      40500000
                                                                        40502000
      FLSTORE:=1;          <<LOCK IT DOWN>>                             40504000
                                                                        40506000
      IF WRITE'LABEL (LABEL'LDEV, LABEL'ADDRESS, GOT'SIR)               40508000
            = FAILED THEN                                               40510000
         FAIL (0, M'NOLOCK'WRITE'FAIL);                                 40512000
                                                                        40514000
      LOCKED'THE'FILE:=TRUE;                                            40516000
                                                                        40518000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        40520000
      IF DEBUGGING THEN                                                 40522000
         BEGIN                                                          40524000
         SAY "LOCK'THE'FILE GOOD" ENDSAY;                               40526000
         SEND;                                                          40528000
         END;                                                           40530000
$IF                           <<DEBUGGING CODE>>                        40532000
                                                                        40534000
      END <<LOCK'THE'FILE SUB>>;                                        40536000
                                                                        40538000
   <<--------------------->>                                            40540000
   <<  REPORT'DATES       >>                                            40542000
   <<--------------------->>                                            40544000
                                                                        40546000
   SUBROUTINE REPORT'DATES (TYP, LO, MID, HI);                          40548000
         VALUE TYP, LO, MID, HI;                                        40550000
         LOGICAL TYP, LO, MID, HI;                                      40552000
                                                                        40554000
      BEGIN                                                             40556000
                                                                        40558000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        40560000
      SAY "   " ENDSAY;                                                 40562000
      SAY1 (TYP);                                                       40564000
      SAY "DATE NOT IN RANGE: " ENDSAY;                                 40566000
      SAYDNUM(DOUBLE(LO));                                              40568000
      SAY " <= " ENDSAY;                                                40570000
      SAYDNUM(DOUBLE(MID));                                             40572000
      SAY " <= " ENDSAY;                                                40574000
      SAYDNUM(DOUBLE(HI));                                              40576000
      SEND;                                                             40578000
$IF                           <<DEBUGGING CODE>>                        40580000
                                                                        40582000
      END <<REPORT'DATES SUB>>;                                         40584000
                                                                        40586000
   <<------------------>>                                               40588000
   <<  ALWAYS'MATCHES  >>                                               40590000
   <<------------------>>                                               40592000
                                                                        40594000
   LOGICAL SUBROUTINE ALWAYS'MATCHES (PATTERN);                         40596000
        INTEGER ARRAY PATTERN;                                          40598000
                                                                        40600000
     BEGIN                                                              40602000
                                                                        40604000
     ALWAYS'MATCHES:= FALSE;                                            40606000
     IF PATTERN(0) = 1 THEN                                             40608000
        IF PATTERN(1).PATTYPEf = ANYCHARACTERSp THEN                    40610000
           ALWAYS'MATCHES:= TRUE;                                       40612000
                                                                        40614000
     END <<ALWAYS'MATCHES SUB>>;                                        40616000
   <<------------------------------------------------------------>>     40618000
$PAGE ";THUNK'STORE=  THUNK'STORE --- OUTER BLOCK"                      40620000
                                                                        40622000
   ERROR'CODE:=0;               <<indicates no serious error>>          40624000
                                                                        40626000
   DSIR'INFO:=DSIRINFO;                                                 40628000
                                                                        40630000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        40632000
   IF DEBUGGING THEN                                                    40634000
      BEGIN                                                             40636000
      SAY "DSIR'INFO:= " ENDSAY;                                        40638000
      SAYNUM (DSIR'INFO);                                               40640000
      SEND;                                                             40642000
      END;                                                              40644000
$IF                           <<DEBUGGING CODE>>                        40646000
                                                                        40648000
   GOT'DSIR:=TRUE;                                                      40650000
                                                                        40652000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        40654000
   IF DEBUGGING THEN                                                    40656000
      BEGIN                                                             40658000
      SAY "THUNK'STORE: LEVEL=" ENDSAY;                                 40660000
      SAYNUM (LEVEL);                                                   40662000
      SAY ", ELEMENT = " ENDSAY;                                        40664000
      SAY ELEMENT',(FILE'PART'SIZE) ENDSAY;                             40666000
      SAY ", LOOK'TITLE = " ENDSAY;                                     40668000
      SAY'STANDARD (LOOK'TITLE');                                       40670000
      SEND;                                                             40672000
      END;                                                              40674000
$IF                           <<DEBUGGING CODE>>                        40676000
                                                               <<04965>>40676100
   IF THUNK'STORE'ERR THEN                                     <<04965>>40676200
      FAIL (RC'STOP, 0);                                       <<04965>>40676300
                                                                        40678000
   IF NOT (0<=LEVEL<=2) THEN                                            40680000
      FAIL (RC'STOP, M'DIRECSCAN'ERROR);                                40682000
                                                                        40684000
         <<see if the user hit BREAK...                                 40686000
           if so, terminate the search, but DONT unlock the             40688000
           files...this will be done by the caller (or the              40690000
           caller's caller?)...>>                                       40692000
                                                                        40694000
   IF REQUESTSERVICE THEN              <<saw a BREAK/ABORT>>            40696000
      FAIL (RC'STOP, SR'BREAK'SENSED);                                  40698000
                             <<be printed by CXSTORE'RESTORE>>          40700000
                                                                        40702000
         <<extract the file (or group or acct) part from ELEMENT...     40704000
           and place it (plus its length count) into TEMP'...>>         40706000
                                                                        40708000
   MOVE TEMP'(1):=ELEMENT',(FILE'PART'SIZE);                            40710000
   TEMP'(9):=" ";             <<place a stopper at the end>>            40712000
   SCAN TEMP'(1) UNTIL " ",1; <<leave pointer on stack>>                40714000
   LEN:=TOS-LOGICAL(@TEMP'(1));                                         40716000
   TEMP'(0):=BYTE(LEN);                                                 40718000
                                                                        40720000
         <<See if this title part is valid alphanumeric...>>            40722000
                                                                        40724000
   MOVE TEMP'(1):=TEMP'(1) WHILE AN, 1;      <<leave dest addr>>        40726000
   LEN:=TOS-LOGICAL(@TEMP'(1));        <<length of alpha>>              40728000
                                                                        40730000
   IF LEN <> INTEGER(TEMP'(0)) OR TEMP'(1) <> ALPHA THEN                40732000
      BEGIN                                                             40734000
      IF LEVEL = ACCTLEVEL THEN                                         40736000
         FAIL (SKIPTREE, SR'BAD'ACCT'IN'DIRECSCAN);                     40738000
      IF LEVEL = GROUPLEVEL THEN                                        40740000
         FAIL (SKIPTREE, SR'BAD'GROUP'IN'DIRECSCAN);                    40742000
      FAIL (SKIPNODE, SR'BAD'FILE'IN'DIRECSCAN);                        40744000
      END;                                                              40746000
                                                                        40748000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        40750000
   IF DEBUGGING THEN                                                    40752000
      BEGIN                                                             40754000
      SAY "   TEMP' = '" ENDSAY;                                        40756000
      SAY TEMP'(1),(LEN) ENDSAY;                                        40758000
      SAY "'  LEN = " ENDSAY;                                           40760000
      SAYNUM (LEN);                                                     40762000
      SEND;                                                             40764000
      END;                                                              40766000
$IF                           <<DEBUGGING CODE>>                        40768000
$PAGE ";THUNK'STORE=  THUNK'STORE --- ACCOUNT LEVEL HANDLING"           40770000
   IF LEVEL = ACCTLEVEL THEN                                            40772000
      BEGIN                                                             40774000
                                                                        40776000
            <<see if the account matches...>>                           40778000
                                                                        40780000
      IF LOOK'ACCT'PAT <> 0 THEN                                        40782000
         IF PATTERN'MATCH (TEMP', LOOK'ACCT'PAT) = FAILED THEN          40784000
            BEGIN                                                       40786000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        40788000
            IF DEBUGGING THEN                                           40790000
               BEGIN                                                    40792000
               SAY "   ACCT MIS" ENDSAY;                                40794000
               REPORT'MISMATCH (ELEMENT', LOOK'ACCT'PAT);               40796000
               END;                                                     40798000
$IF                           <<DEBUGGING CODE>>                        40800000
            FAIL (SKIPTREE, 0);                                         40802000
            END;                                                        40804000
                                                                        40806000
            <<if the 'exception account' matches this account,          40808000
              and the group & file exception patterns are "@"           40810000
              then leave...>>                                           40812000
                                                                        40814000
      IF NOT'ACCT'PAT <> 0 THEN                                         40816000
         IF ALWAYS'MATCHES (NOT'FILE'PAT)  AND                          40818000
               ALWAYS'MATCHES (NOT'GROUP'PAT) AND                       40820000
               (PATTERN'MATCH (TEMP', NOT'ACCT'PAT) = GOOD) THEN        40822000
            BEGIN                                                       40824000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        40826000
            IF DEBUGGING THEN                                           40828000
               BEGIN                                                    40830000
               SAY "   NOT ACCT " ENDSAY;                               40832000
               REPORT'MISMATCH (ELEMENT', NOT'ACCT'PAT);                40834000
               END;                                                     40836000
$IF                           <<DEBUGGING CODE>>                        40838000
            FAIL (SKIPTREE, 0);                                         40840000
            END;                                                        40842000
                                                                        40844000
      FILL' (CURR'TITLE', MAX'STD'LEN, 0);                              40846000
                                                                        40848000
      MOVE CURR'ACCT:=ELEMENT(0),(4);  <<Account name>>                 40850000
      FILL (CURR'FILE, 4, "??");       <<blank out file entry>>         40852000
      FILL (CURR'GROUP, 4, "??");      <<blank out the group entry>>    40854000
      IF DISPLAY'3'TO'STANDARD (CURR'FILE', CURR'GROUP',                40856000
                             CURR'ACCT', CURR'TITLE', ERROR'CODE)       40858000
            = FAILED THEN                                               40860000
         FAIL (0, SR'D'2'S'FAILED);                                     40862000
                                                                        40864000
      A'SECURITY:=ELEMENT(26);         <<Account security>>             40866000
                                                                        40868000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        40870000
      IF DEBUGGING THEN                                                 40872000
         BEGIN                                                          40874000
         SAY "  Good account! " ENDSAY;                                 40876000
         SEND;                                                          40878000
         END;                                                           40880000
$IF                           <<DEBUGGING CODE>>                        40882000
                                                                        40884000
      GO THUNK'STORE'EXIT;                                              40886000
                                                                        40888000
      END;                                                              40890000
$PAGE ";THUNK'STORE=  THUNK'STORE --- GROUP LEVEL HANDLING"             40892000
   IF LEVEL = GROUPLEVEL THEN                                           40894000
      BEGIN                                                             40896000
                                                                        40898000
      IF LOOK'GROUP'PAT <> 0 THEN                                       40900000
         IF PATTERN'MATCH (TEMP', LOOK'GROUP'PAT) = FAILED THEN         40902000
            BEGIN                                                       40904000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        40906000
            IF DEBUGGING THEN                                           40908000
               BEGIN                                                    40910000
               SAY "   LOOK'GROUP MIS" ENDSAY;                          40912000
               REPORT'MISMATCH (ELEMENT', LOOK'GROUP'PAT);              40914000
               END;                                                     40916000
$IF                           <<DEBUGGING CODE>>                        40918000
            FAIL (SKIPTREE, 0);                                         40920000
            END;                                                        40922000
                                                                        40924000
      IF NOT'GROUP'PAT <> 0 THEN                                        40926000
         IF ALWAYS'MATCHES (NOT'FILE'PAT) AND                           40928000
               ALWAYS'MATCHES (NOT'ACCT'PAT) AND                        40930000
               (PATTERN'MATCH (TEMP', NOT'GROUP'PAT) = GOOD) THEN       40932000
            BEGIN                                                       40934000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        40936000
            IF DEBUGGING THEN                                           40938000
               BEGIN                                                    40940000
               SAY "   NOT'GROUP " ENDSAY;                              40942000
               REPORT'MISMATCH (ELEMENT', NOT'GROUP'PAT);               40944000
               END;                                                     40946000
$IF                           <<DEBUGGING CODE>>                        40948000
            FAIL (SKIPTREE, 0);                                         40950000
            END;                                                        40952000
                                                                        40954000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        40956000
      IF DEBUGGING THEN                                                 40958000
         BEGIN                                                          40960000
         SAY "   Good group!" ENDSAY;                                   40962000
         SEND;                                                          40964000
         END;                                                           40966000
$IF                           <<DEBUGGING CODE>>                        40968000
                                                                        40970000
      G'SECURITY'1:=ELEMENT(21);                                        40972000
      G'SECURITY'2:=ELEMENT(22);                                        40974000
      MOVE CURR'GROUP:=ELEMENT,(4);                                     40976000
      IF DISPLAY'3'TO'STANDARD (CURR'FILE', CURR'GROUP',                40978000
                             CURR'ACCT', CURR'TITLE', ERROR'CODE)       40980000
            = FAILED THEN                                               40982000
         FAIL (0, SR'D'2'S'FAILED);                                     40984000
                                                                        40986000
      IF ELEMENT (GLINKAGE).(PVF) = PV THEN                             40988000
         BEGIN                <<group assigned to PV>>                  40990000
         RELEASE'SIRS (FALSE, GOT'DSIR);                                40992000
                                                                        40994000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        40996000
         IF DEBUGGING THEN                                              40998000
            BEGIN                                                       41000000
            SAY "   Group on PV!" ENDSAY;                               41002000
            SEND;                                                       41004000
            END;                                                        41006000
$IF                           <<DEBUGGING CODE>>                        41008000
         REQTYPE:=CONDMOUNT'BIND;                                       41010000
                                                                        41012000
         MOUNT (HVSIND, CURR'GROUP, CURR'ACCT,                          41014000
                REQTYPE, -1, MOUNTED'VOLUME'INFO);                      41016000
                                                                        41018000
         IF < THEN                                                      41020000
            BEGIN                      <<MOUNT PROBLEM>>                41022000
            MOVE FLAB:="@       ",2;                                    41024000
            MOVE *:=CURR'GROUP,(4),2;                                   41026000
            MOVE *:=CURR'ACCT,(4);                                      41028000
            MOUNTED'VOLUME'INFO := 0;                                   41030000
            SENDMESSAGE (M'PV'MOUNT'PROBLEM);                           41032000
            FAIL (SKIPTREE, 0);        <<Stops scan of this tree>>      41034000
            END;                                                        41036000
                                                                        41038000
         MOVE PVBUF(pvinx'GROUP):=CURR'GROUP,(4);                       41040000
         MOVE PVBUF(pvinx'ACCT) :=CURR'ACCT, (4);                       41042000
         PVBUF(pvinx'PVINFO):=MOUNTED'VOLUME'INFO;                      41044000
                                                                        41046000
         FWRITE (PV'NUM, PVBUF, PV'RECSIZE, 0);                         41048000
         IF <> THEN                                                     41050000
            FAIL (0, SR'PV'WRITE'FAIL);                                 41052000
                                                                        41054000
         MOUNTED'VOLUME'INFO.(0:2) := 3; <<IND MOUNT REQUIRED>>         41056000
         THUNK'STORE.(0:1) := 1;           <<need to redo entry>>       41058000
         END                                                            41060000
      ELSE                                                              41062000
         MOUNTED'VOLUME'INFO:=SP'PV;                                    41064000
                                                                        41066000
      GO THUNK'STORE'EXIT;                                              41068000
                                                                        41070000
      END;                                                              41072000
$PAGE ";THUNK'STORE=  THUNK'STORE --- FILE LEVEL HANDLING"              41074000
         <<If we get here, LEVEL = FILELEVEL>>                          41076000
                                                                        41078000
   IF LOOK'FILE'PAT <> 0 THEN                                           41080000
      IF PATTERN'MATCH (TEMP', LOOK'FILE'PAT) = FAILED THEN             41082000
         BEGIN                                                          41084000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41086000
         IF DEBUGGING THEN                                              41088000
            BEGIN                                                       41090000
            SAY "   LOOK'FILE MIS" ENDSAY;                              41092000
            REPORT'MISMATCH (ELEMENT', LOOK'FILE'PAT);                  41094000
            END;                                                        41096000
$IF                           <<DEBUGGING CODE>>                        41098000
         FAIL (SKIPNODE, 0);                                            41100000
         END;                                                           41102000
                                                                        41104000
   RC'CALLS := RC'CALLS + 1;                                            41106000
                                                                        41108000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41110000
   IF DEBUGGING THEN                                                    41112000
      BEGIN                                                             41114000
      SEND;                                                             41116000
      SAY "THUNK'STORE # " ENDSAY;                                      41118000
      SAYNUM (RC'CALLS);                                                41120000
      SEND;                                                             41122000
      END;                                                              41124000
$IF                           <<DEBUGGING CODE>>                        41126000
                                                                        41128000
   MOVE CURR'FILE:=ELEMENT(0),(4);                                      41130000
                                                                        41132000
         <<convert current file title to standard form...>>             41134000
                                                                        41136000
   IF DISPLAY'3'TO'STANDARD (CURR'FILE', CURR'GROUP', CURR'ACCT',       41138000
                             CURR'TITLE', ERROR'CODE)                   41140000
         = FAILED THEN                                                  41142000
      FAIL (0, SR'D'2'S'FAILED);                                        41144000
                                                                        41146000
         <<see if the user did not want this file STOREd...>>           41148000
                                                                        41150000
   IF NOT'FILE'PAT <> 0 THEN                                            41152000
      IF PATTERN'MATCH'STANDARD (CURR'TITLE', NOT'FILE'PAT,             41154000
                                NOT'GROUP'PAT, NOT'ACCT'PAT, I)         41156000
               = GOOD THEN                                              41158000
         BEGIN                                                          41160000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41162000
         IF DEBUGGING THEN                                              41164000
            BEGIN                                                       41166000
            SAY "   NOT'FILE " ENDSAY;                                  41168000
            SAYNUM (I);                                                 41170000
            SAY " for " ENDSAY;                                         41172000
            SAY'STANDARD (CURR'TITLE');                                 41174000
            SEND;                                                       41176000
            REPORT'MISMATCH (ELEMENT', NOT'FILE'PAT);                   41178000
            END;                                                        41180000
$IF                           <<DEBUGGING CODE>>                        41182000
         FAIL (SKIPNODE, 0);                                            41184000
         END;                                                           41186000
                                                                        41188000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41190000
   IF DEBUGGING THEN                                                    41192000
      BEGIN                                                             41194000
      SAY "   file " ENDSAY;                                            41196000
      SAY'STANDARD (CURR'TITLE');                                       41198000
      SAY " worked for: " ENDSAY;                                       41200000
      SEND;                                                             41202000
      SAY "      " endsay;                                              41204000
      SAY'PATTERN (LOOK'FILE'PAT);                                      41206000
      SAY " and not for: " ENDSAY;                                      41208000
      SAY'PATTERN (NOT'FILE'PAT);                                       41210000
      SEND;                                                             41212000
      END;                                                              41214000
$IF                           <<DEBUGGING CODE>>                        41216000
                                                                        41218000
         <<if we get here, the file found matched the  >>               41220000
         <<pattern specifed, so the user expects it to >>               41222000
         <<be stored, unless something goes wrong.     >>               41224000
                                                                        41226000
   MATCHED'PATTERN:=TRUE;                                               41228000
                                                                        41230000
         <<pick up label address...>>                                   41232000
                                                                        41234000
   LABEL'ADDRESS:=ELEMENT'D(2);   <<  ELEMENT(4 & 5) >>                 41236000
   LABEL'ADDRESS'1.(00:08):=0;    <<zap the LUN portion of address>>    41238000
                                                                        41240000
         <<map the Logical unit number into a logical                   41242000
           device number...>>                                           41244000
                                                                        41246000
   LABEL'LDEV:= LUN (ELEMENT(4).(0:8), MOUNTED'VOLUME'INFO.(4:4));      41248000
                                                                        41250000
   IF NOT GOT'FISIR OR NOT GOT'DSIR THEN                                41252000
      BEGIN                                                             41254000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41256000
      IF DEBUGGING THEN                                                 41258000
         BEGIN                                                          41260000
         SAY "...IN THUNK'STORE: GOT'FISIR=" ENDSAY;                    41262000
         SAYNUM (GOT'FISIR);                                            41264000
         SAY ", GOT'DSIR=" ENDSAY;                                      41266000
         SAYNUM (GOT'DSIR);                                             41268000
         SEND;                                                          41270000
         END;                                                           41272000
$IF                           <<DEBUGGING CODE>>                        41274000
      GET'SIRS (TRUE, TRUE);          <<get FISIR and DSIR>>            41276000
      NEED'REL'DSIR:=TRUE;                   <<release at end>>         41278000
      END;                                                              41280000
                                                                        41282000
   IF READ'LABEL (LABEL'LDEV, LABEL'ADDRESS, GOT'SIR)                   41284000
         = FAILED THEN                                                  41286000
      BEGIN                                                             41288000
      PARMS'TEMPI'1:=LABEL'LDEV;                                        41290000
      PARMS'TEMPD'1:=LABEL'ADDRESS;                                     41292000
      FAIL (0, M'READ'FILE'LABEL'FAILED);                               41294000
      END;                                                              41296000
                                                                        41298000
         <<see if the file label info matches the directory info...>>   41300000
                                                                        41302000
   IF ELEMENT'D(2) <> FLEXTMAP'D THEN        <<address match? >>        41304000
      FAIL (0, M'FLAB'ADDRESS'MISMATCH);                                41306000
                                                                        41308000
   IF FLLOCNAME' = CURR'FILE',(FILE'PART'SIZE) AND                      41310000
      FLGRPNAME' = CURR'GROUP',(FILE'PART'SIZE) AND                     41312000
      FLACCTNAME'= CURR'ACCT',(FILE'PART'SIZE) THEN                     41314000
   ELSE                                                                 41316000
      FAIL (0, M'FLAB'TITLE'MISMATCH);                                  41318000
                                                                        41320000
         <<check the file label checksum...>>                           41322000
                                                                        41324000
   I:=FLCHECKSUM;                                                       41326000
   FLAB'CHECKSUM;                                                       41328000
   IF I <> 0 AND I <> FLCHECKSUM THEN                                   41330000
      BEGIN                                                             41332000
      PARMS'TEMPI'1:=FLCHECKSUM;                                        41334000
      PARMS'TEMPI'2:=I;                                                 41336000
      FAIL (0, M'FLAB'CHECKSUM);                                        41338000
      END;                                                              41340000
                                                                        41342000
         <<see if we can calculate the filesize...>>                    41344000
                                                                        41346000
   FILE'SECTORS:=FIND'FILE'SIZE (FILE'SIZE'MINv,                        41348000
                                 EXTENT'ADDR'D);                        41350000
                                                                        41352000
$IF X5=ON THEN                                                          41354000
   IOCOUNT;         <<COUNT DISC READS,TAPE WRITES>>                    41356000
$IF                                                                     41358000
         <<Do DATE check...>>                                           41360000
                                                                        41362000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41364000
   IF DEBUGGING THEN                                                    41366000
      BEGIN                                                             41368000
      SAY "***FILE = " ENDSAY;                                          41370000
      SAY FLLOCNAME', (FILE'PART'SIZE) ENDSAY;  SAY1(".");              41372000
      SAY FLGRPNAME', (FILE'PART'SIZE) ENDSAY;  SAY1(".");              41374000
      SAY FLACCTNAME',(FILE'PART'SIZE) ENDSAY;                          41376000
      SEND;                                                             41378000
      END;                                                              41380000
$IF                           <<DEBUGGING CODE>>                        41382000
                                                                        41384000
   IF ADATE'LOW > FLLASTACC                                             41386000
         OR ADATE'HIGH < FLLASTACC THEN                                 41388000
      BEGIN                                                             41390000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41392000
      IF DEBUGGING THEN                                                 41394000
         BEGIN                                                          41396000
         REPORT'DATES ("A", ADATE'LOW, FLLASTACC, ADATE'HIGH);          41398000
         END;                                                           41400000
$IF                           <<DEBUGGING CODE>>                        41402000
      MATCHED'PATTERN:=SIMPLE'TOG;                                      41404000
      IF SIMPLE'TOG THEN                                                41406000
         FAIL (0, M'ADATE'NOT'IN'RANGE)                                 41408000
      ELSE                                                              41410000
         FAIL (0, 0);         <<access date not in range>>              41412000
      END;                                                              41414000
                                                                        41416000
   IF CDATE'LOW > FLCREATE                                              41418000
         OR CDATE'HIGH < FLCREATE THEN                                  41420000
      BEGIN                                                             41422000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41424000
      IF DEBUGGING THEN                                                 41426000
         BEGIN                                                          41428000
         REPORT'DATES ("C", CDATE'LOW, FLCREATE, CDATE'HIGH);           41430000
         END;                                                           41432000
$IF                           <<DEBUGGING CODE>>                        41434000
      MATCHED'PATTERN:=SIMPLE'TOG;                                      41436000
      IF SIMPLE'TOG THEN                                                41438000
         FAIL (0, M'CDATE'NOT'IN'RANGE)                                 41440000
      ELSE                                                              41442000
         FAIL (0, 0);         <<create date not in range>>              41444000
      END;                                                              41446000
                                                                        41448000
   IF MDATE'LOW > FLLASTMOD                                             41450000
         OR MDATE'HIGH < FLLASTMOD THEN                                 41452000
      BEGIN                                                             41454000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41456000
      IF DEBUGGING THEN                                                 41458000
         BEGIN                                                          41460000
         REPORT'DATES ("M", MDATE'LOW, FLLASTMOD, MDATE'HIGH);          41462000
         END;                                                           41464000
$IF                           <<DEBUGGING CODE>>                        41466000
      MATCHED'PATTERN:=SIMPLE'TOG;                                      41468000
      IF SIMPLE'TOG THEN                                                41470000
         FAIL (0, M'MDATE'NOT'IN'RANGE)                                 41472000
      ELSE                                                              41474000
         FAIL (0, 0);         <<modify date not in range>>              41476000
      END;                                                              41478000
                                                                        41480000
         <<Do filecode range check...>>                                 41482000
                                                                        41484000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41486000
   IF DEBUGGING THEN                                                    41488000
      BEGIN                                                             41490000
      SAY "   DATE OK, DO FILECODE CHECK..." ENDSAY;                    41492000
      SEND;                                                             41494000
      END;                                                              41496000
$IF                           <<DEBUGGING CODE>>                        41498000
                                                                        41500000
   IF NOT (FILECODE'LOW <= FLFILECODE <= FILECODE'HIGH) THEN            41502000
      BEGIN                                                             41504000
      MATCHED'PATTERN:=SIMPLE'TOG;                                      41506000
      IF SIMPLE'TOG THEN                                                41508000
         FAIL (0, M'FILECODE'NOT'IN'RANGE)                              41510000
      ELSE                                                              41512000
         FAIL (0, 0);                                                   41514000
      END;                                                              41516000
                                                                        41518000
         <<check security now...>>                                      41520000
                                                                        41522000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41524000
   IF DEBUGGING THEN                                                    41526000
      BEGIN                                                             41528000
      SAY "   CHECK FILE SECURITY NOW" ENDSAY;                          41530000
      SEND;                                                             41532000
      END;                                                              41534000
$IF                           <<DEBUGGING CODE>>                        41536000
                                                                        41538000
   IF FLSECURE AND NOT (CAP'OP LOR CAP'SM) THEN                         41540000
      BEGIN                                                             41542000
      TOS:=ACCCHECK (0, FLACCTNAME, A'SECURITY,                         41544000
                     FLGRPNAME, G'SECURITY, FLUSERID, FLSECMX);         41546000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41548000
      IF DEBUGGING THEN                                                 41550000
         BEGIN                                                          41552000
         ASSEMBLE(DUP);                                                 41554000
         SAY "   ACCCHECK, TOS = " ENDSAY;                              41556000
         SAYOCTAL (TOS);                                                41558000
         SAY ", QP'TYPE = " ENDSAY;                                     41560000
         SAYOCTAL (QP'TYPE);                                            41562000
         SEND;                                                          41564000
         END;                                                           41566000
$IF                           <<DEBUGGING CODE>>                        41568000
      IF NOT TOS.(10:1) THEN           <<READ ACCESS FAILURE>>          41570000
         BEGIN                                                          41572000
         IF NOT QP'TYPE.(9:1) THEN                                      41574000
            BEGIN                                                       41576000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41578000
            IF DEBUGGING THEN                                           41580000
               BEGIN                                                    41582000
               SAY "   QP'TYPE.9:1 = 0 " ENDSAY;                        41584000
               SEND;                                                    41586000
               END;                                                     41588000
$IF                           <<DEBUGGING CODE>>                        41590000
            FAIL (0, M'READ'ACCESS'FAILURE);                            41592000
            END;                                                        41594000
         FAIL (0, M'ACCESS'10'FAILURE);                                 41596000
         END;                                                           41598000
      END;                                                              41600000
                                                                        41602000
         <<See if user is SM or OP...>>                                 41604000
                                                                        41606000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41608000
   IF DEBUGGING THEN                                                    41610000
      BEGIN                                                             41612000
      SAY "   CHECK < FILECODE" ENDSAY;                                 41614000
      SEND;                                                             41616000
      END;                                                              41618000
$IF                           <<DEBUGGING CODE>>                        41620000
                                                                        41622000
   IF NOT SM'TOG THEN                                                   41624000
      BEGIN                   <<not SM or OP>>                          41626000
                                                                        41628000
            <<check filecode, lockword, access...>>                     41630000
                                                                        41632000
      IF FLFILECODE < 0 THEN           <<NEGATIVE FILECODE>>            41634000
         IF NOT IGNORE'PRIV'CHECK'FLAG THEN     <<IGNORE>>              41636000
            IF NOT CAP'PM THEN                                          41638000
               BEGIN                   <<DOESN'T HAVE PRIV MODE>>       41640000
               FAIL (0, M'NEGATIVE'FILECODE);                           41642000
               END;                                                     41644000
                                                                        41646000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41648000
      IF DEBUGGING THEN                                                 41650000
         BEGIN                                                          41652000
         SAY "   CHECK ACCT NAME AND 5.(1:1)=1" ENDSAY;                 41654000
         SEND;                                                          41656000
         END;                                                           41658000
$IF                           <<DEBUGGING CODE>>                        41660000
                                                                        41662000
      IF CAP'AM AND LOGON'ACCT' = FLACCTNAME',(FILE'PART'SIZE) THEN     41664000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41666000
         IF DEBUGGING THEN                                              41668000
            BEGIN                                                       41670000
            SAY "AM...ACCT MATCH"ENDSAY;                                41672000
            SEND;                                                       41674000
            END                                                         41676000
         ELSE                                                           41678000
$IF                           <<DEBUGGING CODE>>                        41680000
                                                                        41682000
      ELSE IF LOOK'LOCK' = FLLOCKWORD',(FILE'PART'SIZE) THEN            41684000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41686000
         IF DEBUGGING THEN                                              41688000
            BEGIN                                                       41690000
            SAY "LOCKWORD MATCH" ENDSAY;                                41692000
            SEND;                                                       41694000
            END                                                         41696000
         ELSE                                                           41698000
$IF                           <<DEBUGGING CODE>>                        41700000
                                                                        41702000
      ELSE IF LOOK'LOCK' = " " THEN        <<NOT SUPPLIED>>             41704000
         BEGIN                         <<prompt user for lockword>>     41706000
                                                                        41708000
            <<we get here only if the file has a lockword               41710000
              and the user supplied none.  (If the file had             41712000
              no lockword, FLLOCKWORD' would be "        ",             41714000
              which is what LOOK'LOCK is at this point.)   >>           41716000
                                                                        41718000
            <<Lock the file so nothing strange will happen              41720000
              to it while we are trying to get its lockword             41722000
              from the user...                             >>           41724000
                                                                        41726000
         LOCK'THE'FILE;                <<may not return to here!>>      41728000
                                                                        41730000
         RELEASE'SIRS (GOT'FISIR, GOT'DSIR);                            41732000
                                                                        41734000
         MOVE MESS':="LOCKWORD: ";                                      41736000
         STANDARD'TO'DISPLAY (CURR'TITLE', MESS'(10), ERROR'CODE,       41738000
                              LEN);                                     41740000
         LEN:=LEN+10;                                                   41742000
         MESS'(LEN):="?";                                               41744000
         LEN:=LEN+1;                                                    41746000
                                                                        41748000
               <<get lockword from user with FREPLY...                  41750000
                 Then set YES to true if we want to fail due            41752000
                 to lockword mismatch...                     >>         41754000
                                                                        41756000
         IF FREPLY (MESS', LEN) = FALSE THEN                            41758000
            YES:=TRUE                                                   41760000
         ELSE IF MESS' = FLLOCKWORD', (FILE'PART'SIZE) THEN             41762000
            YES:=FALSE                                                  41764000
         ELSE                                                           41766000
            YES:=TRUE;                                                  41768000
                                                                        41770000
         GET'SIRS (TRUE, TRUE);    <<get FISIR and DSIR>>               41772000
         NEED'REL'DSIR:=TRUE;             <<release DSIR at end>>       41774000
                                                                        41776000
         IF YES THEN                                                    41778000
            BEGIN             <<bad reply, or mismatched lockword>>     41780000
            FLSTORERESTORE:=0;       <<unlock file>>                    41782000
            IF WRITE'LABEL (LABEL'LDEV, LABEL'ADDRESS,                  41784000
                            GOT'SIR)                                    41786000
                  = FAILED THEN                                         41788000
               FAIL (RC'STOP, M'NOUNLOCK'WRITE'FAILED);                 41790000
            FAIL (0, M'FILE'LOCKWORD'WRONG);                            41792000
            END;                                                        41794000
                                                                        41796000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41798000
         IF DEBUGGING THEN                                              41800000
            BEGIN                                                       41802000
            SAY "LOCK MATCHES" ENDSAY;                                  41804000
            SEND;                                                       41806000
            END;                                                        41808000
$IF                           <<DEBUGGING CODE>>                        41810000
         END                                                            41812000
                                                                        41814000
      ELSE                    <<supplied lockword was wrong>>           41816000
         FAIL (0, M'FILE'LOCKWORD'WRONG);                               41818000
                                                                        41820000
      END;                    <<not SM or OP>>                          41822000
                                                                        41824000
   IF NOT LOCKED'THE'FILE THEN                                          41826000
      BEGIN                                                             41828000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41830000
      IF DEBUGGING THEN                                                 41832000
         BEGIN                                                          41834000
         SAY "   TRY TO LOCK FILE" ENDSAY;                              41836000
         SEND;                                                          41838000
         END;                                                           41840000
$IF                           <<DEBUGGING CODE>>                        41842000
      LOCK'THE'FILE;                                                    41844000
            <<CAN BE STORED if we come back to here!...>>               41846000
      END;                                                              41848000
                                                                        41850000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41852000
   IF DEBUGGING THEN                                                    41854000
      BEGIN                                                             41856000
      SAY "   LOCKED FILE" ENDSAY;                                      41858000
      SEND;                                                             41860000
      END;                                                              41862000
$IF                           <<DEBUGGING CODE>>                        41864000
                                                                        41866000
         <<prepare to store in GOOD file...>>                           41868000
                                                                        41870000
   FILE'NUMBER:=FILE'NUMBER + 1D;                                       41872000
                                                                        41874000
   FILL (GBUF, G'RECSIZE, 0);                                           41876000
                                                                        41878000
   GBUF'D (G'FILENUM'INX'D):=FILE'NUMBER;                               41880000
   GBUF'D (G'ADDRESS'INX'D) := LABEL'ADDRESS;                           41882000
   GBUF'D (G'EXTSIZE'INX'D) := FLEXTSIZE'D;                             41884000
   GBUF'D (G'FILE'SECTORS'INX'D) := FILE'SECTORS;                       41886000
   GBUF (G'LDEV'INX):=LABEL'LDEV;                                       41888000
   GBUF (G'PVINFO'INX) := MOUNTED'VOLUME'INFO;   <<flags & PVINFO>>     41890000
   G'LOCKED'bit:=1;           <<mark it as locked>>                     41892000
                                                                        41894000
   MOVE GBUF'(G'TITLE'INX') := FLAB',(3*FILE'PART'SIZE);                41896000
                                                                        41898000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41900000
   IF DEBUGGING THEN                                                    41902000
      BEGIN                                                             41904000
      SAY "   WRITE TO G'NUM" ENDSAY;                                   41906000
      SEND;                                                             41908000
      END;                                                              41910000
$IF                           <<DEBUGGING CODE>>                        41912000
                                                                        41914000
   FILES'TO'HANDLE:=FILES'TO'HANDLE +1D;                                41916000
                                                                        41918000
   FWRITE (G'NUM, GBUF, G'RECSIZE, 0);                                  41920000
                                                                        41922000
   IF <> THEN                                                           41924000
      BEGIN                                                             41926000
                                                                        41928000
      IF > THEN                                                         41930000
         BEGIN                                                          41932000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41934000
         IF DEBUGGING THEN                                              41936000
            BEGIN                                                       41938000
            SAY "EOF ON GOOD FILE" ENDSAY;                              41940000
            SEND;                                                       41942000
            END;                                                        41944000
$IF                           <<DEBUGGING CODE>>                        41946000
         I:=SR'G'NUM'FULL;                                              41948000
         END                                                            41950000
      ELSE                                                              41952000
         BEGIN                                                          41954000
         FCHECK (G'NUM, I);                                             41956000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        41958000
         IF DEBUGGING THEN                                              41960000
            BEGIN                                                       41962000
            SAY "I/O ERROR ON GOOD FILE, ERR# " ENDSAY;                 41964000
            SAYNUM (I);                                                 41966000
            SEND;                                                       41968000
            END;                                                        41970000
$IF                           <<DEBUGGING CODE>>                        41972000
         I:=SR'G'NUM'ERROR;                                             41974000
         END;                                                           41976000
                                                                        41978000
            <<manually unlock current file...>>                         41980000
                                                                        41982000
      LOCK'UNLOCK'FILE (UNLOCK'FILE,                                    41984000
                        LABEL'LDEV, LABEL'ADDRESS,                      41986000
                        GOT'SIR);                                       41988000
                                                                        41990000
            <<fail ... this will cause all the other files to           41992000
              be unlocked...>>                                          41994000
                                                                        41996000
      FAIL (RC'STOP, I);                                                41998000
      END;                                                              42000000
                                                                        42002000
   MOUNTED'VOLUME'INFO.(1:1) := 0;        <<ONE MOUNT PER GROUP>>       42004000
                                                                        42006000
$PAGE                                                                   42008000
THUNK'STORE'EXIT:                                                       42010000
                                                                        42012000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        42014000
   IF DEBUGGING THEN                                                    42016000
      BEGIN                                                             42018000
      SAY "   EXIT OF THUNK'STORE" ENDSAY;                              42020000
      SEND;                                                             42022000
      END;                                                              42024000
$IF                           <<DEBUGGING CODE>>                        42026000
                                                                        42028000
         <<unlock the file integrity SIR and the directory              42030000
           SIR every 'n' times...>>                                     42032000
                                                                        42034000
   IF (RC'CALLS MOD DTIMU = 0) AND DSIR'INFO = 1 THEN                   42036000
      YES:=TRUE               <<every "n" times, but only when>>        42038000
   ELSE                       <<processing file/group, not acct>>       42040000
      YES:=FALSE;                                                       42042000
                                                                        42044000
   NEED'REL'DSIR := NEED'REL'DSIR LOR YES LOR (NOT GOT'FISIR);          42046000
                                                                        42048000
   RELEASE'SIRS (YES, NEED'REL'DSIR);                                   42050000
                                                                        42052000
   IF NOT GOT'FISIR THEN    <<if true, we also dont have DSIR !!>>      42054000
      GET'SIRS (TRUE, FALSE);   <<get FISIR only>>                      42056000
                                                                        42058000
         <<tell DIRECSCAN whether or not we still have                  42060000
           DSIR locked...>>                                             42062000
                                                                        42064000
   IF GOT'DSIR THEN                                                     42066000
      THUNK'STORE.(15:1) := 1          <<DSIR still locked>>            42068000
   ELSE                                                                 42070000
      THUNK'STORE.(15:1) := 0;         <<DSIR not locked>>              42072000
                                                                        42074000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        42076000
   IF DEBUGGING THEN                                                    42078000
      BEGIN                                                             42080000
      SAY "   END OF THUNK'STORE" ENDSAY;                               42082000
      SEND;                                                             42084000
      END;                                                              42086000
$IF                           <<DEBUGGING CODE>>                        42088000
                                                                        42090000
   END <<THUNK'STORE PROC>>;                                            42092000
$PAGE ";STORE=  CHECK'FOR'DISMOUNT -- DISMOUNT PRIV VOLUME, IF NEED"    50000000
$CONTROL SEGMENT=STORE                                                  50002000
<<*****************************************************************>>   50004000
LOGICAL PROCEDURE CHECK'FOR'DISMOUNT (OLD'PVINFO, CURR'PVINFO,          50006000
                                  OLD'GBUF, ERR'CODE);                  50008000
         VALUE   OLD'PVINFO, CURR'PVINFO;                               50010000
         LOGICAL OLD'PVINFO, CURR'PVINFO;                               50012000
         INTEGER ERR'CODE;                                              50014000
         ARRAY   OLD'GBUF;                                              50016000
         OPTION PRIVILEGED, UNCALLABLE;                                 50018000
                                                                        50020000
      <<Returns GOOD if no error occurs, otherwise FAILED.              50022000
        In the event of an error, ERR'CODE has the error info.>>        50024000
   BEGIN                                                                50026000
                                                                        50028000
   INTEGER                                                              50030000
      HVSIND      := [8/"*", 8/" "],                                    50032000
      REQTYPE     := CONDDISMOUNT'BIND;                                 50034000
                                                                        50036000
   CHECK'FOR'DISMOUNT:=GOOD;  <<OK until failure>>                      50038000
   ERR'CODE:=0;                                                         50040000
                                                                        50042000
   RETURN;                                                              50044000
                                                                        50046000
   IF OLD'PVINFO.(0:1) = 1 THEN        <<last one was mounted>>         50048000
      IF CURR'PVINFO.(0:1) = 0  OR     <<mounted => not mounted>>       50050000
            CURR'PVINFO.(1:1) = 1 THEN <<different mount>>              50052000
         BEGIN                                                          50054000
         DISMOUNT (HVSIND, OLD'GBUF(G'GROUP'INX),                       50056000
                   OLD'GBUF(G'ACCT'INX),                                50058000
                   REQTYPE, OLD'PVINFO);                                50060000
         IF <> THEN                                                     50062000
            BEGIN                                                       50064000
            CHECK'FOR'DISMOUNT:=FAILED;                                 50066000
            ERR'CODE:=REQTYPE;                                          50068000
            END;                                                        50070000
         END;                                                           50072000
                                                                        50074000
   END <<CHECK'FOR'DISMOUNT PROC>>;                                     50076000
$PAGE ";STORE=  DIREC'TO'TAPE --- WRITES DIRECTORY OF FILES TO TAPE"    50078000
$CONTROL SEGMENT=STORE                                                  50080000
<<*****************************************************************>>   50082000
LOGICAL PROCEDURE DIREC'TO'TAPE (TDBUF);                                50084000
                                                                        50086000
      INTEGER ARRAY TDBUF;                                              50088000
      OPTION PRIVILEGED, UNCALLABLE;                                    50090000
                                                                        50092000
   <<Writes the directory to the tape.>>                                50094000
                                                                        50096000
   BEGIN                                                                50098000
                                                                        50100000
                                                                        50102000
   DOUBLE ARRAY                                                         50104000
      GBUF'D      (0:G'RECSIZE/2);                                      50106000
                                                                        50108000
   DOUBLE                                                               50110000
      FILE'KTR    := 0D;                                                50112000
                                                                        50114000
   INTEGER ARRAY                                                        50116000
      GBUF        (*) = GBUF'D (0);                                     50118000
                                                                        50120000
   INTEGER POINTER                                                      50122000
      BP;                                                               50124000
                                                                        50126000
   INTEGER                                                              50128000
      BLKTD,                                                            50130000
      LEN,                                                              50132000
      NLRTD,                                                            50134000
      RECSIZE     := 0;       <<tape recsize (or smaller)>>             50136000
                                                                        50138000
   BYTE ARRAY                                                           50140000
      GBUF'       (*) = GBUF (0);                                       50142000
                                                                        50144000
   DEFINE                                                               50146000
      PVINFO      = GBUF (G'PVINFO'INX) #;                              50148000
                                                                        50150000
   LABEL                                                                50152000
      END'DIREC'TO'TAPE;                                                50154000
                                                                        50156000
   <<-------->>                                                         50158000
   <<  FAIL  >>                                                         50160000
   <<-------->>                                                         50162000
                                                                        50164000
   SUBROUTINE FAIL (N);                                                 50166000
            VALUE   N;                                                  50168000
            INTEGER N;                                                  50170000
      BEGIN                                                             50172000
                                                                        50174000
      IF N <> 0 THEN                                                    50176000
         SENDMESSAGE (N);                                               50178000
                                                                        50180000
      DIREC'TO'TAPE:=FAILED;                                            50182000
                                                                        50184000
      GO END'DIREC'TO'TAPE;                                             50186000
                                                                        50188000
      END <<FAIL SUB>>;                                                 50190000
                                                                        50192000
   <<------------->>                                                    50194000
   <<  FILE'FAIL  >>                                                    50196000
   <<------------->>                                                    50198000
                                                                        50200000
   SUBROUTINE FILE'FAIL (FID, N);                                       50202000
            VALUE   FID, N;                                             50204000
            INTEGER FID, N;                                             50206000
                                                                        50208000
      BEGIN                                                             50210000
                                                                        50212000
      IF FID <> NO'FILE THEN                                            50214000
         PRINT'FILE'ERROR (FID);                                        50216000
                                                                        50218000
      FAIL (N);                                                         50220000
                                                                        50222000
      END <<FILE'FAIL SUB>>;                                            50224000
   <<----------------------------->>                                    50226000
                                                                        50228000
   DIREC'TO'TAPE:=GOOD;       <<default result>>                        50230000
                                                                        50232000
   NEED'DIRECTORY:=FALSE;                                               50234000
                                                                        50236000
   IF (RECSIZE:=TAPE'RECSIZE) > DIREC'MAX'RECSIZE THEN                  50238000
      IF TAPE'DEVINFO.DEVTYPEf = MAGTAPE THEN                           50240000
         RECSIZE:=DIREC'MAX'RECSIZE;                                    50242000
                                                                        50244000
   NLRTD:=RECSIZE/TAPE'DIR'RECSIZE;  <<#dir recors/tape record>>        50246000
   BLKTD:=NLRTD*TAPE'DIR'RECSIZE;  <<make dir block mult of entry size>>50248000
                                                                        50250000
   @BP := @TDBUF;                                                       50252000
                                                                        50254000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        50256000
   IF DEBUGGING THEN                                                    50258000
      BEGIN                                                             50260000
      SEND;                                                             50262000
      SAY "DIREC'TO'TAPE STARTED" ENDSAY;                               50264000
      SEND;                                                             50266000
      END;                                                              50268000
$IF                           <<DEBUGGING CODE>>                        50270000
                                                                        50272000
   REWIND'GOOD'FILE;                                                    50274000
                                                                        50276000
   READ'GOOD'FILE;            <<get first entry>>                       50278000
                                                                        50280000
   WHILE = DO                 <<scan through file...>>                  50282000
      BEGIN                                                             50284000
      FILE'KTR:=FILE'KTR + 1D;                                          50286000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        50288000
      IF DEBUGGING THEN                                                 50290000
         BEGIN                                                          50292000
         SAY "   " ENDSAY;                                              50294000
         SAY GBUF'(G'TITLE'INX'),(FILE'PART'SIZE*3) ENDSAY;             50296000
         SAY "   @BP = %" ENDSAY;                                       50298000
         SAYOCTAL (@BP);                                                50300000
         SEND;                                                          50302000
         END;                                                           50304000
$IF                           <<DEBUGGING CODE>>                        50306000
                                                                        50308000
      MOVE BP:=GBUF(G'TITLE'INX), (3*FILE'PART'WORDS), 2;               50310000
                                                                        50312000
            <<alter group/acct if needed...>>                           50314000
                                                                        50316000
      IF RES'ACCT' <> " " THEN                                          50318000
         MOVE BP(2*FILE'PART'WORDS):=RES'ACCT,(FILE'PART'WORDS);        50320000
                                                                        50322000
      IF RES'GROUP' <> " " THEN                                         50324000
         MOVE BP(FILE'PART'WORDS):=RES'GROUP,(FILE'PART'WORDS);         50326000
                                                                        50328000
      @BP:=TOS;                                                         50330000
                                                                        50332000
      CHECK'BREAK;            <<wont return if break sensed>>           50334000
                                                                        50336000
      IF FILE'KTR MOD DOUBLE(NLRTD) = 0D THEN                           50338000
         BEGIN                <<write dir block to tape...>>            50340000
         FWRITE (T'NUM, TDBUF, BLKTD, 0);                      <<04101>>50342000
         IF <> THEN                                            <<04101>>50344000
            FILE'FAIL  (T'NUM, SR'TAPE'WRITE'FAIL)                      50346000
         ELSE                 <<write succeeded>>                       50348000
            @BP:=@TDBUF;      <<reinitialize buffer>>                   50350000
         END;                                                           50352000
                                                                        50354000
      READ'GOOD'FILE;         <<next file name>>                        50356000
                                                                        50358000
      END;                                                              50360000
                                                                        50362000
         <<READ'GOOD'FILE handled any '<' error!                        50364000
           Therefore, we get here only when we hit                      50366000
           an EOF on G'NUM...>>                                         50368000
                                                                        50370000
   IF (LEN:=@BP-@TDBUF) <> 0 THEN      <<write out last block...>>      50372000
      BEGIN                                                    <<04101>>50373000
      FWRITE (T'NUM, TDBUF, LEN, 0);                           <<04101>>50374000
      IF <> THEN                                               <<04101>>50375000
         FILE'FAIL  (T'NUM, SR'TAPE'WRITE'FAIL);                        50376000
      END;                                                     <<04101>>50377000
                                                                        50378000
   IF WRITE'TAPE'MARK (PARMS'TEMPI'1) = FAILED THEN                     50380000
      FILE'FAIL  (T'NUM, SR'TAPE'WRITE'FAIL);                           50382000
                                                                        50384000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        50386000
   IF DEBUGGING THEN                                                    50388000
      BEGIN                                                             50390000
      SAY "   (EOF ON G'NUM)" ENDSAY;                                   50392000
      SEND;                                                             50394000
      END;                                                              50396000
$IF                           <<DEBUGGING CODE>>                        50398000
                                                                        50400000
         <<we have now written the directory of files to the tape>>     50402000
                                                                        50404000
   REWIND'GOOD'FILE;                                                    50406000
                                                                        50408000
   FPOINT (G'NUM, FILE'NUMBER);                                         50410000
   IF <> THEN                                                           50412000
      FILE'FAIL (G'NUM, SR'G'NUM'ERROR);                                50414000
                                                                        50416000
END'DIREC'TO'TAPE:                                                      50418000
                                                                        50420000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        50422000
   IF DEBUGGING THEN                                                    50424000
      BEGIN                                                             50426000
      SAY "END OF DIREC'TO'TAPE" ENDSAY;                                50428000
      SEND;                                                             50430000
      END;                                                              50432000
$IF                           <<DEBUGGING CODE>>                        50434000
                                                                        50436000
   END <<DIREC'TO'TAPE PROC>>;                                          50438000
$PAGE ";STORE=  FINISH'REEL --- WRITE TRAILER STUFF TO TAPE"            50440000
$CONTROL SEGMENT=STORE                                                  50442000
<<*****************************************************************>>   50444000
LOGICAL PROCEDURE FINISH'REEL (TDBUF, ENDOFFILE);                       50446000
         VALUE   ENDOFFILE;                                             50448000
         LOGICAL ENDOFFILE;                                             50450000
         INTEGER ARRAY TDBUF;                                           50452000
         OPTION PRIVILEGED, UNCALLABLE;                                 50454000
   <<                                                                   50456000
     This routine writes trailer labels and EOF marks                   50458000
     to the end of the current reel.  It assumes that                   50460000
     the tape is positioned where you want it.                          50462000
                                                    >>                  50464000
                                                                        50466000
   BEGIN                                                                50468000
                                                                        50470000
                                                                        50472000
   INTEGER                                                              50474000
      DUMMY'I;                                                          50476000
                                                                        50478000
   LABEL                                                                50480000
      END'FINISH'REEL;                                                  50482000
                                                                        50484000
   <<-------->>                                                         50486000
   <<  FAIL  >>                                                         50488000
   <<-------->>                                                         50490000
                                                                        50492000
   SUBROUTINE FAIL (ERRNUM);                                            50494000
            VALUE   ERRNUM;                                             50496000
            INTEGER ERRNUM;                                             50498000
      BEGIN                                                             50500000
                                                                        50502000
      IF ERRNUM <> 0 THEN                                               50504000
         SENDMESSAGE (ERRNUM);                                          50506000
                                                                        50508000
      ERROR'CODE:=ERRNUM;                                               50510000
                                                                        50512000
      FINISH'REEL:=FAILED;                                              50514000
                                                                        50516000
      GO END'FINISH'REEL;                                               50518000
                                                                        50520000
      END <<FAIL SUB>>;                                                 50522000
   <<-------------------->>                                             50524000
                                                                        50526000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        50528000
   IF DEBUGGING THEN                                                    50530000
      BEGIN                                                             50532000
      SAY "FINISH'REEL called" ENDSAY;                                  50534000
      SAYNUM (ERROR'CODE);                                              50536000
      SEND;                                                             50538000
      END;                                                              50540000
$IF                           <<DEBUGGING CODE>>                        50542000
                                                                        50544000
   FINISH'REEL:=GOOD;                                                   50546000
                                                                        50548000
   IF TAPE'NULL'TOG OR LABELED OR LAST'REEL'FINISHED THEN      <<06361>>50550000
      RETURN;                 <<ok>>                                    50552000
                                                                        50554000
   IF ENDOFFILE THEN                                                    50556000
      BEGIN                                                             50558000
      TL'XFIELD := 1;                                                   50560000
      TAPEMARK'WRITTEN := TRUE;                                <<04996>>50561000
      IF LAST'FILE THEN TL'ZFIELD := 1                                  50562000
      ELSE TL'ZFIELD := 0;                                              50564000
      END                                                               50566000
   ELSE                                                                 50568000
      BEGIN                                                             50570000
      TL'XFIELD := 0;                                                   50572000
      TL'ZFIELD := 0;                                                   50574000
      END;                                                              50576000
                                                                        50578000
   IF WRITE'TAPE(TAPE'LABEL'SIZE, TAPE'LABEL, TRUE, TDBUF, TRUE)        50580000
                                                        = FAILED THEN   50582000
      FAIL (SR'WT'TAPE'LABEL);                                          50584000
                                                                        50586000
$IF X1=ON THEN                                                          50588000
   IF DEBUGGING THEN                                                    50590000
      BEGIN                                                             50592000
      SAY "FINISH'REEL: TL'XFIELD = " ENDSAY;                           50594000
      SAYNUM (TL'XFIELD);                                               50596000
      SAY ";   TL'ZFIELD = " ENDSAY;                                    50598000
      SAYNUM (TL'ZFIELD);                                               50600000
      SEND;                                                             50602000
      END;                                                              50604000
$IF                                                                     50606000
                                                                        50608000
   IF WRITE'TAPE'MARK (DUMMY'I) = FAILED THEN                  <<04102>>50610000
      IF DUMMY'I <> EOTCODE THEN                               <<04102>>50610100
         FAIL (SR'WT'EOF);                                     <<04102>>50611000
                                                                        50612000
   WRITE'TAPE'MARK (PARMS'TEMPI'1);      <<dont check for errors>>      50614000
                                                                        50616000
   << In order to get the unlocking of files during the tape>> <<04724>>50618000
   << rewind, either a rewind'unload or a fclose must be    >> <<04724>>50620000
   << performed before unlock'files is called.  If the tape >> <<04724>>50622000
   << was previously opened (as in SYSDUMP) the rewind will >> <<04724>>50624000
   << not occur until after STORE has been completed.       >> <<04724>>50626000
   << (i.e. the rewind and the unlocking will not overlap.) >> <<04724>>50628000
                                                               <<04724>>50630000
   IF SEEN'TIME THEN       <<TIME>>                                     50630100
      BEGIN                                                             50630200
      SENDMESSAGE (M'TIME'INFO,TRUE);                                   50630300
      SENDMESSAGE (SR'TIM'BEFORE'REWIND);                               50630400
      SENDMESSAGE (M'BLANK'LINE);                                       50630500
      END;                                                              50630600
                                                                        50630700
   IF NOT TL'ZFIELD THEN                                       <<04724>>50632000
      BEGIN                                                    <<04724>>50634000
      IF FKONTROL (T'NUM, REWIND'UNLOAD) = FAILED THEN         <<04102>>50636000
         FAIL (SR'TAPE'REWIND'FAIL);                           <<04102>>50638000
      END                                                      <<04724>>50640000
   ELSE IF T'NUM <> 0 THEN                                     <<04724>>50642000
      BEGIN                                                    <<04724>>50644000
      WRITE'TAPE'MARK (PARMS'TEMPI'1);                         <<04974>>50645000
      FCLOSE (T'NUM, TAPE'CLOSE'DISP, 0);                      <<04724>>50646000
      T'NUM := 0;                                              <<04724>>50648000
      END;                                                     <<04724>>50650000
                                                               <<04724>>50652000
   LAST'REEL'FINISHED := (TL'ZFIELD = 1);                      <<06361>>50652100
                                                               <<06361>>50652200
   IF ENDOFFILE THEN                                                    50654000
      UNLOCK'FILES (FILE'NUMBER, 0)                                     50656000
   ELSE                                                                 50658000
      UNLOCK'FILES (FILE'NUMBER - 1D, 0);                               50660000
                                                                        50662000
END'FINISH'REEL:                                                        50664000
                                                                        50666000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        50668000
   IF DEBUGGING THEN                                                    50670000
      BEGIN                                                             50672000
      SAY "   end FINISH'REEL" ENDSAY;                                  50674000
      SEND;                                                             50676000
      END;                                                              50678000
$IF                           <<DEBUGGING CODE>>                        50680000
                                                                        50682000
   END <<FINISH'REEL PROC>>;                                            50684000
$PAGE ";STORE=  START'REEL --- STARTS A NEW TAPE REEL"                  50686000
$CONTROL SEGMENT=STORE                                                  50688000
<<*****************************************************************>>   50690000
LOGICAL PROCEDURE START'REEL (TDBUF, REEL'NUM);                         50692000
         VALUE   REEL'NUM;                                              50694000
         INTEGER REEL'NUM;                                              50696000
         INTEGER ARRAY TDBUF;                                           50698000
                                                                        50700000
      <<This routine is called to start a normal new reel.>>            50702000
                                                                        50704000
   BEGIN                                                                50706000
                                                                        50708000
   INTEGER ARRAY                                                        50710000
      HOLD'LABEL (0:TAPE'LABEL'SIZE);                                   50712000
                                                                        50714000
   BYTE ARRAY                                                           50716000
      HOLD'LABEL' (*) = HOLD'LABEL;                                     50718000
                                                                        50720000
   DEFINE                                                               50722000
      HOLD'LABEL'DATE' = HOLD'LABEL' (TL'DATE'INX')#;                   50724000
                                                                        50726000
   INTEGER                                                              50728000
      DUMMY'I,                                                          50730000
      READ'LEN;                                                         50732000
                                                                        50734000
   LOGICAL                                                              50736000
      DONE        := FALSE;                                             50738000
                                                                        50740000
   LABEL                                                                50742000
      END'START'REEL;                                                   50744000
                                                                        50746000
   <<--------------------->>                                            50748000
   <<  FAIL               >>                                            50750000
   <<--------------------->>                                            50752000
                                                                        50754000
   SUBROUTINE FAIL (N, SHOULD'TRY'AGAIN);                      <<04101>>50756000
            VALUE N, SHOULD'TRY'AGAIN;                         <<04101>>50758000
            LOGICAL  SHOULD'TRY'AGAIN;                         <<04101>>50759000
            INTEGER N;                                                  50760000
      BEGIN                                                             50762000
                                                                        50764000
      IF N <> 0 THEN                                                    50766000
         SENDMESSAGE (N);                                               50768000
                                                               <<04101>>50768010
      IF SHOULD'TRY'AGAIN AND NOT LABELED THEN                 <<04101>>50768100
         BEGIN                                                 <<04101>>50768200
         MARK'REEL'BAD;                                        <<04101>>50768210
         SENDMESSAGE (SR'RESTART'TAPE);                        <<04101>>50768250
         SENDMESSAGE (SR'MOUNT'DIFFERENT'TAPE,,TRUE);          <<04101>>50768260
         DEL;                                                  <<04101>>50768300
         GOTO TRY'AGAIN;                                       <<04101>>50768400
         END;                                                  <<04101>>50768500
                                                               <<04101>>50768600
      DONT'DO'RECOVERY := TRUE;                                <<04101>>50768700
                                                                        50770000
      START'REEL:=FAILED;                                               50772000
                                                                        50774000
      GO END'START'REEL;                                                50776000
                                                                        50778000
      END <<FAIL SUB>>;                                                 50780000
                                                                        50782000
   <<--------------------->>                                            50784000
   <<  FILE'FAIL          >>                                            50786000
   <<--------------------->>                                            50788000
                                                                        50790000
   SUBROUTINE FILE'FAIL (FID, N, SHOULD'TRY'AGAIN);            <<04101>>50792000
            VALUE FID, N, SHOULD'TRY'AGAIN;                    <<04101>>50793000
            LOGICAL SHOULD'TRY'AGAIN;                          <<04101>>50794000
            INTEGER FID, N;                                             50796000
      BEGIN                                                             50798000
                                                                        50800000
      IF FID <> NO'FILE THEN                                            50802000
         PRINT'FILE'ERROR (FID);                                        50804000
                                                                        50806000
      FAIL (N, SHOULD'TRY'AGAIN);                              <<04101>>50808000
                                                                        50810000
      END <<FILE'FAIL SUB>>;                                            50812000
   <<---------------------->>                                           50814000
$PAGE                                                                   50816000
   <<--------------------->>                                            50818000
   <<  BUILD'HEADER'LABEL >>                                            50820000
   <<--------------------->>                                            50822000
                                                                        50824000
   SUBROUTINE BUILD'HEADER'LABEL;                                       50826000
                                                                        50828000
         <<This routine builds the tape header label>>                  50830000
                                                                        50832000
      BEGIN                                                             50834000
                                                                        50836000
            <<setup tape header label stuff...>>                        50838000
                                                                        50840000
      TL'REELNUM:=REEL'NUM;   <<physical reel count>>                   50842000
      TAPE'REEL:=REEL'NUM;                                              50844000
                                                                        50846000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        50848000
      IF DEBUGGING THEN                                                 50850000
         BEGIN                                                          50852000
         SAY "****** TAPE'REEL := " ENDSAY;                             50854000
         SAYNUM (TAPE'REEL);                                            50856000
         SEND;                                                          50858000
         END;                                                           50860000
$IF                           <<DEBUGGING CODE>>                        50862000
                                                                        50864000
      MOVE TL'IIBID := "VIIB";                                          50866000
                                                                        50868000
      IF REEL'NUM = 1 THEN                                              50870000
         BEGIN                                                          50872000
         TL'SPANTOG:=0;                                                 50874000
         TL'XFIELD:=0;                                                  50876000
         TL'FILEINX:=0;                                                 50878000
         END                                                            50880000
      ELSE                                                              50882000
         BEGIN                                                          50884000
         TL'SPANTOG := (NOT LOGICAL (TL'XFIELD)).(15:1);                50886000
         IF FILE'NUMBER < 1D THEN                                       50888000
            TL'FILEINX:=0                                               50890000
         ELSE                                                           50892000
            TL'FILEINX := LOGICAL(FILE'NUMBER) - 1;                     50894000
         END;                                                           50896000
                                                                        50898000
            <<calculate checksum...>>                                   50900000
                                                                        50902000
      TL'CHKSUM:=0;                                                     50904000
      TL'CHKSUM:=CHECKSUM (TAPE'LABEL, TAPE'LABEL'SIZE);                50906000
                                                                        50908000
      END <<BUILD'HEADER'LABEL SUB>>;                                   50910000
$PAGE                                                                   50912000
   <<----------------->>                                                50914000
   <<  START'LABELED  >>                                                50916000
   <<----------------->>                                                50918000
                                                                        50920000
   SUBROUTINE START'LABELED;                                            50922000
                                                                        50924000
      <<this routine starts the next labeled reel>>                     50926000
                                                                        50928000
      BEGIN                                                             50930000
                                                                        50932000
            <<write the tape label...>>                                 50934000
                                                                        50936000
      FWRITELABEL (T'NUM, TAPE'LABEL, TAPE'LABEL'SIZE);                 50938000
      IF <> THEN                                                        50940000
         FILE'FAIL (T'NUM, SR'WT'TAPE'LABEL, FALSE);           <<04101>>50942000
                                                                        50944000
            <<If this is reel 1, write the directory.  If not, >>       50946000
            <<don't write the directory just yet, as it will   >>       50948000
            <<come AFTER the current file is done!             >>       50950000
                                                                        50952000
      IF REEL'NUM = 1 THEN                                              50954000
         IF DIREC'TO'TAPE (TDBUF) = FAILED THEN                         50956000
            FAIL (SR'WT'DIRECTORY, FALSE)                      <<04101>>50958000
         ELSE                                                           50960000
      ELSE                                                              50962000
         NEED'DIRECTORY:=TRUE;                                          50964000
                                                                        50966000
      END <<START'LABELED SUB>>;                                        50968000
$PAGE                                                                   50970000
   <<------------------->>                                              50972000
   <<  START'UNLABELED  >>                                              50974000
   <<------------------->>                                              50976000
                                                                        50978000
   SUBROUTINE START'UNLABELED;                                          50980000
                                                                        50982000
         <<This routine starts an unlabeled reel:        >>             50984000
         << (1) get the tape, (2) write the header label,>>             50986000
         << (3) write the directory;                     >>             50988000
                                                                        50990000
      BEGIN                                                             50992000
                                                                        50994000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        50996000
      IF DEBUGGING THEN                                                 50998000
         BEGIN                                                          51000000
         SAY "   START'UNLABELED" ENDSAY;                               51002000
         SEND;                                                          51004000
         END;                                                           51006000
$IF                           <<DEBUGGING CODE>>                        51008000
                                                                        51010000
      IF REEL'NUM = 1 THEN                                              51012000
         BEGIN                                                          51014000
         IF NOT SYSDUMPING THEN                                         51016000
            BEGIN                                                       51018000
            IF WRITE'TAPE'MARK (PARMS'TEMPI'1) = FAILED THEN            51020000
               FILE'FAIL (T'NUM, SR'WT'EOF, TRUE);             <<04101>>51022000
            IF WRITE'TAPE'MARK (PARMS'TEMPI'1) = FAILED THEN            51024000
               FILE'FAIL (T'NUM, SR'WT'EOF, TRUE);             <<04101>>51026000
            END;                                                        51028000
         END                                                            51030000
      ELSE                                                              51032000
         BEGIN                                                          51034000
            <<"MOUNT NEXT REEL ON LDEV!">>                              51036000
                                                                        51038000
         PARMS'TEMPI'1 := TAPE'REEL;                                    51040000
         PARMS'TEMPI'2 := TAPE'LDEV;                                    51042000
         SENDMESSAGE (SR'MOUNT'NEXT'REEL,,TRUE);                        51044000
         END;                                                           51046000
                                                                        51048000
                                                                        51050000
         << write the label to the new reel...             >>           51052000
         <<                                                >>           51054000
         << In order to guarantee that the tape is at      >>           51056000
         << load point (for unlabelled tapes!) before      >>           51058000
         << the header is written, a REWIND is issued.     >>           51060000
         << This will:                                     >>           51062000
         <<   1)  leave the tape at load point if already  >>           51064000
         <<       there;                                   >>           51066000
         <<   2)  bring it back to load point if it is     >>           51068000
         <<       past load point;                         >>           51070000
         <<   3)  repeatedly wind the tape off the end if  >>           51072000
         <<       put on line before the load point.       >>           51074000
         << Note that this (kludge) is dependent on the    >>           51076000
         << REWIND'UNLOAD (in particular the UNLOAD)       >>           51078000
         << preceding the rewind.                          >>           51080000
                                                                        51082000
      DONE:=FALSE;                                                      51084000
                                                                        51086000
      WHILE NOT DONE DO                                                 51088000
         BEGIN                                                          51090000
                                                                        51098000
                  <<rewind tape, but don't worry about an >>            51100000
                  <<error, as rewind may have already been>>            51102000
                  <<done for us...                        >>            51104000
                                                                        51106000
         IF REEL'NUM > 1 THEN                                           51108000
            BEGIN                                                       51110000
            IF FKONTROL (T'NUM, REWIND'UNLOAD) = FAILED THEN   <<04102>>51112000
               FILE'FAIL (T'NUM, SR'TAPE'REWIND'FAILED, TRUE); <<04102>>51113000
                                                                        51114000
            READ'LEN := FREAD (T'NUM, HOLD'LABEL, TAPE'LABEL'SIZE+1);   51116000
            IF > THEN                                                   51118000
               READ'LEN := FREAD (T'NUM, HOLD'LABEL, TAPE'LABEL'SIZE+1);51120000
            IF > THEN                                                   51122000
               READ'LEN := FREAD (T'NUM, HOLD'LABEL, TAPE'LABEL'SIZE+1);51124000
                                                                        51126000
            IF = AND (READ'LEN = TAPE'LABEL'SIZE) AND                   51128000
               (HOLD'LABEL' = TAPE'LABEL', (TL'TEXT'LEN')) AND          51130000
               (HOLD'LABEL'DATE' = TL'DATE', (6)) THEN                  51132000
               BEGIN                                                    51134000
               SENDMESSAGE (SR'TAPE'OF'SAME'SET,,TRUE);                 51136000
               SENDMESSAGE (SR'MOUNT'DIFFERENT'TAPE,,TRUE);             51138000
               GOTO TRY'AGAIN;                                          51140000
               END                                                      51142000
            ELSE                                                        51144000
               BEGIN                                                    51146000
                                                                        51146100
               IF SEEN'TIME THEN <<TIME>>                               51146200
                  BEGIN                                                 51146300
                  SENDMESSAGE (M'TIME'INFO,TRUE);                       51146400
                  SENDMESSAGE (SR'TIM'START'OF'TAPE);                   51146500
                  END;                                                  51146600
                                                                        51146700
               IF FKONTROL (T'NUM, REWIND) = FAILED THEN       <<04102>>51148000
                  FILE'FAIL (T'NUM,SR'TAPE'REWIND'FAILED,TRUE);<<04102>>51149000
               END;                                                     51150000
            END;                                                        51152000
                                                                        51154000
         FWRITE (T'NUM, TAPE'LABEL, TAPE'LABEL'SIZE, 0);       <<04101>>51156000
                                                               <<04101>>51158000
         IF <> THEN                                            <<04101>>51160000
            SENDMESSAGE (SR'TAPE'MOUNT'FAIL)                   <<04101>>51216000
         ELSE                                                  <<04101>>51228000
            DONE:=TRUE;                                        <<04101>>51230000
         END;                                                  <<04101>>51232000
                                                                        51234000
                                                                        51236000
            <<got the tape, have written the header                     51238000
              label...now finish "starting" the reel...>>               51240000
                                                                        51242000
      IF REEL'NUM = 1 THEN                                              51244000
         BEGIN                                                          51246000
               <<write the EOF after the header...>>                    51248000
                                                                        51250000
         IF WRITE'TAPE'MARK (DUMMY'I) = FAILED THEN            <<04102>>51252000
            FILE'FAIL (T'NUM, SR'TAPE'WRITE'FAIL, TRUE);       <<04102>>51256000
         END;                                                           51258000
                                                                        51260000
            <<write the directory..>>                                   51262000
                                                                        51264000
      IF DIREC'TO'TAPE (TDBUF)                                          51266000
            = FAILED THEN                                               51268000
         FAIL (SR'WT'DIRECTORY, TRUE);                         <<04101>>51270000
                                                                        51270100
      IF SEEN'TIME THEN          <<TIME>>                               51270200
         BEGIN                                                          51270300
         SENDMESSAGE (M'TIME'INFO,TRUE);                                51270310
         SENDMESSAGE (SR'TIM'AFTER'DIRECTORY);                          51270400
         END;                                                           51270600
                                                                        51272000
      END <<START'UNLABELED SUB>>;                                      51274000
   <<---------------------->>                                           51276000
$PAGE                                                                   51278000
                                                                        51280000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        51282000
   IF DEBUGGING THEN                                                    51284000
      BEGIN                                                             51286000
      SEND;                                                             51288000
      FILL' (POUT, 70, "-");                                            51290000
      @POUT:=@POUT(70);                                                 51292000
      SEND;                                                             51294000
      SAY "START'REEL (@" ENDSAY;                                       51296000
      SAY ", @" ENDSAY;                                                 51298000
      SAYOCTAL (@TDBUF);                                                51300000
      SAY ", " ENDSAY;                                                  51302000
      SAYNUM (REEL'NUM);                                                51304000
      SAY1 (")");                                                       51306000
      SEND;                                                             51308000
      END;                                                              51310000
$IF                           <<DEBUGGING CODE>>                        51312000
                                                                        51314000
TRY'AGAIN:                                                     <<04101>>51314100
                                                               <<04101>>51315000
   IF TAPE'NULL'TOG OR LAST'REEL'FINISHED THEN                 <<06361>>51316000
      BEGIN                                                             51318000
      START'REEL:=GOOD;                                                 51320000
      RETURN;                                                           51322000
      END;                                                              51324000
                                                                        51326000
   IF TAPE'LDEV = 0 THEN                                                51328000
      BEGIN                                                             51330000
      FFILEINFO (T'NUM, ITEM'LDEV, TAPE'LDEV);                          51332000
      IF <> THEN                                                        51334000
         FAIL (SR'TAPE'FGETINFO'FAIL, FALSE);                  <<04101>>51336000
      END;                                                              51338000
                                                               <<04101>>51338100
   IF REQUESTSERVICE THEN                                      <<04101>>51338200
      FAIL (SR'BREAK'SENSED, FALSE);                           <<04101>>51338300
                                                               <<04101>>51338400
                                                                        51340000
   BUILD'HEADER'LABEL;                                                  51342000
                                                                        51344000
   IF LABELED THEN                                                      51346000
      START'LABELED                                                     51348000
   ELSE                                                                 51350000
      START'UNLABELED;                                                  51352000
                                                                        51354000
   START'REEL:=GOOD;                                                    51356000
                                                                        51358000
END'START'REEL:                                                         51360000
                                                                        51362000
   END <<START'REEL PROC>>;                                             51364000
$PAGE ";STORE=  WRITE'TAPE --- WRITE A RECORD TO TAPE"                  51366000
$CONTROL SEGMENT=STORE                                                  51368000
<<*****************************************************************>>   51370000
LOGICAL PROCEDURE WRITE'TAPE (WORDC, BUFFER, IGNORE'EOT, TDBUF,         51372000
                              LAST'WRITE'OF'FILE );                     51374000
         VALUE   WORDC, IGNORE'EOT, LAST'WRITE'OF'FILE;                 51376000
         INTEGER WORDC;                                                 51378000
         LOGICAL        IGNORE'EOT, LAST'WRITE'OF'FILE;                 51380000
         INTEGER ARRAY BUFFER, TDBUF;                                   51382000
         OPTION PRIVILEGED, UNCALLABLE;                                 51384000
   <<                                                                   51386000
     WRITE'TAPE returns:    GOOD   -- OK                                51388000
                           FAILED -- ERROR -  DIE                       51390000
         If WRITE'TAPE fails, the reason is returned in                 51392000
         ERROR'CODE.  The possible reasons are documented               51394000
         in the global equate section.                                  51396000
                                                                        51398000
     Parameters:                                                        51400000
         WORDC  -- number of words in array BUFFER to write to the      51402000
                   tape.                                                51404000
                   WORDC is NEVER 0 or less!  If you want to write      51406000
                   a tapemark, use WRITE'TAPE'MARK!                     51408000
                   (No check is made for this case!)                    51410000
         BUFFER -- integer array with data to be written.               51412000
         IGNOREEOT --                                                   51414000
         TDBUF  -- the usual tape buffer, passed to avoid allocating    51416000
                   a lot of space within DIREC'TO'TAPE.         >>      51418000
      <<-------------------------------------------------------->>      51420000
   BEGIN                                                                51422000
                                                                        51424000
                                                                        51426000
   INTEGER                                                              51428000
      DUMMY'I;                                                          51430000
                                                                        51432000
   LABEL                                                                51434000
      END'WRITE'TAPE;                                                   51436000
                                                                        51438000
   <<-------->>                                                         51440000
   <<  FAIL  >>                                                         51442000
   <<-------->>                                                         51444000
                                                                        51446000
   SUBROUTINE FAIL (ERRNUM);                                            51448000
            VALUE   ERRNUM;                                             51450000
            INTEGER ERRNUM;                                             51452000
      BEGIN                                                             51454000
                                                                        51456000
      IF ERRNUM <> 0 THEN                                               51458000
         SENDMESSAGE (ERRNUM);                                          51460000
                                                                        51462000
      ERROR'CODE:=ERRNUM;                                               51464000
                                                                        51466000
      WRITE'TAPE:=FAILED;                                               51468000
                                                                        51470000
      GO END'WRITE'TAPE;                                                51472000
                                                                        51474000
      END <<FAIL SUB>>;                                                 51476000
                                                                        51478000
   <<------------->>                                                    51480000
   <<  GOOD'EXIT  >>                                                    51482000
   <<------------->>                                                    51484000
                                                                        51486000
   SUBROUTINE GOOD'EXIT;                                                51488000
                                                                        51490000
      BEGIN                                                             51492000
                                                                        51494000
      WRITE'TAPE:=GOOD;                                                 51496000
                                                                        51498000
      ERROR'CODE:=0;                                                    51500000
                                                                        51502000
      GO END'WRITE'TAPE;                                                51504000
                                                                        51506000
      END <<GOOD'EXIT SUB>>;                                            51508000
   <<-------------------->>                                             51510000
$PAGE                                                                   51512000
   <<----------------->>                                                51514000
   <<  WRITE'LABELED  >>                                                51516000
   <<----------------->>                                                51518000
                                                                        51520000
   SUBROUTINE WRITE'LABELED;                                            51522000
                                                                        51524000
         <<writes to a labelled tape>>                                  51526000
                                                                        51528000
      BEGIN                                                             51530000
                                                                        51532000
      ERROR'CODE:=0;                                                    51534000
                                                                        51536000
      FWRITE (T'NUM, BUFFER, WORDC, 0);                                 51538000
                                                                        51540000
      IF <> THEN                                                        51542000
         FAIL (SR'WT'LABEL'TAPE);                                       51544000
                                                                        51546000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        51548000
      IF DEBUG'WRITE'TAPE AND FALSE THEN                                51550000
         BEGIN                                                          51552000
         SAY "FWRITE worked ok, about to call LRELSW, ldev = " ENDSAY;  51554000
         SAYNUM (TAPE'LDEV);                                            51556000
         SEND;                                                          51558000
         DEBUG;                                                         51560000
         END;                                                           51562000
$IF                           <<DEBUGGING CODE>>                        51564000
                                                                        51566000
      DISABLE'ARITHMETIC'TRAPS;                                         51568000
                                                                        51570000
      IF LRELSW (T'NUM) THEN           <<check&reset reel switch...>>   51572000
         BEGIN                         <<switched reels>>               51574000
         TAPE'LDEV:=0;                 <<force us to get new ldev>>     51576000
         IF START'REEL (TDBUF, TAPE'REEL+1)                             51578000
               = FAILED THEN                                            51580000
            FAIL (SR'WT'LABEL'TAPE);                                    51582000
         END;                                                           51584000
                                                                        51586000
      ENABLE'ARITHMETIC'TRAPS;                                          51588000
                                                                        51590000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        51592000
      IF DEBUG'WRITE'TAPE AND FALSE THEN                                51594000
         BEGIN                                                          51596000
         SAY "   LRELSW RETURNED OK" ENDSAY;                            51598000
         SEND;                                                          51600000
         END;                                                           51602000
$IF                           <<DEBUGGING CODE>>                        51604000
                                                                        51606000
      GOOD'EXIT;                                                        51608000
                                                                        51610000
      END <<WRITE'LABELED SUB>>;                                        51612000
$PAGE                                                                   51614000
   <<------------------->>                                              51616000
   <<  WRITE'UNLABELED  >>                                              51618000
   <<------------------->>                                              51620000
                                                                        51622000
   SUBROUTINE WRITE'UNLABELED;                                          51624000
                                                                        51626000
         <<writes to an unlabelled tape>>                               51628000
                                                                        51630000
      BEGIN                                                             51632000
                                                                        51634000
      ERROR'CODE:=0;                                                    51636000
                                                                        51638000
            <<At this point, we want to do a non-null write             51640000
              to an unlabelled tape!                        >>          51642000
                                                                        51644000
      FWRITE (T'NUM, BUFFER, WORDC, 0);                                 51646000
                                                                        51648000
      IF = THEN                                                         51650000
         GOOD'EXIT;                                                     51652000
                                                                        51654000
            <<maybe we got an EOT...>>                                  51656000
                                                                        51658000
      FCHECK (T'NUM, ERROR'CODE);         <<get details about error>>   51660000
                                                                        51662000
      IF ERROR'CODE = SOFTWARE'ABORT THEN                               51664000
         OPERATOR'ABORT:=TRUE;                                          51666000
                                                                        51668000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        51670000
      IF DEBUGGING THEN                                                 51672000
         BEGIN                                                          51674000
         SAY "   Error in WRITE'UNLABELED, FCHECK = " ENDSAY;           51676000
         SAYNUM (ERROR'CODE);                                           51678000
         SEND;                                                          51680000
         END;                                                           51682000
$IF                           <<DEBUGGING CODE>>                        51684000
                                                               <<04996>>51684100
      IF ERROR'CODE = 0 THEN                                   <<04996>>51684200
         GOOD'EXIT;                                            <<04996>>51684300
                                                                        51686000
      IF ERROR'CODE.(08:08) <> EOTCODE THEN                             51688000
         FAIL (SR'WT'WRITE3);           << '<' writing>>                51690000
                                                                        51692000
      IF IGNORE'EOT THEN                                                51694000
         GOOD'EXIT;                                                     51696000
                                                                        51698000
      IF WRITE'TAPE'MARK (PARMS'TEMPI'1) THEN                           51700000
         IF PARMS'TEMPI'1 <> EOTCODE THEN                               51702000
            FAIL (SR'WT'EOF);                                           51704000
                                                                        51706000
      IF FINISH'REEL (TDBUF, LAST'WRITE'OF'FILE) = FAILED THEN          51708000
         FAIL (SR'WT'TAPE'LABEL);                                       51710000
                                                                        51712000
      IF TL'ZFIELD=1 THEN                                               51714000
         GOOD'EXIT;                                                     51716000
                                                                        51718000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        51720000
      IF DEBUGGING THEN                                                 51722000
         BEGIN                                                          51724000
         SEND;                                                          51726000
         FILL' (POUT, 70, "-");                                         51728000
         @POUT:=@POUT(70);                                              51730000
         SEND;                                                          51732000
         SAY "Get next reel" ENDSAY;                                    51734000
         SEND;                                                          51736000
         FILL' (POUT, 70, "-");                                         51738000
         @POUT:=@POUT(70);                                              51740000
         SEND;                                                          51742000
         SEND;                                                          51744000
         END;                                                           51746000
$IF                           <<DEBUGGING CODE>>                        51748000
                                                                        51750000
      IF START'REEL (TDBUF, TAPE'REEL+1) = FAILED THEN                  51752000
         FAIL (SR'UNABLE'TO'START'REEL);                                51754000
                                                                        51756000
      GOOD'EXIT;                                                        51758000
                                                                        51760000
      END <<WRITE'UNLABELED SUB>>;                                      51762000
   <<------------------------->>                                        51764000
$PAGE                                                                   51766000
                                                                        51768000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        51770000
   IF DEBUGGING THEN                                                    51772000
      BEGIN                                                             51774000
      SAY "   WRITE'TAPE (" ENDSAY;                                     51776000
      SAYNUM (WORDC);                                                   51778000
      SAY ", @B/@T = " ENDSAY;                                          51780000
      SAYOCTAL (@BUFFER);                                               51782000
      SAY1 ("/");                                                       51784000
      SAYOCTAL (@TDBUF);                                                51786000
      SAY ", IGNEOT = " ENDSAY;                                         51788000
      SAYNUM (IGNORE'EOT);                                              51790000
      SAY1 (")");                                                       51792000
      SAY " (TAPE'REEL=" ENDSAY;                                        51794000
      SAYNUM (TAPE'REEL);                                               51796000
      SAY1 (")");                                                       51798000
      SEND;                                                             51800000
      END;                                                              51802000
$IF                           <<DEBUGGING CODE>>                        51804000
                                                                        51806000
   WRITE'TAPE:=GOOD;                                                    51808000
                                                                        51810000
   IF TAPE'NULL'TOG THEN                                                51812000
      GOOD'EXIT;                                                        51814000
                                                                        51816000
         <<write to the tape...>>                                       51818000
                                                                        51820000
   IF LABELED THEN                                                      51822000
      WRITE'LABELED                                                     51824000
                                                                        51826000
   ELSE                                                                 51828000
      WRITE'UNLABELED;                                                  51830000
                                                                        51832000
END'WRITE'TAPE:                                                         51834000
                                                                        51836000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        51838000
   IF DEBUGGING THEN                                                    51840000
      BEGIN                                                             51842000
      SAY "   end of WRITE'TAPE" ENDSAY;                                51844000
      SEND;                                                             51846000
      END;                                                              51848000
$IF                           <<DEBUGGING CODE>>                        51850000
                                                                        51852000
   END <<WRITE'TAPE PROC>>;                                             51854000
$PAGE ";STORE=  WRITE'TAPE'MARK -- WRITES AN EOF TO THE TAPE"           51856000
$CONTROL SEGMENT=STORE                                                  51858000
<<*****************************************************************>>   51860000
LOGICAL PROCEDURE WRITE'TAPE'MARK (ERRNUM);                             51862000
   INTEGER ERRNUM;                                                      51864000
      <<This routine writes an EOF to the tape, returning               51866000
        GOOD or FAILED.  If an error does occur, the error code         51868000
        is returned (from FCHECK) in the ERROR'CODE slot of PARMS.>>    51870000
                                                                        51872000
   BEGIN                                                                51874000
                                                                        51876000
                                                                        51878000
   INTEGER                                                              51880000
      DUMMY'I;                                                          51882000
                                                                        51884000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        51886000
   IF DEBUGGING THEN                                                    51888000
      BEGIN                                                             51890000
      SAY "WRITE'TAPE'MARK" ENDSAY;                                     51892000
      SEND;                                                             51894000
      END;                                                              51896000
$IF                           <<DEBUGGING CODE>>                        51898000
                                                                        51900000
   WRITE'TAPE'MARK:=GOOD;                                               51902000
   ERROR'CODE:=0;                                                       51904000
                                                                        51906000
   IF LABELED THEN                                                      51908000
      BEGIN                                                             51910000
      IF NEXTTAPEFILE (T'NUM) = 0 THEN                                  51912000
         RETURN;              <<good>>                                  51914000
      END                                                               51916000
   ELSE                                                                 51918000
      BEGIN                   <<unlabelled tape...>>                    51920000
      IF FKONTROL (T'NUM, WEOF) = GOOD THEN                    <<04102>>51922000
         RETURN;              <<good>>                         <<04102>>51926000
      END;                                                              51928000
                                                                        51930000
         <<an error occurred...get the error code and                   51932000
           "report" the error...                      >>                51934000
                                                                        51936000
   FCHECK (T'NUM, ERROR'CODE);                                          51938000
   IF ERROR'CODE = SOFTWARE'ABORT THEN                                  51940000
      OPERATOR'ABORT:=TRUE;                                             51942000
                                                                        51944000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        51946000
   IF DEBUGGING THEN                                                    51948000
      BEGIN                                                             51950000
      SAY "   WRITE'TAPE'MARK = failed, err # " ENDSAY;                 51952000
      SAYNUM (ERROR'CODE);                                              51954000
      SEND;                                                             51956000
      END;                                                              51958000
$IF                           <<DEBUGGING CODE>>                        51960000
                                                                        51962000
   WRITE'TAPE'MARK:=FAILED;                                             51964000
   ERRNUM := ERROR'CODE;                                                51966000
                                                                        51968000
   END <<WRITE'TAPE'MARK PROC>>;                                        51970000
$PAGE ";STORE=  MARK'REEL'BAD -- MAKES A REEL BAD"             <<04101>>51970010
   <<----------------->>                                       <<04101>>51970020
   <<  MARK'REEL'BAD  >>                                       <<04101>>51970030
   <<----------------->>                                       <<04101>>51970040
                                                               <<04101>>51970050
PROCEDURE MARK'REEL'BAD;                                       <<04101>>51970060
                                                               <<04101>>51970070
      <<This routine rewinds the current reel and writes       <<04101>>51970080
      <<a record to the start of the tape which "marks"        <<04101>>51970090
      <<the tape as a "bad" tape, so a later RESTORE will      <<04101>>51970100
      <<not try to restore from it.                      >>    <<04101>>51970110
                                                               <<04101>>51970120
   BEGIN                                                       <<04101>>51970130
                                                               <<04101>>51970140
   INTEGER                                                     <<04101>>51970141
      DUMMY'I     := 0;                                        <<04101>>51970142
                                                               <<04101>>51970143
   LOGICAL ARRAY                                               <<04101>>51970144
      SCRATCH    (0:20);                                       <<04101>>51970145
                                                               <<04101>>51970146
   BYTE ARRAY                                                  <<04101>>51970147
      SCRATCH'   (*)     = SCRATCH;                            <<04101>>51970148
                                                               <<04101>>51970149
   FKONTROL (T'NUM, REWIND);                                   <<04101>>51970150
                                                               <<04101>>51970160
         <<don't check the FCONTROL to see if it worked.>>     <<04101>>51970170
         <<also, write two tape marks at start of tape, but>>  <<04101>>51970180
         <<don't check them either...>>                        <<04101>>51970190
                                                               <<04101>>51970200
   WRITE'TAPE'MARK (PARMS'TEMPI'1);                            <<04101>>51970210
   WRITE'TAPE'MARK (PARMS'TEMPI'1);                            <<04101>>51970220
                                                               <<04101>>51970230
   MOVE SCRATCH':="BAD TAPE";                                  <<04101>>51970240
                                                               <<04101>>51970250
   FWRITE (T'NUM, SCRATCH, 4, 0);                              <<04101>>51970260
                                                               <<04101>>51970270
   FKONTROL (T'NUM, REWIND'UNLOAD);                            <<04101>>51970280
                                                               <<04101>>51970290
   PARMS'TEMPI'1 := TAPE'LDEV;                                 <<04101>>51970300
   SENDMESSAGE (SR'BAD'TAPE,,TRUE);                            <<04101>>51970310
   SENDMESSAGE (SR'TAKE'IT'OFF,,TRUE);                         <<04101>>51970320
   SENDMESSAGE (SR'NOT'PART'OF'TAPE'SET,,TRUE);                <<04101>>51970330
                                                               <<04101>>51970340
   END <<MARK'REEL'BAD SUB>>;                                  <<04101>>51970350
$PAGE ";STORE=  FSTORE --- WRITE FILES TO TAPE"                         51972000
$CONTROL SEGMENT=STORE                                                  51974000
<<*****************************************************************>>   51976000
LOGICAL PROCEDURE FSTORE (TDBUF);                                       51978000
      INTEGER ARRAY TDBUF;                                              51980000
      OPTION PRIVILEGED, UNCALLABLE;                                    51982000
                                                                        51984000
<<----------------------------------------------------------------->>   51986000
<<                                                                      51988000
                                                                        51990000
   The function of FSTORE is to store onto tape T'NUM all of the        51992000
   files named in G'NUM.  All such files are probably locked down       51994000
   for exclusive use (by RCSTORE).  As each file is stored, FSTORE      51996000
   will unlock it (iff it thinks the earlier RCSTORE locked it).        51998000
   (The "probably" is due to a non-supported debugging feature,         52000000
   invoked by doing a: STORE ...;LOCK=NONE, which will not              52002000
   lock any files!)                                                     52004000
                                                                        52006000
   FSTORE tries to catch and  correct most errors itself,               52008000
   depending on the setting of ON'ERR.  (If it = ONERR'QUIT,            52010000
   no error recovery is done;  if it = ONERR'REDO, error                52012000
   recovery will probably be done...see RECOVER'ERROR                   52014000
   subroutine for the criteria.)  If the error cannot be                52016000
   corrected, a FAILED result is returned, otherwise a GOOD.            52018000
                                                                        52020000
   Note that there are ONLY two exits from this routine:                52022000
                                                                        52024000
         1) normal termination (i.e: all files stored)                  52026000
            (some may be only partially stored...if a                   52028000
            disc error ocurred while reading a file)                    52030000
                                                                        52032000
         2) fatal error ... exit through the FAIL subroutine.           52034000
                                                                        52036000
                                                                  >>    52038000
<<----------------------------------------------------------------->>   52040000
<<                                                                      52042000
   Interpretation of fields in library tape trailer labels:             52044000
                                                                        52046000
      TL'ZFIELD = 1,                                                    52048000
            TL'XFIELD = undefined...                                    52050000
                  The EOF which preceded this trailer label             52052000
                  label represents the true EOF for this file.          52054000
                  It also denotes that this is the last physical        52056000
                  reel of the library tape set.                         52058000
                                                                        52060000
      TL'ZFIELD = 0,                                                    52062000
            TL'XFIELD = 0...                                            52064000
                  This means that the data for the current file is      52066000
                  continued on the next reel.                           52068000
            TL'XFIELD = 1...                                            52070000
                  This means that the EOF which precedes this           52072000
                  trailer label represents the true EOF for this        52074000
                  file.  The next reel begins with a new file.          52076000
                                                                  >>    52078000
<<---------------------------------------------------------------->>    52080000
<<   NOTE:  The header and trailer label formats written by STORE >>    52082000
<<          do not conform to any HP standards as such.  These    >>    52084000
<<          headers do not make the tape look "labelled" to MPE!  >>    52086000
<<---------------------------------------------------------------->>    52088000
                                                                        52090000
$PAGE                                                                   52092000
   BEGIN                                                                52094000
                                                                        52096000
         <<NOTE: The next variables must be the first local             52098000
           variables declared in this procedure...>>                    52100000
   INTEGER POINTER                                                      52108000
      SAVE'LOCALS;                                                      52110000
                                                                        52112000
   INTEGER                                                              52114000
      LOCALS'LEN  := 0,       <<length of locals storage>>              52116000
      FIRST'LOCAL;            <<dummy integer>>                         52118000
                                                                        52120000
      <<-----------------------------------------------------           52122000
      << To recover from tape errors during a STORE, we do the          52124000
         following:                                                     52126000
                                                                        52128000
            1) After each reel switch, we save the "state of the        52130000
               universe" by calling SAVE'STATE.  This routine           52132000
               copies all of this procedure's local variables           52134000
               (both simple variables and arrays), and some             52136000
               selected global variables (TAPE'LABEL, GOOD'FILE'COUNT,  52138000
               FAILED'FILE'COUNT) into a holding area (discussed        52140000
               below).  This state saving is done after the directory   52142000
               is written to the newly mounted reel, but before         52144000
               a single data record from a to-be-stored file            52146000
               is written to it.                                        52148000
                                                                        52150000
            2) If a tape error occurs, we apply the following           52152000
               criteria to see if error recovery should be done:        52154000
                                                                        52156000
               a) is error recovery enabled (ONERR=REDO)?               52158000
                  If not, terminate with error.                         52160000
                                                                        52162000
               b) is the error a tape write error?                      52164000
                  If not, terminate with error.                         52166000
                                                                        52168000
               c) is the reel the first reel of a SYSDUMP?              52170000
                  If it is, terminate with error. (We cannot            52172000
                  recreate the first reel of a SYSDUMP.)                52174000
                                                                        52176000
            3) If a "correctable" error occurred, we do the             52178000
               following:                                               52180000
                                                                        52182000
               a) if the file currently being stored is on              52184000
                  a private volume, dismount the volume.                52186000
                                                                        52188000
               b) restore the local variables to the state              52190000
                  they were in at the time we started this              52192000
                  reel, as saved by SAVE'STATE.                         52194000
                                                                        52196000
               c) restore the selected global variables to              52198000
                  the state they were in at the time we                 52200000
                  started this reel.                                    52202000
                                                                        52204000
               d) get (i.e: ask operator for) next reel,                52206000
                  write STORE label and file directory to               52208000
                  it.                                                   52210000
                                                                        52212000
               ....error is now corrected, and the caller of            52214000
               RECOVER'ERROR continues on, fooled into thinking         52216000
               that it is now where it had been when the bad            52218000
               reel was first started.                                  52220000
                                                                        52222000
         ------------------------------------------------               52224000
                                                                        52226000
         How we "save the state":                                       52228000
                                                                        52230000
            We declare the 3 variables: SAVE'LOCALS,                    52232000
            SAVE'TAPE'LABEL, and FIRST'LOCAL as the first               52234000
            three variables in the procedure.  Then, as the             52236000
            first executable code we determine the number               52238000
            of words between FIRST'LOCAL and the top of stack.          52240000
            Since this computation occurs after the stack               52242000
            building code emitted by SPL, it is guaranteed to           52244000
            reflect the storage of all simple variables, direct         52246000
            arrays, and indirect arrays of the procedure.               52248000
                                                                        52250000
            Once we know how much storage the locals take (this         52252000
            value is stored in LOCALS'LEN), we allocate on              52254000
            the stack a buffer of that size, saving its address         52256000
            in @SAVE'LOCALS.  We then allocate another buffer           52258000
            on the stack whose size is TAPE'LABEL'SIZE, saving          52260000
            its address in @SAVE'TAPE'LABEL.                            52262000
                                                                        52264000
            These two integer pointers (SAVE'TAPE'LABEL and             52266000
            SAVE'LOCALS) are used by SAVE'STATE to save the             52268000
            state with two simple move statements.                      52270000
                                                                        52272000
         ------------------------------------------------>>             52274000
$PAGE                                                                   52276000
                                                                        52278000
                                                                        52280000
   DOUBLE ARRAY                                                         52282000
      DISJ'EXT'LEN (0:31),                                              52284000
      DISJ'EXT'ADDR (0:31),                                             52286000
      EXTMAP'D    (0:31),                                               52288000
      FIRST'FILE'INFO'D (0:4),                                          52290000
      GBUF'D      (0:G'RECSIZE/2),                                      52292000
      IO'QUEUE'D  (0:MAX'NUM'XDS    *MAX'IO),                           52294000
      IO'WTM'D    (0:MAX'NUM'XDS    -1);                                52296000
                                                                        52298000
   DOUBLE                                                               52300000
      FIRST'FILE'ON'REEL := 1D,                                         52302000
      EXTENT'SECTORS'LEFT:= 0D,                                         52304000
      FAILED'COUNT      := 0D, <<used to set FAILED'FILE'COUNT later>>  52306000
      FILE'SECTORS'LEFT := 0D, <<#sectors left in remaining extents>>   52308000
      GOOD'COUNT        := 0D, <<used to set GOOD'FILE'COUNT later>>    52310000
      IOB               := 0D,                                          52312000
      LOCAL'FILE'ADDRESS:= 0D,                                 <<04104>>52313000
      LOCAL'FILE'NUMBER := 1D,                                          52314000
      SECTOR'ADDRESS    := 0D,                                          52316000
      SECTORS'FILLED    := 0D,                                          52318000
      SECTORS'PER'TAPE'RECORD := 0D,                                    52320000
      SECTORS'THIS'READ := 0D;                                          52322000
                                                                        52324000
   INTEGER ARRAY                                                        52326000
      BUFFER'STATUS     (0:MAX'NUM'XDS    -1),                          52328000
      BUFFER'XDS        (0:MAX'NUM'XDS    -1),                          52330000
      FIRST'IO'INX      (0:MAX'NUM'XDS    -1),                          52332000
      GBUF              (*) = GBUF'D (0),                               52334000
      IO'LEN            (0:MAX'NUM'XDS    *MAX'IO),                     52336000
      IO'QUEUE          (*) = IO'QUEUE'D (0),                           52338000
      IO'WTM            (*) = IO'WTM'D,                                 52340000
      LAST'IO'INX       (0:MAX'NUM'XDS    -1),                          52342000
      LOCAL'FLAB        (0:FILE'LABEL'SIZE -1),                <<04104>>52343000
      LOCAL'TAPE'LABEL  (0:TAPE'LABEL'SIZE -1),                <<04104>>52343100
      OLD'GBUF          (0:G'RECSIZE-1),                                52344000
      SCRATCH           (0:15);                                         52346000
                                                                        52348000
   INTEGER POINTER                                                      52350000
      FIRST'LOCAL'ARRAY;                                                52352000
                                                               <<04104>>52352100
   BYTE ARRAY                                                  <<04104>>52352200
      LOCAL'TITLE'      (0:MAX'STD'LEN);                       <<04104>>52352300
                                                                        52354000
   INTEGER                                                              52356000
      ATTIO'STATUS= IOB + 0,                                            52358000
      CUR'INX     := 0,       <<cur buf# ... 0..NUM'XDS    -1>>         52360000
      CUR'XDS     := 0,       <<  =  BUFFER'XDS(CUR'INX)  >>            52362000
      DUMMY'I,                                                          52364000
      DISJ'EXTENT'NUM  := 0,                                            52366000
      FIRST'REEL  := 0,       <<reel # a file started on>>              52368000
      I           := 0,       <<scratch variable>>                      52370000
      IO'INX      := 0,       <<index thru IO'QUEUE'D>>                 52372000
      IOB'1       = IOB + 0,                                            52374000
      IOB'2       = IOB + 1,                                            52376000
      LEN         := 0,                                                 52378000
      LOCAL'FILE'LDEV  := 0,                                   <<04104>>52379000
      NUM'DISJOINT'EXTENTS := 0,                                        52380000
      NUM'IO      := 0,       <<number of pending IOs>>                 52382000
      OFFSET      := 0,       <<Offset into an XDS>>                    52384000
      PVINFO      := 0,                                                 52386000
      RECOVER'LABEL:=0,                                                 52388000
      S0          = S - 0,    <<used by RECOVER'ERROR>>                 52390000
      SAVE'REEL   := 0,       <<used to detect reel switch>>            52392000
      STATE       := 0,       <<STORE'A'FILE internal state>>           52394000
      WORDS'LEFT  := 0,       <<used by START'IO>>                      52396000
      X           := 0,       <<used by FLAB'CHECKSUM>>                 52398000
      XDS'SECTORS := 0,       <<# of sectors in an XDS>>                52400000
      XDS'SIZE    := 0,       <<size XDS to ask for>>                   52402000
      Z'SIZE      := 0;       <<for EXPAND'STACK>>                      52404000
                                                                        52406000
   LOGICAL                                                              52408000
      FIRST'RECORD'OF'FILE := FALSE,                                    52410000
      FIRST'TIME'IN:=TRUE,    <<first time in STORE'A'FILE>>            52412000
      GOOD'STORE  := FALSE,                                             52414000
      L           := 0,       <<scratch logical>>                       52416000
      LDEV        := 0,                                                 52418000
      LL          := 0,       <<scratch logical>>                       52420000
      LOCAL'TAPEMARK'WRITTEN,                                  <<04101>>52421000
      SECTOR'ADDRESS1 = SECTOR'ADDRESS + 0,                             52422000
      SECTOR'ADDRESS2 = SECTOR'ADDRESS + 1,                             52424000
      YES         := FALSE;                                             52426000
                                                                        52428000
   BYTE ARRAY                                                           52430000
      DISJ'EXT'ADDR'LDEV (*) = DISJ'EXT'ADDR,                           52432000
      GBUF'       (*) = GBUF(0),                                        52434000
      SCRATCH'    (*) = SCRATCH (0),                                    52436000
      TDBUF'      (*) = TDBUF (0);                                      52438000
                                                                        52440000
   BYTE                                                                 52442000
      SECTOR'ADDRESS'LDEV = SECTOR'ADDRESS + 0;                         52444000
                                                                        52446000
   LABEL                                                                52448000
      END'FSTORE;                                                       52450000
                                                                        52452000
   EQUATE                                                               52454000
      IO'BAD      = 0,                                                  52456000
      IO'GOOD     = 1,                                                  52458000
      IO'GOOD'EOT = 2,                                                  52460000
      STATE'0     = 0,                                                  52462000
      STATE'1     = 1,                                                  52464000
      STATE'2     = 2,                                                  52466000
      STATE'3     = 3,                                                  52468000
      STATE'4     = 4,                                                  52470000
      STATE'5     = 5,                                                  52472000
      STATE'6     = 6,                                                  52474000
      STATE'7     = 7,                                                  52476000
      WAIT'CURRENT= 0,                                                  52478000
      WAIT'ALL    = 1;                                                  52480000
                                                                        52482000
   DEFINE                                                               52484000
      PV'MVTABXf = (4:4) #;                                             52486000
$PAGE ";STORE=  FSTORE --- ERROR HANDLING SUBROUTINES"                  52488000
   <<------------------->>                                              52490000
   <<  RELEASE'BUFFERS  >>                                              52492000
   <<------------------->>                                              52494000
                                                                        52496000
   SUBROUTINE RELEASE'BUFFERS;                                          52498000
                                                                        52500000
      <<this routine releases any XDS buffers obtained by               52502000
        the ALLOCATE'BUFFERS subroutine.  This may entail               52504000
        unfreezing and unlocking prior to releasing.     >>             52506000
                                                                        52508000
      BEGIN                                                             52510000
                                                                        52512000
      CUR'INX:=-1;                                                      52514000
                                                                        52516000
      WHILE (CUR'INX:=CUR'INX+1) < NUM'XDS     DO                       52518000
         BEGIN                                                          52520000
                                                                        52522000
               <<NOTE: the order here is important!!!>>                 52524000
                                                                        52526000
         IF BUFFER'STATUS(CUR'INX) = bufstat'FROZEN THEN                52528000
            BEGIN                                                       52530000
            UNFREEZE (BUFFER'XDS(CUR'INX), 1, 0);                       52532000
            BUFFER'STATUS(CUR'INX):=bufstat'LOCKED;                     52534000
            END;                                                        52536000
                                                                        52538000
         IF BUFFER'STATUS(CUR'INX) = bufstat'LOCKED THEN                52540000
            BEGIN                                                       52542000
            UNLOCKSEG (BUFFER'XDS(CUR'INX), 1, 0);                      52544000
            BUFFER'STATUS(CUR'INX):=bufstat'ALLOCATED;                  52546000
            END;                                                        52548000
                                                                        52550000
         IF BUFFER'STATUS(CUR'INX) = bufstat'ALLOCATED then             52552000
            BEGIN                                                       52554000
            RELDATASEG (BUFFER'XDS(CUR'INX));                           52556000
            BUFFER'STATUS(CUR'INX):=bufstat'EMPTY;                      52558000
            END;                                                        52560000
                                                                        52562000
         END;                                                           52564000
                                                                        52566000
      END <<RELEASE'BUFFERS SUB>>;                                      52568000
$PAGE                                                                   52570000
   <<-------->>                                                         52572000
   <<  FAIL  >>                                                         52574000
   <<-------->>                                                         52576000
                                                                        52578000
   SUBROUTINE FAIL (N);                                                 52580000
            VALUE   N;                                                  52582000
            INTEGER N;                                                  52584000
      BEGIN                                                             52586000
                                                                        52588000
      IF N <> 0 THEN                                                    52590000
         SENDMESSAGE (N);                                               52592000
                                                                        52594000
      IF USING'ATTIO THEN RELEASE'BUFFERS;                              52596000
                                                                        52598000
      FSTORE:=FAILED;                                                   52600000
                                                                        52602000
      GO END'FSTORE;          <<unlocking done by CXSTORE>>             52604000
                                                                        52606000
      END <<FAIL SUB>>;                                                 52608000
                                                                        52610000
   <<------------->>                                                    52612000
   <<  FILE'FAIL  >>                                                    52614000
   <<------------->>                                                    52616000
                                                                        52618000
   SUBROUTINE FILE'FAIL (FID, N);                                       52620000
            VALUE FID, N;                                               52622000
            INTEGER FID, N;                                             52624000
      BEGIN                                                             52626000
                                                                        52628000
      IF FID <> NO'FILE THEN                                            52630000
         PRINT'FILE'ERROR (FID);                                        52632000
                                                                        52634000
      FAIL (N);                                                         52636000
                                                                        52638000
      END <<FILE'FAIL SUB>>;                                            52640000
$PAGE ";STORE=  FSTORE --- UTILITY SUBROUTINES"                         52696000
   <<-------------------->>                                             52698000
   <<  ALLOCATE'BUFFERS  >>                                             52700000
   <<-------------------->>                                             52702000
                                                                        52704000
   LOGICAL SUBROUTINE ALLOCATE'BUFFERS;                                 52706000
                                                                        52708000
      <<this routine allocates NUM'XDS     extra data segments.         52710000
        If it fail in this, it returns FAILED and releases              52712000
        any buffers it got.                                             52714000
                                                                        52716000
        It tries to get NUM'XDS     data segment buffers,               52718000
        each of which is large enough to hold MAX'IO areas              52720000
        of TAPE'RECSIZE words in length.  If this fails,                52722000
        it starts decrementing NUM'IO (initially set to MAX'IO)         52724000
        until it gets that many or until NUM'IO < 1.  If it             52726000
        fails to allocate the buffers, a FAILED is returned             52728000
        and all buffers it did get (if any) are released.               52730000
        If it succeeds, all buffers are locked & frozen into            52732000
        memory and a GOOD is returned.                                  52734000
                                                                        52736000
        Note: we must investigate whether or not these buffers          52738000
        really need to be locked & frozen...ATTACHIO may be             52740000
        sufficiently smart in MPE-IV to temporarily lock them           52742000
        in memory while in use.  If so, we should probably              52744000
        remove the locking/freezing code unless we decide               52746000
        (after performance analysis) that we know better than           52748000
        MPE-IV's memory manager.                                        52750000
                                                             >>         52752000
                                                                        52754000
      BEGIN                                                             52756000
                                                                        52758000
      ALLOCATE'BUFFERS:=FAILED;        <<assumption>>                   52760000
                                                                        52762000
      I:=NUM'XDS    *MAX'IO;                                            52764000
      FILL (BUFFER'STATUS, NUM'XDS    , bufstat'EMPTY);                 52766000
      FILL (BUFFER'XDS,    NUM'XDS    , 0);                             52768000
      FILL (IO'WTM,        NUM'XDS    *2, 0);                           52770000
      FILL (IO'QUEUE,      I*2,         0);                             52772000
      FILL (IO'LEN,        I,           0);                             52774000
                                                                        52776000
            <<setup IO'QUEUE'D indices...>>                             52778000
                                                                        52780000
      I:=0;                                                             52782000
      CUR'INX:=-1;                                                      52784000
      WHILE (CUR'INX:=CUR'INX+1) < NUM'XDS     DO                       52786000
         BEGIN                                                          52788000
         FIRST'IO'INX(CUR'INX):=I;                                      52790000
         LAST'IO'INX (CUR'INX):=I + MAX'IO - 1;                         52792000
         I:=I + MAX'IO;                                                 52794000
         END;                                                           52796000
                                                                        52798000
            <<see how big XDS'SIZE should be...>>                       52800000
            <<warning: since MAX'XDS'SIZE is near 32767,                52802000
              be careful not to change this code and cause              52804000
              an integer overflow!                        >>            52806000
                                                                        52808000
      NUM'IO:=(MAX'XDS'SIZE - XDS'OVERHEAD)/TAPE'RECSIZE;               52810000
      IF NUM'IO > MAX'IO THEN                                           52812000
         NUM'IO:=MAX'IO;                                                52814000
      XDS'SIZE:=NUM'IO*TAPE'RECSIZE + XDS'OVERHEAD;                     52816000
                                                                        52818000
      CUR'INX:=-1;                                                      52820000
                                                                        52822000
      WHILE (CUR'INX:=CUR'INX+1) < NUM'XDS     DO                       52824000
         BEGIN                                                          52826000
                                                                        52828000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        52830000
         IF DEBUGGING THEN                                              52832000
            BEGIN                                                       52834000
            SAY "Allocate buffer # " ENDSAY;                            52836000
            SAYNUM (CUR'INX);                                           52838000
            SAY " of " ENDSAY;                                          52840000
            SAYNUM (XDS'SIZE);                                          52842000
            SAY " words,  NUM'IO = " ENDSAY;                            52844000
            SAYNUM (NUM'IO);                                            52846000
            SEND;                                                       52848000
            END;                                                        52850000
$IF                           <<DEBUGGING CODE>>                        52852000
                                                                        52854000
            <<allocate a buffer of size XDS'SIZE words...>>             52856000
                                                                        52858000
         CUR'XDS:=GETDATASEG (XDS'SIZE, 0);                             52860000
                                                                        52862000
         IF < THEN                                                      52864000
            BEGIN          <<error grabbing an XDS>>                    52866000
                                                                        52868000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        52870000
            IF DEBUGGING THEN                                           52872000
               BEGIN                                                    52874000
               SAY "   failed...too large, XDS'SIZE was " ENDSAY;       52876000
               SAYNUM (XDS'SIZE);                                       52878000
               SEND;                                                    52880000
               END;                                                     52882000
$IF                           <<DEBUGGING CODE>>                        52884000
                                                                        52886000
                  <<this error means that the system does               52888000
                    not want to give us a data segment as               52890000
                    large as we asked for...so shrink the               52892000
                    asking size down...                  >>             52894000
                                                                        52896000
            NUM'IO:=NUM'IO-1;                                           52898000
            XDS'SIZE:=NUM'IO*TAPE'RECSIZE + XDS'OVERHEAD;               52900000
                                                                        52902000
                  <<we should have no buffers at this point,            52904000
                    but we release them anyway...>>                     52906000
                                                                        52908000
            RELEASE'BUFFERS;                                            52910000
                                                                        52912000
                  <<see if NUM'IO is now too small...>>                 52914000
                                                                        52916000
            IF NUM'IO < 1 THEN                                          52918000
               BEGIN                                                    52920000
               SENDMESSAGE (SR'BUFFER'ALLOCATE'FAIL);                   52922000
               RETURN;     <<exit from routine>>                        52924000
               END;                                                     52926000
                                                                        52928000
                  <<"restart" loop by setting CUR'INX to -1...>>        52930000
                                                                        52932000
            CUR'INX:=-1;                                                52934000
            END                                                         52936000
         ELSE IF CUR'XDS = 0 THEN                                       52938000
            BEGIN          <<unable to get XDS>>                        52940000
                                                                        52942000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        52944000
            IF DEBUGGING THEN                                           52946000
               BEGIN                                                    52948000
               SAY "   unable to get XDS for some reason" ENDSAY;       52950000
               SEND;                                                    52952000
               END;                                                     52954000
$IF                           <<DEBUGGING CODE>>                        52956000
            RELEASE'BUFFERS;                                            52958000
            SENDMESSAGE (SR'BUFFER'ALLOCATE'FAIL);                      52960000
            RETURN;        <<exit from routine>>                        52962000
            END                                                         52964000
         ELSE                                                           52966000
            BEGIN          <<got the XDS!>>                             52968000
                                                                        52970000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        52972000
            IF DEBUGGING THEN                                           52974000
               BEGIN                                                    52976000
               SAY "   got XDS, # = " ENDSAY;                           52978000
               SAYNUM (CUR'XDS);                                        52980000
               SEND;                                                    52982000
               END;                                                     52984000
$IF                           <<DEBUGGING CODE>>                        52986000
            BUFFER'STATUS(CUR'INX):=bufstat'ALLOCATED;                  52988000
            BUFFER'XDS(CUR'INX):=CUR'XDS;                               52990000
            END;                                                        52992000
         END;                                                           52994000
                                                                        52996000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        52998000
   IF DEBUGGING THEN                                                    53000000
      BEGIN                                                             53002000
      SAY "XDS Buffers allocated" ENDSAY;                               53004000
      SEND;                                                             53006000
      END;                                                              53008000
$IF                           <<DEBUGGING CODE>>                        53010000
                                                                        53012000
            <<all NUM'XDS     XDS are allocated.>>                      53014000
            <<now lock and freeze them...>>                             53016000
                                                                        53018000
      CUR'INX:=-1;                                                      53020000
                                                                        53022000
      IF FREEZE'AND'LOCK'XDS THEN                                       53024000
         WHILE (CUR'INX:=CUR'INX+1) < NUM'XDS     DO                    53026000
            BEGIN                                                       53028000
                                                                        53030000
                                                                        53032000
            LOCKSEG (BUFFER'XDS(CUR'INX), 1, 0);                        53034000
            IF < THEN                                                   53036000
               BEGIN             <<error locking buffer>>               53038000
               RELEASE'BUFFERS;                                         53040000
               SENDMESSAGE (SR'BUFFER'LOCK'FAIL);                       53042000
               RETURN;           <<exit from routine>>                  53044000
               END;                                                     53046000
            BUFFER'STATUS(CUR'INX):=bufstat'LOCKED;                     53048000
                                                                        53050000
            FREEZE (BUFFER'XDS(CUR'INX), 1, 0);                         53052000
            IF < THEN                                                   53054000
               BEGIN             <<error freezing buffer>>              53056000
               RELEASE'BUFFERS;                                         53058000
               SENDMESSAGE (SR'BUFFER'FREEZE'FAIL);                     53060000
               RETURN;           <<exit from routine>>                  53062000
               END;                                                     53064000
            BUFFER'STATUS(CUR'INX):=bufstat'FROZEN;                     53066000
                                                                        53068000
            END;                                                        53070000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        53072000
         IF DEBUGGING THEN                                              53074000
            BEGIN                                                       53076000
            SAY "   locked&freezed buffers" ENDSAY;                     53078000
            SEND;                                                       53080000
            END;                                                        53082000
$IF                           <<DEBUGGING CODE>>                        53084000
                                                                        53086000
      ALLOCATE'BUFFERS:=GOOD;                                           53088000
                                                                        53090000
      CUR'INX:=0;                                                       53092000
      CUR'XDS:=BUFFER'XDS(0);                                           53094000
                                                                        53096000
      XDS'SECTORS:=(XDS'SIZE-XDS'OVERHEAD) / 128;                       53098000
                                                                        53100000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        53102000
      IF DEBUGGING THEN                                                 53104000
         BEGIN                                                          53106000
         SAY "   # of sectors per XDS = " ENDSAY;                       53108000
         SAYNUM (XDS'SECTORS);                                          53110000
         SEND;                                                          53112000
         END;                                                           53114000
$IF                           <<DEBUGGING CODE>>                        53116000
                                                                        53118000
      END <<ALLOCATE'BUFFERS SUB>>;                                     53120000
$PAGE                                                                   53122000
   <<----------------------->>                                          53124000
   <<  UNLOCK'CURRENT'FILE  >>                                          53126000
   <<----------------------->>                                          53128000
                                                                        53130000
   SUBROUTINE UNLOCK'CURRENT'FILE;                                      53132000
                                                                        53134000
      BEGIN                                                             53136000
                                                                        53138000
      IF ON'ERR = ONERR'QUIT THEN                                       53140000
         UNLOCK'FILES (FILE'NUMBER, 0);                                 53142000
                                                                        53144000
      END <<UNLOCK'CURRENT'FILE SUB>>;                                  53146000
$PAGE                                                                   53148000
   <<------------------->>                                              53150000
   <<  WAIT'FOR'ONE'IO  >>                                              53152000
   <<------------------->>                                              53154000
                                                                        53156000
   LOGICAL SUBROUTINE WAIT'FOR'ONE'IO;                                  53158000
                                                                        53160000
      <<This routine is used to wait for all IOs from the               53162000
        current buffer (CUR'INX) to finish.  The result is              53164000
        the "worst" result found, and will be one of the                53166000
        following three:                                                53168000
           IO'GOOD     ... all IOs finished ok.                         53170000
           IO'GOOD'EOT ... all IOs finished ok, end of tape             53172000
                           was found.                                   53174000
           IO'BAD      ... one or more IOs failed.                      53176000
                                                           >>           53178000
      BEGIN                                                             53180000
                                                                        53182000
      LL:=IO'GOOD;            <<assume best result>>                    53184000
                                                                        53186000
      CUR'XDS:=BUFFER'XDS(CUR'INX);                                     53188000
      IO'INX:=FIRST'IO'INX(CUR'INX)-1;                                  53190000
                                                                        53192000
      WHILE (IO'INX:=IO'INX+1) <= LAST'IO'INX(CUR'INX) DO               53194000
         BEGIN                                                          53196000
                                                                        53198000
               <<check status of an IO...>>                             53200000
                                                                        53202000
         IF IO'QUEUE'D(IO'INX) <> 0D THEN                               53204000
            BEGIN                                                       53206000
                                                                        53208000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        53210000
            IF DEBUG'DISK THEN                                          53212000
               BEGIN                                                    53214000
               SAY "   waitforio #" ENDSAY;                             53216000
               SAYNUM (IO'INX);                                         53218000
               SAY " of cur'inx = " ENDSAY;                             53220000
               SAYNUM (CUR'INX);                                        53222000
               SAY " from xds " ENDSAY;                                 53224000
               SAYNUM (CUR'XDS);                                        53226000
               SAY " ioq1 = %" ENDSAY;                                  53228000
               SAYOCTAL (IO'QUEUE(IO'INX*2));                           53230000
               SAY ", %" ENDSAY;                                        53232000
               SAYOCTAL (IO'QUEUE(IO'INX*2+1));                         53234000
               SEND;                                                    53236000
               END;                                                     53238000
$IF                           <<DEBUGGING CODE>>                        53240000
                                                                        53242000
                  <<wait till complete...>>                             53244000
                                                                        53246000
                  <<pass first word of IO'QUEUE'D (IO'INX)...>>         53248000
            IOB:=WAITFORIO (IO'QUEUE(IO'INX*2) );                       53250000
                                                                        53252000
            IF <>  OR                                                   53254000
                  ATTIO'STATUS.ATTIO'STATUSf <> ATTIO'GOOD THEN         53256000
               BEGIN          <<oops..error!>>                          53258000
               LL:=IO'BAD;                                              53260000
                     <<someday, consider calling file system            53262000
                       routines like POST'ACB'ERROR and                 53264000
                       IOSTAT at this point.>>                          53266000
               END                                                      53268000
                                                                        53270000
            ELSE IF ATTIO'STATUS.(8:8) = %31 THEN                       53272000
               BEGIN                                                    53274000
                                                                        53276000
                  <<the write succeeded, but we have now gone           53278000
                    past the EOT marker!>>                              53280000
                                                                        53282000
               IF LL = IO'GOOD THEN                                     53284000
                  LL:=IO'GOOD'EOT;                                      53286000
               END                                                      53288000
                                                                        53290000
            ELSE           <<no error occurred!>>                       53292000
               ;              <<don't change LL>>                       53294000
                                                                        53296000
            IO'QUEUE'D(IO'INX):=0D;                                     53298000
                                                                        53300000
            END;                                                        53302000
         END;                 <<end while loop>>                        53304000
                                                                        53306000
      IF IO'WTM'D (CUR'INX) <> 0D THEN                                  53308000
         BEGIN                                                          53310000
            IOB := WAITFORIO (IO'WTM(CUR'INX*2));                       53312000
                                                                        53314000
            IF <>  OR                                                   53316000
                  ATTIO'STATUS.ATTIO'STATUSf <> ATTIO'GOOD THEN         53318000
               BEGIN          <<oops..error!>>                          53320000
               LL:=IO'BAD;                                              53322000
                     <<someday, consider calling file system            53324000
                       routines like POST'ACB'ERROR and                 53326000
                       IOSTAT at this point.>>                          53328000
               END                                                      53330000
                                                                        53332000
            ELSE IF ATTIO'STATUS.(8:8) = %31 THEN                       53334000
               BEGIN                                                    53336000
                                                                        53338000
                  <<the write succeeded, but we have now gone           53340000
                    past the EOT marker!>>                              53342000
                                                                        53344000
               IF LL = IO'GOOD THEN                                     53346000
                  LL:=IO'GOOD'EOT;                                      53348000
               END                                                      53350000
                                                                        53352000
            ELSE           <<no error occurred!>>                       53354000
               ;              <<don't change LL>>                       53356000
                                                                        53358000
            IO'WTM'D(CUR'INX):=0D;                                      53360000
         END;                                                           53362000
      WAIT'FOR'ONE'IO:=LL;                                              53364000
                                                                        53366000
      END <<WAIT'FOR'ONE'IO SUB>>;                                      53368000
$PAGE                                                                   53370000
   <<------------------->>                                              53372000
   <<  WAIT'FOR'ALL'IO  >>                                              53374000
   <<------------------->>                                              53376000
                                                                        53378000
   LOGICAL SUBROUTINE WAIT'FOR'ALL'IO;                                  53380000
                                                                        53382000
      <<This routine is used to wait for all pending IOs to             53384000
        complete.  It then returns one of the following                 53386000
        three results:                                                  53388000
           IO'GOOD     ... all IOs completed normally.                  53390000
           IO'GOOD'EOT ... all IOs completed normally, the end of       53392000
                           tape marker was found.                       53394000
           IO'BAD      ... one or more IOs failed to complete ok.       53396000
                                                                        53398000
        This routine does NOT write the end of tape marker (if any),    53400000
        it merely reports the end of tape.                              53402000
                                                     >>                 53404000
      BEGIN                                                             53406000
                                                                        53408000
      LL:=IO'GOOD;            <<temporarily assume all is well>>        53410000
                                                                        53412000
      CUR'INX:=-1;                                                      53414000
                                                                        53416000
      WHILE (CUR'INX:=CUR'INX+1) < NUM'XDS     DO                       53418000
         BEGIN                                                          53420000
                                                                        53422000
               <<wait for an IO...>>                                    53424000
                                                                        53426000
         L:=WAIT'FOR'ONE'IO;                                            53428000
                                                                        53430000
               <<if L is "worse" than LL, set LL to L...>>              53432000
                                                                        53434000
         IF L = IO'BAD THEN                                             53436000
            LL:=IO'BAD                                                  53438000
                                                                        53440000
         ELSE IF L = IO'GOOD'EOT THEN                                   53442000
            IF LL = IO'GOOD THEN                                        53444000
               LL:=L                                                    53446000
            ELSE                                                        53448000
               <<LL is either IO'GOOD'EOT or IO'BAD already>>           53450000
                                                                        53452000
         ELSE                                                           53454000
            ;                 <<LL shouldnt be changed>>                53456000
         END;                                                           53458000
                                                                        53460000
      CUR'INX:=0;                                                       53462000
      CUR'XDS:=BUFFER'XDS(CUR'INX);                                     53464000
                                                                        53466000
      WAIT'FOR'ALL'IO:=LL;                                              53468000
                                                                        53470000
      END <<WAIT'FOR'ALL'IO SUB>>;                                      53472000
$PAGE                                                                   53474000
   <<------------------->>                                              53476000
   <<  CHECK'IO'STATUS  >>                                              53478000
   <<------------------->>                                              53480000
                                                                        53482000
   LOGICAL SUBROUTINE CHECK'IO'STATUS (WHAT);                           53484000
            VALUE   WHAT;                                               53486000
            LOGICAL WHAT;                                               53488000
                                                                        53490000
      <<This routine is used to check the status of a batch of          53492000
        NOWAIT ATTACHIOs write requests issued by FSTORE.               53494000
                                                                        53496000
        Tape will be written past the EOT reflector, but only           53498000
        by the number of records still awaiting processing              53500000
        in the buffers defined by BUFFER'XDS, and currently             53502000
        pointed to by CUR'XDS.                                          53504000
                                                                        53506000
        A FAILED is returned if any tape errors occurred                53508000
        during the status check.                                        53510000
                                                                        53512000
        If WHAT = WAIT'CURRENT, then the routine will wait              53514000
        for the IOs from CUR'INX buffer to finish, and then             53516000
        check them.  IF WHAT = WAIT'ALL, then it waits for              53518000
        all IOs from all buffers to finish.                             53520000
                                                 >>                     53522000
      BEGIN                                                             53524000
                                                                        53526000
      CHECK'IO'STATUS:=FAILED;                                          53528000
                                                                        53530000
      IF WHAT = WAIT'CURRENT THEN                                       53532000
         LL:=WAIT'FOR'ONE'IO                                            53534000
      ELSE                                                              53536000
         LL:=WAIT'FOR'ALL'IO;                                           53538000
                                                                        53540000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        53542000
      IF DEBUGGING THEN                                                 53544000
         BEGIN                                                          53546000
         SAY "IN CHECK'IO'RESULT (" ENDSAY;                             53548000
         IF WHAT = WAIT'CURRENT THEN                                    53550000
            SAY "CURRENT" ENDSAY                                        53552000
         ELSE                                                           53554000
            SAY "ALL" ENDSAY;                                           53556000
         SAY "), result = " ENDSAY;                                     53558000
         IF LL = IO'GOOD THEN                                           53560000
            SAY "GOOD" ENDSAY                                           53562000
         ELSE IF LL = IO'GOOD'EOT THEN                                  53564000
            SAY "GOOD'EOT" ENDSAY                                       53566000
         ELSE                                                           53568000
            SAY "BAD" ENDSAY;                                           53570000
         SEND;                                                          53572000
         END;                                                           53574000
$IF                           <<DEBUGGING CODE>>                        53576000
                                                                        53578000
      IF LL = IO'BAD THEN                                               53580000
         RETURN;              <<return an error condition>>             53582000
                                                                        53584000
            <<If the last STATUS we processed is one that indicates     53586000
              that we went past EOT, then we want to wait for           53588000
              all other buffers to finish off their writing,            53590000
              so we can then finish off this reel...>>                  53592000
                                                                        53594000
      IF LL = IO'GOOD'EOT THEN                                          53596000
         BEGIN                                                          53598000
                                                                        53600000
               <<the write succeeded, but we have now gone              53602000
                 past the EOT marker!>>                                 53604000
                                                                        53606000
               <<wait for all pending IOs to finish...>>                53608000
                                                                        53610000
         IF WHAT = WAIT'CURRENT THEN                                    53612000
            IF WAIT'FOR'ALL'IO = IO'BAD THEN                            53614000
               RETURN;        <<oops...I/O error after EOT>>            53616000
                                                                        53618000
               <<start a new reel...>>                                  53620000
                                                                        53622000
         IF NOT LAST'STARTIO'WROTE'EOF THEN                             53624000
            IF WRITE'TAPE'MARK (PARMS'TEMPI'1) THEN                     53626000
               IF PARMS'TEMPI'1 <> EOTCODE THEN                         53628000
                  RETURN;                                               53630000
                                                                        53632000
         IF FINISH'REEL (TDBUF, LAST'STARTIO'WROTE'EOF)        <<06361>>53634000
               = FAILED THEN                                            53638000
            RETURN;                                                     53640000
                                                                        53642000
         IF START'REEL (TDBUF, TAPE'REEL+1) = FAILED THEN               53644000
            RETURN;                                                     53646000
                                                                        53648000
         END;                                                           53650000
                                                                        53652000
      CHECK'IO'STATUS:=GOOD;                                            53654000
                                                                        53656000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        53658000
      IF DEBUGGING THEN                                                 53660000
         BEGIN                                                          53662000
         SAY "   end check'io" ENDSAY;                                  53664000
         SEND;                                                          53666000
         END;                                                           53668000
$IF                           <<DEBUGGING CODE>>                        53670000
                                                                        53672000
      END <<CHECK'IO'STATUS SUB>>;                                      53674000
$PAGE                                                                   53676000
   <<---------------------->>                                           53678000
   <<  HANDLE'END'OF'REEL  >>                                           53680000
   <<---------------------->>                                           53682000
                                                                        53684000
   SUBROUTINE HANDLE'END'OF'REEL (FINAL'REEL);                          53686000
            VALUE   FINAL'REEL;                                         53688000
            LOGICAL FINAL'REEL;                                         53690000
                                                                        53692000
         <<This routine unlocks all completed files that                53694000
           are still locked.>>                                          53696000
                                                                        53698000
      BEGIN                                                             53700000
                                                                        53702000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        53704000
      IF DEBUGGING THEN                                                 53706000
         BEGIN                                                          53708000
         SAY "*** END OF FILE ***" ENDSAY;                              53710000
         SEND;                                                          53712000
         END;                                                           53714000
$IF                           <<DEBUGGING CODE>>                        53716000
                                                                        53718000
      IF LABELED THEN         <<volume set close of labelled tape>>     53720000
         <<do nothing...already handled elsewhere>>                     53722000
                                                                        53724000
      ELSE IF FINAL'REEL THEN                                           53726000
         BEGIN                <<need to indicate end-of-logical-reel>>  53728000
               <<write tape trailer label...>>                          53730000
         TL'ZFIELD:=1;                                                  53732000
         IF WRITE'TAPE (TAPE'LABEL'SIZE, TAPE'LABEL,                    53734000
                        TRUE, TDBUF, FALSE)                             53736000
               = FAILED THEN                                            53738000
            FILE'FAIL (T'NUM, SR'TAPE'WRITE'FAIL);                      53740000
                                                                        53742000
         IF WRITE'TAPE'MARK (PARMS'TEMPI'1) = FAILED THEN               53744000
            IF PARMS'TEMPI'1 <> EOTCODE THEN                            53746000
               FILE'FAIL (T'NUM, SR'TAPE'WRITE'FAIL);                   53748000
                                                                        53750000
         IF WRITE'TAPE'MARK (PARMS'TEMPI'1) = FAILED THEN               53752000
            IF PARMS'TEMPI'1 <> EOTCODE THEN                            53754000
               FILE'FAIL (T'NUM, SR'TAPE'WRITE'FAIL);                   53756000
                                                                        53758000
         IF T'NUM <> 0 THEN                                             53760000
            FCLOSE (T'NUM, TAPE'CLOSE'DISP, 0);                <<04726>>53762000
         T'NUM := 0;                                                    53764000
         END;                                                           53766000
                                                                        53768000
      END <<HANDLE'END'OF'REEL SUB>>;                                   53770000
$PAGE                                                                   53772000
   <<--------------------->>                                            53774000
   <<  INITIALIZE'FSTORE  >>                                            53776000
   <<--------------------->>                                            53778000
                                                                        53780000
   SUBROUTINE INITIALIZE'FSTORE;                                        53782000
                                                                        53784000
         <<This routine initializes the variables of & used by          53786000
           FSTORE.                                                      53788000
                                                                        53790000
           NOTE: this routine must not take an error exit...            53792000
           as the error exit will attempt to release the                53794000
           various extra data segments acquired by the                  53796000
           ALLOCATE'BUFFERS routine, which won't be called until        53798000
           AFTER this routine!                                 >>       53800000
                                                                        53802000
      BEGIN                                                             53804000
                                                                        53806000
      ENABLE'ARITHMETIC'TRAPS;                                          53808000
                                                                        53810000
      FSTORE:=GOOD;                                                     53812000
                                                                        53814000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        53816000
      IF DEBUGGING THEN                                                 53818000
         BEGIN                                                          53820000
         SEND;                                                          53822000
         SAY "FSTORE ENTERED" ENDSAY;                                   53824000
         SEND;                                                          53826000
         SAY "G'NUM = " ENDSAY;                                         53828000
         SAYNUM (G'NUM);                                                53830000
         SEND;                                                          53832000
         SAY "FILES'TO'HANDLE = " ENDSAY;                               53834000
         SAYDNUM (FILES'TO'HANDLE);                                     53836000
         SAY ", FILE'NUMBER = " ENDSAY;                                 53838000
         SAYDNUM (FILE'NUMBER);                                         53840000
         SEND;                                                          53842000
         END;                                                           53844000
$IF                           <<DEBUGGING CODE>>                        53846000
                                                                        53848000
            <<blank out tape label...>>                                 53850000
                                                                        53852000
      FILL (TAPE'LABEL, TAPE'LABEL'SIZE, 0);                            53854000
                                                                        53856000
            <<setup some variables...>>                                 53858000
                                                                        53860000
      SECTORS'PER'TAPE'RECORD:=DOUBLE(TAPE'RECSIZE/128);                53862000
      TAPE'REEL:=1;                                                     53864000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        53866000
      IF DEBUGGING THEN                                                 53868000
         BEGIN                                                          53870000
         SAY "*******TAPE'REEL:=1 ******" ENDSAY;                       53872000
         SEND;                                                          53874000
         END;                                                           53876000
$IF                           <<DEBUGGING CODE>>                        53878000
                                                                        53880000
            <<setup tape label...>>                                     53882000
                                                                        53884000
      MOVE TAPE'LABEL':=LABELTEXT;     <<identifier>>                   53886000
      TL'RECSIZE:=TAPE'RECSIZE;                                         53888000
      TL'ZFIELD:=0;                                                     53890000
      TL'REELNUM:=1;          <<Physical reel number...first reel>>     53892000
      TL'DATE:=CALENDAR;      <<get date>>                              53894000
      TOS:=CLOCK;             <<get time of day>>                       53896000
            <<note: CLOCK returned a double, first word = hours >>      53898000
            << & minutes, second = seconds & tenths             >>      53900000
      TL'SSTT:=TOS;                                                     53902000
      TL'HHMM:=TOS;                                                     53904000
      MOVE TL'IIBID:="VIIB";                                            53906000
      TL'SPANTOG:=0;          <<first file on first volume>>            53908000
      TL'FILEINX:=0;                                                    53910000
                                                                        53912000
            <<someday, handle tape of type: $CTUL and $CTUR>>           53914000
                                                                        53916000
            <<compute checksum for tape label...>>                      53918000
                                                                        53920000
      TL'CHKSUM:=0;                                                     53922000
      TL'CHKSUM:=CHECKSUM (TAPE'LABEL, TAPE'LABEL'SIZE);                53924000
                                                                        53926000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        53928000
      IF DEBUGGING THEN                                                 53930000
         BEGIN                                                          53932000
         SAY "#sectors per tape record = " ENDSAY;                      53934000
         SAYDNUM (SECTORS'PER'TAPE'RECORD);                             53936000
         SAY ", @TDBUF = " ENDSAY;                                      53938000
         SAYOCTAL (@TDBUF);                                             53940000
         SEND;                                                          53942000
         END;                                                           53944000
$IF                           <<DEBUGGING CODE>>                        53946000
                                                                        53948000
      END <<INITIALIZE'FSTORE SUB>>;                                    53950000
$PAGE                                                                   54022000
   <<----------------->>                                                54024000
   <<  RECOVER'ERROR  >>                                                54026000
   <<----------------->>                                                54028000
                                                                        54030000
   SUBROUTINE RECOVER'ERROR (ERRMSG);                                   54032000
            VALUE   ERRMSG;                                             54034000
            INTEGER ERRMSG;                                             54036000
                                                                        54038000
         <<------------------------------------------                   54040000
           This routine checks to see if the error can                  54042000
           be recovered from AND if the user wants recovery.            54044000
                                                                        54046000
           If either of the above checks fail, we exit with             54048000
           an error message.                                            54050000
                                                                        54052000
           If we want to recover the error, we restore the              54054000
           locals and selected global variables to the state            54056000
           they were in at the last reel switch.  We then               54058000
           change the subroutine's return address (which is             54060000
           currently at S-0) to be the address passed to the            54062000
           most recent call on SAVE'STATE.  A normal SXIT is            54064000
           then done, which will return us to the code that             54066000
           is immediately after the last SAVE'STATE call.               54068000
                                                                        54070000
           Note: if SPL allowed us to have a switch label               54072000
           that had subroutine-local labels in it, we could             54074000
           merely return an index back from this routine like           54076000
           the following:  GO ERROR'SWITCH(RECOVER'ERROR(...))          54078000
           -------------------------------------------------->>         54080000
      BEGIN                                                             54082000
                                                                        54084000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        54086000
      IF DEBUGGING THEN                                                 54088000
         BEGIN                                                          54090000
         SAY "Recovering from tape error now" ENDSAY;                   54092000
         SAY ", error'code=" ENDSAY;                                    54094000
         SAYNUM (ERROR'CODE);                                           54096000
         SAY ", ERRMSG=" ENDSAY;                                        54098000
         SAYNUM (ERRMSG);                                               54100000
         SEND;                                                          54102000
         SAY "   ONERR=" ENDSAY;                                        54104000
         SAYNUM (ON'ERR);                                               54106000
         SAY ", QUIT=" ENDSAY;                                          54108000
         SAYNUM (ONERR'QUIT);                                           54110000
         SEND;                                                          54112000
         PRINTFILEINFO (T'NUM);                                         54114000
         END;                                                           54116000
$IF                           <<DEBUGGING CODE>>                        54118000
                                                                        54120000
      IF OPERATOR'ABORT THEN                                            54122000
         FAIL (SR'OPERATOR'ABORT);                                      54124000
                                                                        54126000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        54128000
      IF DEBUGGING THEN                                                 54130000
         BEGIN                                                          54132000
         SAY "   ERROR IS A TAPE WRITE ERROR" ENDSAY;                   54134000
         SEND;                                                          54136000
         END;                                                           54138000
$IF                           <<DEBUGGING CODE>>                        54140000
                                                                        54142000
            <<don't recover if recovery was not requested,              54144000
              OR this is the first reel of a SYSDUMP tape!>>            54146000
                                                               <<04101>>54146100
      IF DONT'DO'RECOVERY THEN                                 <<04101>>54146200
         FILE'FAIL (T'NUM, ERRMSG);                            <<04101>>54146300
                                                               <<04101>>54146400
                                                                        54148000
      IF ON'ERR = ONERR'QUIT OR (SYSDUMPING LAND TL'REELNUM=1) THEN     54150000
         FILE'FAIL (T'NUM, ERRMSG);                                     54152000
                                                                        54154000
                                                                        54156000
            <<restore global & local state...>>                         54158000
                                                                        54160000
                                                                        54162000
      MOVE FIRST'LOCAL'ARRAY:=SAVE'LOCALS, (LOCALS'LEN);                54164000
                                                                        54166000
      FILE'NUMBER:=LOCAL'FILE'NUMBER;                                   54172000
      TAPEMARK'WRITTEN := LOCAL'TAPEMARK'WRITTEN;              <<04101>>54173000
      FILE'ADDRESS     := LOCAL'FILE'ADDRESS;                  <<04104>>54173100
      FILE'LDEV        := LOCAL'FILE'LDEV;                     <<04104>>54173200
      MOVE FLAB        := LOCAL'FLAB,       (FILE'LABEL'SIZE); <<04104>>54173300
      MOVE CURR'TITLE' := LOCAL'TITLE',     (MAX'STD'LEN + 1); <<04104>>54173400
      MOVE TAPE'LABEL  := LOCAL'TAPE'LABEL, (TAPE'LABEL'SIZE); <<04104>>54173500
                                                               <<04104>>54173600
                                                                        54174000
            <<tell user what is happening...>>                          54176000
                                                                        54178000
      SENDMESSAGE (M'BLANK'LINE);                                       54180000
      SENDMESSAGE (SR'WILL'RE'STORE);                                   54182000
      SENDMESSAGE (M'BLANK'LINE);                                       54184000
                                                                        54186000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        54188000
      IF DEBUGGING THEN                                                 54190000
         BEGIN                                                          54192000
         SAY " ... RECOVER'LABEL = %" ENDSAY;                           54194000
         SAYOCTAL (RECOVER'LABEL);                                      54196000
         SAY ", STATE=" ENDSAY;                                         54198000
         SAYNUM (STATE);                                                54200000
         SAY ", FILE#:= " ENDSAY;                                       54202000
         SAYDNUM (FILE'NUMBER);                                         54204000
         SEND;                                                          54206000
         SAY "Recovery 1/3 done...opening new reel now" ENDSAY;         54208000
         SEND;                                                          54210000
         END;                                                           54212000
$IF                           <<DEBUGGING CODE>>                        54214000
                                                                        54216000
            <<change the subroutine's return address   >>               54218000
            <<to that of the label following the most  >>               54220000
            <<recent call to SAVE'STATE...             >>               54222000
                                                                        54224000
      S0:=RECOVER'LABEL;                                                54226000
                                                                        54228000
            <<rewind current reel and mark it bad...>>                  54230000
                                                                        54232000
BAD'REEL:                                                      <<04102>>54232100
                                                               <<04102>>54232200
      MARK'REEL'BAD;                                                    54234000
                                                                        54236000
            <<ask for next reel...special case for reel #1...>>         54238000
                                                                        54240000
      IF TAPE'REEL = 1 THEN                                             54242000
         BEGIN                                                          54244000
         PARMS'TEMPI'1 := TAPE'REEL;                                    54246000
         PARMS'TEMPI'2 := TAPE'LDEV;                                    54248000
         SENDMESSAGE (SR'MOUNT'NEXT'REEL,,TRUE);                        54250000
         IF FKONTROL (T'NUM, REWIND'UNLOAD) = FAILED THEN      <<04102>>54250100
            BEGIN                                              <<04102>>54250200
            SENDMESSAGE (SR'TAPE'REWIND'FAILED);               <<04102>>54250300
            GOTO BAD'REEL;                                     <<04102>>54250400
            END;                                               <<04102>>54250500
                                                               <<04102>>54250600
         END;                                                           54252000
                                                                        54254000
            <<restart the reel...>>                                     54256000
                                                                        54258000
      IF STATE <> STATE'0 THEN                                          54260000
         IF LABELED THEN                                                54262000
            FAIL (SR'CANT'RECOVER'LABELED'TAPES)                        54264000
         ELSE IF START'REEL (TDBUF, TL'REELNUM)                         54266000
               = FAILED THEN                                            54268000
            FAIL (SR'NO'NEXT'REEL);                                     54270000
                                                                        54272000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        54274000
      IF DEBUGGING THEN                                                 54276000
         BEGIN                                                          54278000
         SAY "Recovery 2/3 done...checking PV stuff" ENDSAY;            54280000
         SEND;                                                          54282000
         END;                                                           54284000
$IF                           <<DEBUGGING CODE>>                        54286000
                                                                        54288000
            <<dismount the current set of private volumes               54290000
              (if any) ... black magic...>>                             54292000
                                                                        54294000
      CHECK'FOR'DISMOUNT (PVINFO, GBUF(G'PVINFO'INX),                   54296000
                          OLD'GBUF, ERROR'CODE);                        54298000
                                                                        54300000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        54302000
      IF DEBUGGING THEN                                                 54304000
         BEGIN                                                          54306000
         SAY "Recovered from tape error." ENDSAY;                       54308000
         SEND;                                                          54310000
         END;                                                           54312000
$IF                           <<DEBUGGING CODE>>                        54314000
                                                                        54316000
      END <<RECOVER'ERROR SUB>>;                                        54318000
$PAGE                                                                   54320000
   <<-------------->>                                                   54322000
   <<  SAVE'STATE  >>                                                   54324000
   <<-------------->>                                                   54326000
                                                                        54328000
   SUBROUTINE SAVE'STATE (NEW'STATE);                                   54330000
      VALUE NEW'STATE;                                                  54332000
      INTEGER NEW'STATE;                                                54334000
                                                                        54336000
         <<This routine saves the information necessary                 54338000
           to restarting the STORE at the current point.>>              54340000
                                                                        54342000
      BEGIN                                                             54344000
                                                                        54346000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        54348000
      IF DEBUGGING THEN                                                 54350000
         BEGIN                                                          54352000
         SAY "START SAVE'STATE (" ENDSAY;                               54354000
         SAYNUM (NEW'STATE);                                            54356000
         SAY ") return to %" ENDSAY;                                    54358000
         SAYOCTAL (S0);                                                 54360000
         SEND;                                                          54362000
         END;                                                           54364000
$IF                           <<DEBUGGING CODE>>                        54366000
                                                                        54368000
      RECOVER'LABEL:=S0;      <<copy of return address>>                54370000
      STATE:=NEW'STATE;                                                 54372000
                                                                        54374000
      LOCAL'FILE'NUMBER:=FILE'NUMBER;                                   54376000
      LOCAL'TAPEMARK'WRITTEN := TAPEMARK'WRITTEN;              <<04101>>54377000
      LOCAL'FILE'ADDRESS    := FILE'ADDRESS;                   <<04104>>54377100
      LOCAL'FILE'LDEV       := FILE'LDEV;                      <<04104>>54377200
      MOVE LOCAL'FLAB       := FLAB,        (FILE'LABEL'SIZE); <<04104>>54377300
      MOVE LOCAL'TITLE'     := CURR'TITLE', (MAX'STD'LEN + 1); <<04104>>54377400
      MOVE LOCAL'TAPE'LABEL := TAPE'LABEL,  (TAPE'LABEL'SIZE); <<04104>>54377500
      MOVE SAVE'LOCALS:=FIRST'LOCAL'ARRAY, (LOCALS'LEN);                54378000
                                                                        54380000
                                                                        54384000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        54386000
      IF DEBUGGING THEN                                                 54388000
         BEGIN                                                          54390000
         SAY "END SAVE'STATE SUB" ENDSAY;                               54392000
         SEND;                                                          54394000
         END;                                                           54396000
$IF                           <<DEBUGGING CODE>>                        54398000
                                                                        54400000
      END <<SAVE'STATE SUB>>;                                           54402000
$PAGE                                                                   54404000
   <<------------>>                                                     54406000
   <<  START'IO  >>                                                     54408000
   <<------------>>                                                     54410000
                                                                        54412000
   LOGICAL SUBROUTINE START'IO (SECTORS,SHOULD'WRITE'TAPE'MARK);        54414000
            VALUE   SECTORS, SHOULD'WRITE'TAPE'MARK;                    54416000
            INTEGER SECTORS;                                            54418000
            LOGICAL SHOULD'WRITE'TAPE'MARK;                             54420000
                                                                        54422000
      <<This routine starts up to NUM'IO writes from the                54424000
        data segment CUR'XDS to the tape.  If they are                  54426000
        all started ok, CUR'XDS and CUR'INX get bumped up               54428000
        to the next buffer xds/index pair (the indices                  54430000
        run from 0 to NUM'XDS    -1, then back to 0.     >>             54432000
                                                                        54434000
      BEGIN                                                             54436000
                                                                        54438000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        54440000
      IF DEBUGGING THEN                                                 54442000
         BEGIN                                                          54444000
         SAY "   START'IO (" ENDSAY;                                    54446000
         SAYNUM (SECTORS);                                              54448000
         SAY " sectors)" ENDSAY;                                        54450000
         SEND;                                                          54452000
         END;                                                           54454000
$IF                           <<DEBUGGING CODE>>                        54456000
                                                                        54458000
      START'IO:=FAILED;       <<initial assumption>>                    54460000
                                                                        54462000
      LAST'STARTIO'WROTE'EOF := SHOULD'WRITE'TAPE'MARK;                 54464000
                                                                        54466000
            <<loop thru the CUR'XDS data, starting off                  54468000
              IOs...>>                                                  54470000
                                                                        54472000
      IO'INX:=FIRST'IO'INX(CUR'INX) - 1;                                54474000
                                                                        54476000
      WORDS'LEFT:=SECTORS * 128;                                        54478000
      OFFSET:=0;                                                        54480000
                                                                        54482000
      WHILE (IO'INX:=IO'INX+1) <= LAST'IO'INX(CUR'INX) DO               54484000
         BEGIN                                                          54486000
                                                                        54488000
               <<see how many words to write to the tape...>>           54490000
                                                                        54492000
         IF (LEN:=WORDS'LEFT) > TAPE'RECSIZE THEN                       54494000
            LEN:=TAPE'RECSIZE;                                          54496000
                                                                        54498000
         WORDS'LEFT:=WORDS'LEFT - LEN;                                  54500000
                                                                        54502000
         IF LEN > 0 THEN                                                54504000
            BEGIN                                                       54506000
                                                                        54508000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        54510000
            IF DEBUGGING THEN                                           54512000
               BEGIN                                                    54514000
               SAY "   call attachio (" ENDSAY;                         54516000
               SAYNUM (TAPE'LDEV); SAY ", 0, " ENDSAY;                  54518000
               SAYNUM (CUR'XDS);   SAY ", " ENDSAY;                     54520000
               SAYNUM (OFFSET);    SAY ", wr, " ENDSAY;                 54522000
               SAYNUM (LEN);       SAY ", ...)" ENDSAY;                 54524000
               SEND;                                                    54526000
               END;                                                     54528000
$IF                           <<DEBUGGING CODE>>                        54530000
                                                                        54532000
            DISABLE'ARITHMETIC'TRAPS;                                   54534000
                                                                        54536000
            IO'QUEUE'D(IO'INX):=                                        54538000
                  ATTACHIO (                                            54540000
                     TAPE'LDEV,                  << LDEV              >>54542000
                     0,                          << QMISC             >>54544000
                     CUR'XDS,                    << DATA SEGMENT      >>54546000
                     OFFSET,                     << OFFSET IN DATA SEG>>54548000
                     ATTIO'WRITE,                << DO A WRITE        >>54550000
                     LEN,                        << LENGTH OF WRITE   >>54552000
                     0,                          << PARAMETER 1       >>54554000
                     4,       <<write past EOT>> << PARAMETER 2       >>54556000
                     0);      <<no wake,impede>> << FLAGS             >>54558000
                                                                        54560000
            ENABLE'ARITHMETIC'TRAPS;                                    54562000
                                                                        54564000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        54566000
            IF DEBUGGING THEN                                           54568000
               BEGIN                                                    54570000
               SAY "      --> IOQ'1 = %" ENDSAY;                        54572000
               SAYOCTAL (IO'QUEUE(IO'INX*2));                           54574000
               SAY ", IOQ'2 = %" ENDSAY;                                54576000
               SAYOCTAL (IO'QUEUE(IO'INX*2+1));                         54578000
               SEND;                                                    54580000
               END;                                                     54582000
$IF                           <<DEBUGGING CODE>>                        54584000
            IO'LEN(IO'INX):=LEN;                                        54586000
            OFFSET:=OFFSET + LEN;                                       54588000
            END                                                         54590000
         ELSE                                                           54592000
            BEGIN                                                       54594000
            IO'QUEUE'D(IO'INX):=0D;                                     54596000
            IO'LEN(IO'INX):=0;                                          54598000
            END;                                                        54600000
         END;                                                           54602000
                                                                        54604000
            <<write tape mark if necessary>>                            54606000
                                                                        54608000
      IF SHOULD'WRITE'TAPE'MARK THEN                                    54610000
         BEGIN                                                          54612000
            DISABLE'ARITHMETIC'TRAPS;                                   54614000
                                                                        54616000
            IO'WTM'D(CUR'INX):=                                         54618000
                  ATTACHIO (                                            54620000
                     TAPE'LDEV,                  << LDEV              >>54622000
                     0,                          << QMISC             >>54624000
                     0,                          << DATA SEGMENT      >>54626000
                     0,                          << OFFSET IN DATA SEG>>54628000
                     ATTIO'WTM,                  << DO A WRITE        >>54630000
                     0,                          << LENGTH OF WRITE   >>54632000
                     0,                          << PARAMETER 1       >>54634000
                     4,       <<write past EOT>> << PARAMETER 2       >>54636000
                     0);      <<no wake,impede>> << FLAGS             >>54638000
                                                                        54640000
            ENABLE'ARITHMETIC'TRAPS;                                    54642000
         END                                                            54644000
      ELSE IO'WTM'D (CUR'INX) := 0D;                                    54646000
            <<bump the CUR'INX...>>                                     54648000
                                                                        54650000
      IF (CUR'INX:=CUR'INX+1) >= NUM'XDS     THEN                       54652000
         CUR'INX:=0;                                                    54654000
                                                                        54656000
      CUR'XDS:=BUFFER'XDS(CUR'INX);                                     54658000
                                                                        54660000
      START'IO:=GOOD;                                                   54662000
                                                                        54664000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        54666000
      IF DEBUGGING THEN                                                 54668000
         BEGIN                                                          54670000
         SAY "   end of start'io" ENDSAY;                               54672000
         SEND;                                                          54674000
         END;                                                           54676000
$IF                           <<DEBUGGING CODE>>                        54678000
                                                                        54680000
      END <<START'IO SUB>>;                                             54682000
$PAGE                                                          <<06309>>54682100
                                                               <<06309>>54682200
   <<------------------->>                                     <<06309>>54682300
   <<  FAILED'TO'STORE  >>                                     <<06309>>54682400
   <<------------------->>                                     <<06309>>54682500
                                                               <<06309>>54682600
   SUBROUTINE FAILED'TO'STORE (N);                             <<06309>>54682700
            VALUE  N;                                          <<06309>>54682800
            INTEGER N;                                         <<06309>>54682900
      BEGIN                                                    <<06309>>54683000
      SENDMESSAGE (N);                                         <<06309>>54683100
                                                               <<06309>>54683200
      IF N <> 0 THEN                                           <<06309>>54683300
         ERROR'CODE:=N;                                        <<06309>>54683400
                                                               <<06309>>54683500
      GOOD'STORE:=FALSE;                                       <<06309>>54683600
                                                               <<06309>>54683700
      IF FIRST'RECORD'OF'FILE THEN                             <<06309>>54683800
         BEGIN                <<need to write SOMETHING!>>     <<06309>>54683900
         MOVE FLLOCNAME := GBUF (G'TITLE'INX),                 <<06309>>54684000
                               (3*FILE'PART'SIZE);             <<06309>>54684100
         FL'BAD'FILE:=TRUE;                                    <<06309>>54684200
                                                               <<06309>>54684300
         IF USING'ATTIO THEN                                   <<06309>>54684400
            BEGIN                                              <<06309>>54684500
            MOVE'DATA'OUT (CUR'XDS, 0, FLAB, FILE'LABEL'SIZE); <<06309>>54684600
                                                               <<06309>>54684700
            IF START'IO (1, TRUE) = FAILED THEN                <<06309>>54684800
               RECOVER'ERROR (SR'TAPE'WRITE'FAIL);             <<06309>>54684900
            END                                                <<06309>>54685000
                                                               <<06309>>54685100
         ELSE IF WRITE'TAPE (FILE'LABEL'SIZE, FLAB, FALSE,     <<06309>>54685200
                          TDBUF, TRUE) = FAILED THEN           <<06309>>54685300
            RECOVER'ERROR (SR'TAPE'WRITE'FAIL);                <<06309>>54685400
         END                                                   <<06309>>54685500
                                                               <<06309>>54685510
      ELSE IF USING'ATTIO THEN                                 <<06309>>54685520
         IF START'IO (0, TRUE) = FAILED THEN <<WRITE TAPEMARK>><<06309>>54685530
            RECOVER'ERROR (SR'TAPE'WRITE'FAIL);                <<06309>>54685600
                                                               <<06309>>54685610
      END <<FAILED'TO'STORE SUB>>;                             <<06309>>54685700
$PAGE                                                          <<06309>>54685800
   <<---------------->>                                                 54686000
   <<  STORE'A'FILE  >>                                                 54688000
   <<---------------->>                                                 54690000
                                                                        54692000
   LOGICAL SUBROUTINE STORE'A'FILE;                                     54694000
                                                                        54696000
         <<Attempts to STORE the current file.  If it fails,            54698000
           returns FAILED, otherwise GOOD.            >>                54700000
                                                                        54702000
      BEGIN                                                             54704000
                                                                        54706000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        54708000
      IF DEBUGGING THEN                                                 54710000
         BEGIN                                                          54712000
         SAY "STORE'A'FILE entered, TAPE'REEL = " ENDSAY;               54714000
         SAYNUM (TAPE'REEL);                                            54716000
         SEND;                                                          54718000
         END;                                                           54720000
$IF                           <<DEBUGGING CODE>>                        54722000
                                                                        54724000
      CHECK'BREAK;            <<wont come back if break sensed>>        54726000
                                                                        54728000
      GOOD'STORE:=TRUE;       <<this file is ok, so far>>               54730000
                                                               <<04996>>54730100
      TAPEMARK'WRITTEN := FALSE;                               <<04996>>54730200
                                                                        54732000
      IF FIRST'TIME'IN THEN                                             54734000
         BEGIN                                                          54736000
         FIRST'TIME'IN:=FALSE;                                          54738000
         SAVE'STATE (STATE'0);                                          54740000
         IF START'REEL (TDBUF, 1) = FAILED THEN                         54742000
            RECOVER'ERROR (SR'NO'FIRST'REEL);                           54744000
         SAVE'STATE (STATE'7);                                          54746000
         END;                                                           54758000
                                                                        54760000
      FIRST'REEL:=TAPE'REEL;  <<remember reel # file started on>>       54762000
                                                                        54764000
      FPOINT (G'NUM, FILE'NUMBER - 1D);                                 54766000
                                                                        54768000
      IF <> THEN                                                        54770000
         FILE'FAIL (G'NUM, SR'G'NUM'ERROR);                             54772000
                                                                        54774000
      READ'GOOD'FILE;         <<handles '<' errors>>                    54776000
                                                                        54778000
      IF > THEN                                                         54780000
         FILE'FAIL (G'NUM, SR'G'NUM'SEQUENCE);                          54782000
                                                                        54784000
      IF FILE'NUMBER <> GBUF'D (G'FILENUM'INX'D) THEN                   54786000
         FILE'FAIL (NO'FILE, SR'G'NUM'SEQUENCE);                        54788000
                                                                        54790000
      FILE'ADDRESS:=GBUF'D(G'ADDRESS'INX'D);                            54792000
      FILE'LDEV:=GBUF(G'LDEV'INX);                                      54794000
      PVINFO:=GBUF(G'PVINFO'INX);                              <<04988>>54795000
                                                                        54796000
      DISPLAY'3'TO'STANDARD (GBUF'(G'FILE'INX'), GBUF'(G'GROUP'INX'),   54798000
                             GBUF'(G'ACCT'INX'),                        54800000
                             CURR'TITLE',                               54802000
                             ERROR'CODE);                               54804000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        54806000
      IF DEBUGGING THEN                                                 54808000
         BEGIN                                                          54810000
         SEND;                                                          54812000
         SAY "   FSTORE: " ENDSAY;                                      54814000
         SAY'STANDARD (CURR'TITLE');                                    54816000
         SAY "   " ENDSAY;                                              54818000
         SAYNUM (FILE'LDEV);                                            54820000
         SAY "%" ENDSAY;                                                54822000
         SAYOCTAL (FILE'ADDR'1);                                        54824000
         SEND;                                                          54826000
         END;                                                           54828000
$IF                           <<DEBUGGING CODE>>                        54830000
                                                                        54832000
      CHECK'FOR'DISMOUNT (PVINFO, GBUF(G'PVINFO'INX),                   54834000
                          OLD'GBUF, ERROR'CODE);                        54836000
                                                                        54838000
                                                                        54840000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        54842000
      IF DEBUGGING THEN                                                 54844000
         BEGIN                                                          54846000
         SAY "      FILE SIZE = " ENDSAY;                               54848000
         SAYDNUM (FILE'SECTORS);                                        54850000
         SAY " SECTORS,  #EXTENTS = " ENDSAY;                           54852000
         SAYNUM (FLNUMEXTS);                                            54854000
         SAY ", STORE TO REEL # " ENDSAY;                               54856000
         SAYNUM (TL'REELNUM);                                           54858000
         SEND;                                                          54860000
         END;                                                           54862000
$IF                           <<DEBUGGING CODE>>                        54864000
                                                                        54866000
      DISJ'EXTENT'NUM:=0;                                               54868000
      FIRST'RECORD'OF'FILE:=TRUE;                                       54870000
                                                                        54872000
      SECTORS'FILLED:=0D;                                               54874000
                                                                        54876000
               <<put addresses in DEXTMAP - LDEV in                     54878000
                 leftmost byte...>>                                     54880000
                                                                        54882000
      DISJ'EXT'ADDR (0) := GBUF'D (G'ADDRESS'INX'D);                    54884000
      DISJ'EXT'ADDR'LDEV := GBUF (G'LDEV'INX);                          54886000
      DISJ'EXT'LEN (0) := GBUF'D (G'EXTSIZE'INX'D);                     54888000
      FILE'SECTORS := GBUF'D (G'FILE'SECTORS'INX'D);                    54890000
      FILE'SECTORS'LEFT := FILE'SECTORS;                                54892000
$PAGE                                                                   54894000
                                                                        54896000
         <<------------------------------------------------------->>    54898000
         << NOTE: The following algorithm takes advantage of the  >>    54900000
         << fact that sectors within an extent are contiguous.    >>    54902000
         << (i.e: one ATTACHIO reads multiple sectors).           >>    54904000
         <<------------------------------------------------------->>    54906000
                                                                        54908000
            <<write out the extents of the file...>>                    54910000
                                                                        54912000
      DO                                                                54914000
         BEGIN                <<per extent>>                            54916000
                                                                        54918000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        54920000
         IF DEBUGGING THEN                                              54922000
            BEGIN                                                       54924000
            SAY "      HANDLE DISJOINT EXTENT # " ENDSAY;               54926000
            SAYNUM(DISJ'EXTENT'NUM);                                    54928000
            SAY ", SIZE=" ENDSAY;                                       54930000
            SAYDNUM (DISJ'EXT'LEN (DISJ'EXTENT'NUM) );                  54932000
            SAY ", FILE'SECTORS'LEFT = " ENDSAY;                        54934000
            SAYDNUM (FILE'SECTORS'LEFT);                                54936000
            SEND;                                                       54938000
            END;                                                        54940000
$IF                           <<DEBUGGING CODE>>                        54942000
                                                                        54944000
         SECTOR'ADDRESS:=DISJ'EXT'ADDR(DISJ'EXTENT'NUM);                54946000
         IF SECTOR'ADDRESS = 0D THEN                                    54948000
            GO NULLEXT;       <<null extent>>                           54950000
                                                                        54952000
                                                                        54954000
               <<adjust FILE'SECTORS'LEFT by subtracting the            54956000
                 number of sectors we are about to STORE from           54958000
                 the current extent...>>                                54960000
                                                                        54962000
         IF FILE'SECTORS'LEFT < DISJ'EXT'LEN (DISJ'EXTENT'NUM) THEN     54964000
            BEGIN                                                       54966000
            EXTENT'SECTORS'LEFT := FILE'SECTORS'LEFT;                   54968000
            FILE'SECTORS'LEFT   := 0D;                                  54970000
            END                                                         54972000
         ELSE                                                           54974000
            BEGIN                                                       54976000
            EXTENT'SECTORS'LEFT := DISJ'EXT'LEN (DISJ'EXTENT'NUM);      54978000
            FILE'SECTORS'LEFT   := FILE'SECTORS'LEFT                    54980000
                                      - EXTENT'SECTORS'LEFT;            54982000
            END;                                                        54984000
                                                                        54986000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        54988000
         IF DEBUGGING THEN                                              54990000
            BEGIN                                                       54992000
            SAY "         EXTENT'SECTORS'LEFT := " ENDSAY;              54994000
            SAYDNUM (EXTENT'SECTORS'LEFT);                              54996000
            SAY ",  FILE'SECTORS'LEFT := " ENDSAY;                      54998000
            SAYDNUM (FILE'SECTORS'LEFT);                                55000000
            SEND;                                                       55002000
            END;                                                        55004000
$IF                           <<DEBUGGING CODE>>                        55006000
                                                                        55008000
                                                                        55010000
               <<extract LDEV...>>                                      55012000
                                                                        55014000
         LDEV:=SECTOR'ADDRESS'LDEV;                                     55016000
                                                                        55018000
               <<convert SECTOR'ADDRESS to a simple address...>>        55020000
                                                                        55022000
         SECTOR'ADDRESS'LDEV:=0;                                        55024000
                                                                        55026000
         WHILE EXTENT'SECTORS'LEFT > 0D DO                              55028000
            BEGIN             <<sectors within extent DISJ'EXTENT'NUM>> 55030000
                                                                        55032000
                  <<read as many sectors as are left in                 55034000
                    the tape buffer...>>                                55036000
                                                                        55038000
            IF USING'ATTIO THEN                                         55040000
               SECTORS'THIS'READ:=DOUBLE(XDS'SECTORS)                   55042000
            ELSE                                                        55044000
               SECTORS'THIS'READ:=SECTORS'PER'TAPE'RECORD               55046000
                                     - SECTORS'FILLED;                  55048000
                                                                        55050000
                  <<if the above is more than is left, dont read        55052000
                    that much...>>                                      55054000
                                                                        55056000
            IF EXTENT'SECTORS'LEFT <= SECTORS'THIS'READ THEN            55058000
               SECTORS'THIS'READ:=EXTENT'SECTORS'LEFT;                  55060000
                                                                        55062000
                  <<decrement number of sectors left...>>               55064000
                                                                        55066000
            EXTENT'SECTORS'LEFT:=EXTENT'SECTORS'LEFT                    55068000
                                    - SECTORS'THIS'READ;                55070000
                                                                        55072000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        55074000
            IF DEBUGGING THEN                                           55076000
               BEGIN                                                    55078000
               SAY "         READ " ENDSAY;                             55080000
               SAYDNUM (SECTORS'THIS'READ);                             55082000
               SAY " FROM " ENDSAY;                                     55084000
               SAYNUM (LDEV);                                           55086000
               SAY1 ("%");                                              55088000
               SAYDOCTAL (SECTOR'ADDRESS);                              55090000
               SAY "  (EXTENT'SECTORS'LEFT = " ENDSAY;                  55092000
               SAYDNUM (EXTENT'SECTORS'LEFT);                           55094000
               SAY1 (")");                                              55096000
               SEND;                                                    55098000
               END;                                                     55100000
$IF                           <<DEBUGGING CODE>>                        55102000
                                                                        55104000
            IF USING'ATTIO THEN                                         55106000
               BEGIN                                                    55108000
                     <<wait for old IOs from this XDS to                55110000
                       tape to finish, and see if they worked           55112000
                       ok...>>                                          55114000
               SAVE'REEL:=TL'REELNUM;                                   55116000
               IF CHECK'IO'STATUS (WAIT'CURRENT) = FAILED THEN          55118000
                  RECOVER'ERROR (SR'TAPE'WRITE'FAIL);                   55120000
               IF SAVE'REEL <> TL'REELNUM THEN                          55122000
                  SAVE'STATE (STATE'1);                                 55124000
                                                                        55126000
               READ'DISK (LDEV, SECTOR'ADDRESS,                         55128000
                          CUR'XDS,                                      55130000
                          0,  <<read into start of XDS>>                55132000
                          LOGICAL(SECTORS'THIS'READ) & LSL(7),          55134000
                          IOB);                                         55136000
               END                                                      55138000
            ELSE                                                        55140000
               READ'DISK (LDEV, SECTOR'ADDRESS,                         55142000
                          0,     << = stack>>                           55144000
                          @TDBUF(LOGICAL(SECTORS'FILLED) & LSL(7)),     55146000
                          LOGICAL(SECTORS'THIS'READ) & LSL(7),          55148000
                          IOB);                                         55150000
                                                                        55152000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        55154000
            IF DEBUG'ERRORS AND                                         55156000
                  ATTIO'STATUS.ATTIO'STATUSf = ATTIO'GOOD THEN          55158000
               BEGIN                                                    55160000
               SAY "READ-ATTACHIO WORKED...INJECT ERROR? " ENDSAY;      55162000
               SENDSTOP;                                                55164000
               AFFIRM (YES, FALSE);                                     55166000
               IF YES THEN                                              55168000
                  BEGIN                                                 55170000
                  IOB'1:=%000014;                                       55172000
                  IOB'2:=%000000;                                       55174000
                  MOVE FLAB' := "3333333333333333X";           <<06309>>55175000
                  SAY "ERROR INJECTED!" ENDSAY;                         55176000
                  SEND;                                                 55178000
                  END;                                                  55180000
               END;                                                     55182000
$IF                           <<DEBUGGING CODE>>                        55184000
                                                               <<06361>>55184100
            LAST'FILE := (FILE'NUMBER = FILES'TO'HANDLE);      <<06361>>55184200
                                                                        55186000
            IF ATTIO'STATUS.ATTIO'STATUSf <> ATTIO'GOOD THEN            55188000
               BEGIN          <<rewrite file label and unlock...>>      55190000
               SENDMESSAGE (M'BLANK'LINE);                              55192000
               PARMS'TEMPI'1:=LDEV;                                     55194000
               PARMS'TEMPI'2:=INTEGER(SECTORS'THIS'READ);               55196000
               PARMS'TEMPD'1:=SECTOR'ADDRESS;                           55198000
               PARMS'TEMPD'2:=IOB;                                      55200000
               SENDMESSAGE (M'DISK'READ'FAILED);                        55202000
               SENDMESSAGE (M'BLANK'LINE);                              55204000
               UNLOCK'CURRENT'FILE;                                     55206000
               FAILED'TO'STORE (SR'ATTIO'FAIL);                         55208000
               GO L'FAILED'TO'STORE;                                    55210000
               END;                                                     55212000
                                                                        55214000
            IF FIRST'RECORD'OF'FILE THEN                                55216000
               BEGIN          <<NOTE: file label is first data!>>       55218000
                                                                        55220000
               IF USING'ATTIO THEN                                      55222000
                  MOVE'DATA'IN (CUR'XDS, 0, TDBUF, FILE'LABEL'SIZE);    55224000
               MOVE FLAB := TDBUF, (FILE'LABEL'SIZE);                   55226000
                                                                        55228000
               VTABTOLDEV (EXTMAP'D (1), FLEXTMAP'D'1, FLNUMEXTS,       55230000
                           PVINFO.PV'MVTABXf );                         55232000
                                                                        55234000
               JOIN'CONTIGUOUS'EXTENTS (NUM'DISJOINT'EXTENTS,           55236000
                  DISJ'EXT'ADDR (1), DISJ'EXT'LEN (1), EXTMAP'D (1),    55238000
                  FLNUMEXTS, FLEXTSIZE'D, FLLASTEXTSIZE'D);    <<LB.RS>>55240000
                                                                        55242000
               NUM'DISJOINT'EXTENTS := NUM'DISJOINT'EXTENTS + 1;        55244000
                                                                        55246000
                     <<set RELEASE bit...>>                             55248000
                                                                        55250000
               TDBUF(FL'SR'RELEASE'INX).FL'SR'RELEASE'BIT:=             55252000
                  RELEASE'FLAG;                                         55254000
                                                                        55256000
                     <<set new ACCT, if needed...>>                     55258000
                                                                        55260000
               IF RES'ACCT' <> " " THEN                                 55262000
                  MOVE TDBUF'(FL'ACCT''INX) :=                          55264000
                        RES'ACCT', (FILE'PART'SIZE);                    55266000
                                                                        55268000
                     <<set new GROUP, if needed...>>                    55270000
                                                                        55272000
               IF RES'GROUP' <> " " THEN                                55274000
                  MOVE TDBUF'(FL'GROUP''INX) :=                         55276000
                        RES'GROUP', (FILE'PART'SIZE);                   55278000
                                                                        55280000
                     <<calculate new checksum...>>                      55282000
                                                                        55284000
               FLAB'CHECKSUM;                                           55286000
                                                                        55288000
               IF USING'ATTIO AND                                       55290000
                     (RELEASE'FLAG OR SEEN'ACCT OR SEEN'GROUP OR        55292000
                        SEEN'LOCAL )                            THEN    55294000
                  MOVE'DATA'OUT (CUR'XDS, 0, TDBUF, FILE'LABEL'SIZE);   55296000
                                                                        55298000
               FIRST'RECORD'OF'FILE:=FALSE;                             55300000
               END;                                                     55302000
                                                                        55304000
            SECTORS'FILLED:=SECTORS'FILLED + SECTORS'THIS'READ;         55306000
                                                                        55308000
            IF SECTORS'FILLED >= SECTORS'PER'TAPE'RECORD                55310000
                  OR USING'ATTIO THEN                                   55312000
               BEGIN                                                    55314000
                                                                        55316000
                     <<save reel# so we can detect reel                 55318000
                       switch...>>                                      55320000
                                                                        55322000
               SAVE'REEL:=TL'REELNUM;                                   55324000
                                                                        55326000
                     <<write the buffer out to tape...>>                55328000
                                                                        55330000
               IF USING'ATTIO THEN                                      55332000
                  IF START'IO (LOGICAL(SECTORS'THIS'READ),              55334000
                               ((FILE'SECTORS'LEFT = 0D) LAND           55336000
                               (EXTENT'SECTORS'LEFT = 0D)    ))         55338000
                        = FAILED THEN                                   55340000
                     RECOVER'ERROR (SR'TAPE'WRITE'FAIL)                 55342000
                  ELSE                                                  55344000
               ELSE IF WRITE'TAPE (TAPE'RECSIZE, TDBUF, FALSE, TDBUF,   55346000
                  (FILE'SECTORS'LEFT=0D LAND EXTENT'SECTORS'LEFT=0D))   55348000
                     = FAILED THEN                                      55350000
                  RECOVER'ERROR (SR'TAPE'WRITE'FAIL);                   55352000
                                                                        55354000
                     <<If we switched reels, remember                   55356000
                       state...>>                                       55358000
                                                                        55360000
               IF SAVE'REEL <> TL'REELNUM THEN                          55362000
                  SAVE'STATE (STATE'2);                                 55364000
                                                                        55366000
               SECTORS'FILLED:=0D;                                      55368000
                                                                        55370000
               END;                                                     55372000
                                                                        55374000
            SECTOR'ADDRESS:=SECTOR'ADDRESS+SECTORS'THIS'READ;           55376000
                                                                        55378000
            END;              <<sectors within an extent loop>>         55380000
                                                                        55382000
   NULLEXT:                                                             55384000
         DISJ'EXTENT'NUM:=DISJ'EXTENT'NUM+1;                            55386000
         END                  <<per extent loop>>                       55388000
      UNTIL                                                             55390000
         FILE'SECTORS'LEFT <= 0D  OR                                    55392000
            DISJ'EXTENT'NUM > NUM'DISJOINT'EXTENTS;                     55394000
                                                                        55396000
                                                                        55398000
            <<we have, supposedly, finished storing the                 55400000
              current file...we now double check and see                55402000
              if we have stored too many or too few                     55404000
              sectors...if we have, some piece of information           55406000
              that we relied upon to calculate things like              55408000
               extents and sectors was inconsistent...       >>         55410000
                                                                        55412000
                                                                        55414000
      IF FILE'SECTORS'LEFT <> 0D THEN                                   55416000
         BEGIN                                                          55418000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        55420000
         IF DEBUGGING THEN                                              55422000
            BEGIN                                                       55424000
            SEND;                                                       55426000
            SAY "***OH OH, SECTORS SHOULD BE 0, NOT: " ENDSAY;          55428000
            SAYDNUM (FILE'SECTORS'LEFT);                                55430000
            SEND;                                                       55432000
            SEND;                                                       55434000
            END;                                                        55436000
$IF                           <<DEBUGGING CODE>>                        55438000
         SENDMESSAGE (SR'SECTORS'NOT'EQUAL'0);                          55440000
         IF NOT SHOW'FLAG THEN                                 <<06156>>55440100
            SENDMESSAGE (M'TITLE);                             <<06156>>55440200
         END;                                                           55442000
                                                                        55444000
         <<---------------------------------------------->>             55446000
         << End of disk file.  Flush partial tape buffer >>             55448000
         << & write an eof.  Then unlock the file.       >>             55450000
         <<---------------------------------------------->>             55452000
                                                                        55454000
      IF SECTORS'FILLED > 0D  THEN                                      55456000
         BEGIN                                                          55458000
                                                                        55460000
               <<NOTE: this code won't be executed when                 55462000
                 USING'ATTIO is true!                  >>               55464000
                                                                        55466000
         LEN:=LOGICAL(SECTORS'FILLED) * 128;    <<sectors-->words>>     55468000
         SAVE'REEL:=TL'REELNUM;                                         55470000
         IF WRITE'TAPE (LEN, TDBUF, FALSE, TDBUF, TRUE)                 55472000
               = FAILED THEN                                            55474000
            RECOVER'ERROR (SR'TAPE'WRITE'FAIL);                         55476000
         IF SAVE'REEL <> TL'REELNUM THEN                                55478000
            SAVE'STATE (STATE'3);                                       55480000
         SECTORS'FILLED:=0D;                                            55482000
         END;                                                           55484000
                                                                        55486000
<<    IF USING'ATTIO THEN                                               55488000
         BEGIN                                                          55490000
         SAVE'REEL:=TL'REELNUM;                                         55492000
         IF CHECK'IO'STATUS (WAIT'ALL) = FAILED THEN                    55494000
            RECOVER'ERROR (SR'TAPE'WRITE'FAIL);                         55496000
         IF SAVE'REEL <> TL'REELNUM THEN                                55498000
            BEGIN                                                       55500000
            HANDLE'END'OF'REEL (FALSE);                                 55502000
            SAVE'STATE (STATE'4);                                       55504000
            END;                                                        55506000
         END;             >>                                            55508000
$PAGE                                                                   55510000
         <<----------------------------------------------->>            55512000
         << Through with the file, one way or the other...>>            55514000
         <<----------------------------------------------->>            55516000
                                                                        55518000
   L'FAILED'TO'STORE:                                                   55520000
                                                                        55522000
                                                                        55524000
      IF LABELED THEN                                                   55526000
         BEGIN                <<labelled tape>>                         55528000
                                                                        55530000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        55532000
         IF DEBUGGING THEN                                              55534000
            BEGIN                                                       55536000
            SAY "   call NEXTTAPEFILE" ENDSAY;                          55538000
            SEND;                                                       55540000
            END;                                                        55542000
$IF                           <<DEBUGGING CODE>>                        55544000
                                                               <<04966>>55544900
         IF NOT LAST'FILE THEN                                 <<04966>>55545000
         BEGIN                                                 <<04966>>55545100
         DISABLE'ARITHMETIC'TRAPS;                                      55546000
         IF NEXTTAPEFILE (T'NUM) <> 0 THEN                              55548000
            FILE'FAIL (T'NUM, SR'CANT'REOPEN'TAPE);                     55550000
                                                                        55552000
         IF LDIRECTF (T'NUM) OR NEED'DIRECTORY THEN                     55554000
            BEGIN             <<write directory on reel switch>>        55556000
            IF DIREC'TO'TAPE (TDBUF) = FAILED THEN                      55558000
               FILE'FAIL (T'NUM, ERROR'CODE);                           55560000
            IF NEXTTAPEFILE (T'NUM) <> 0 THEN                           55562000
               FILE'FAIL (T'NUM, SR'CANT'REOPEN'TAPE);                  55564000
            END;                                                        55566000
         ENABLE'ARITHMETIC'TRAPS;                                       55568000
         END;                                                  <<04966>>55569000
                                                               <<04966>>55569100
         END                                                            55570000
                                                                        55572000
      ELSE IF NOT USING'ATTIO AND NOT TAPEMARK'WRITTEN THEN    <<04996>>55574000
         BEGIN                <<unlabelled tape...>>                    55576000
         SAVE'REEL:=TL'REELNUM;                                         55578000
                                                                        55580000
         IF WRITE'TAPE'MARK (PARMS'TEMPI'1) = FAILED THEN               55582000
            IF PARMS'TEMPI'1 <> EOTCODE THEN                            55584000
               RECOVER'ERROR (SR'TAPE'WRITE'FAIL)                       55586000
            ELSE                                                        55588000
               BEGIN                                                    55590000
               IF FINISH'REEL (TDBUF, TRUE) = FAILED THEN               55592000
                  RECOVER'ERROR (SR'TAPE'WRITE'FAIL);                   55594000
               IF TL'ZFIELD = 0 THEN                                    55596000
                  IF START'REEL (TDBUF, TAPE'REEL+1) = FAILED THEN      55598000
                     RECOVER'ERROR (SR'UNABLE'TO'START'REEL);           55600000
               END;                                                     55602000
                                                                        55604000
         IF SAVE'REEL <> TL'REELNUM THEN                                55606000
            SAVE'STATE (STATE'5);                                       55608000
         END;                                                           55610000
                                                                        55612000
                                                                        55614000
      IF GOOD'STORE THEN                                                55616000
         BEGIN                                                          55618000
         STORE'A'FILE:=GOOD;                                            55620000
         GOOD'COUNT:=GOOD'COUNT + 1D;                                   55622000
         SAVE'REEL:=TAPE'REEL;                                          55624000
         TAPE'REEL:=FIRST'REEL;                                         55626000
         IF SHOW'FLAG THEN SENDMESSAGE (M'STORED);                      55628000
         TAPE'REEL:=SAVE'REEL;                                          55630000
         IF SHOW'SECURITY'FLAG THEN                                     55632000
            SENDMESSAGE (M'SECURITY);                                   55634000
         IF SEEN'PURGE THEN                                             55634100
            BEGIN                                                       55634200
            G'PURGE'BIT := TRUE;                                        55634300
            UPDATE'GOOD'FILE;                                           55634400
            END;                                                        55634500
         END                                                            55636000
      ELSE                                                              55638000
         BEGIN                                                          55640000
         STORE'A'FILE:=FAILED;                                          55642000
         FAILED'COUNT:=FAILED'COUNT + 1D;                               55644000
         END;                                                           55646000
                                                                        55648000
      UNLOCK'CURRENT'FILE;                                              55650000
                                                                        55652000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        55654000
      IF DEBUGGING THEN                                                 55656000
         BEGIN                                                          55658000
         SEND;                                                          55660000
         END;                                                           55662000
$IF                           <<DEBUGGING CODE>>                        55664000
                                                                        55666000
      END <<STORE'A'FILE SUB>>;                                         55668000
$PAGE ";STORE=  FSTORE --- OUTER BLOCK"                                 55670000
                                                                        55672000
         <<The following code initializes the two integer               55674000
           pointers used for state saving/restoring...this              55676000
           code MUST be the first executable code of the                55678000
           routine!>>                                                   55680000
                                                                        55682000
         <<@FIRST'LOCAL is the DB address of the first                  55684000
           local worth storing.  S is the DB address of                 55686000
           of the first cell AFTER all the local storage.               55688000
           Then, S-@FIRST'LOCAL = length of locals storage, including   55690000
           arrays which is stored into LOCALS'LEN.                      55692000
                                                                        55694000
           Then, push S again, save it in @SAVE'LOCALS, and             55696000
           do an ADDS of LOCALS'LEN to allocate a storage space         55698000
           of equal size to the space occupied by the locals.           55700000
                                                                        55702000
           We are assured that MAXDATA will not be breached             55704000
           because of the call to ZSIZE in CXSTORE'RESTORE  >>          55706000
                                                                        55708000
                                                                        55710000
                                                                        55712000
   PUSH (S);                  <<get current DB-rel addr>>               55714000
   LOCALS'LEN:= TOS - @FIRST'LOCAL;                                     55716000
                                                                        55718000
         <<allocate the two arrays...>>                                 55720000
                                                                        55722000
   PUSH (S);                  <<get current DB-rel addr>>               55724000
   @SAVE'LOCALS:=TOS;                                                   55726000
   TOS:=LOCALS'LEN;                                                     55728000
   ALLOCATE'STACK'SPACE;      <<allocate space for locals>>             55730000
                                                                        55732000
   @FIRST'LOCAL'ARRAY := @FIRST'LOCAL;                                  55734000
                                                                        55736000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        55738000
   IF DEBUGGING THEN                                                    55740000
      BEGIN                                                             55742000
      SAY "Allocated space for local & tape label storage"              55744000
         ENDSAY;                                                        55746000
      SEND;                                                             55748000
      END;                                                              55750000
$IF                           <<DEBUGGING CODE>>                        55752000
$PAGE                                                                   55754000
                                                                        55756000
   INITIALIZE'FSTORE;                                                   55758000
                                                                        55760000
   IF USING'ATTIO THEN                                                  55762000
      IF ALLOCATE'BUFFERS = FAILED THEN                                 55764000
         BEGIN                                                          55766000
         USING'FILESYS:=TRUE;                                           55768000
         USING'ATTIO:=FALSE;                                            55770000
         TAPE'RECSIZE:=DEFAULT'TAPE'RECSIZE;                            55772000
         INITIALIZE'FSTORE;                                             55774000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        55776000
      IF DEBUGGING THEN                                                 55778000
         BEGIN                                                          55780000
         SAY "Failed to allocate XDS buffers!" ENDSAY;                  55782000
         SEND;                                                          55784000
         END;                                                           55786000
$IF                           <<DEBUGGING CODE>>                        55788000
         END;                                                           55790000
                                                                        55792000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        55794000
   IF DEBUGGING THEN                                                    55796000
      BEGIN                                                             55798000
      SAY "Using: " ENDSAY;                                             55800000
      IF USING'ATTIO THEN                                               55802000
         SAY "ATTIO" ENDSAY                                             55804000
      ELSE                                                              55806000
         SAY "FILESYS" ENDSAY;                                          55808000
      SEND;                                                             55810000
      END;                                                              55812000
$IF                           <<DEBUGGING CODE>>                        55814000
                                                                        55816000
                                                                        55818000
         <<------------------------------->>                            55820000
         << Now dump all disk files to    >>                            55822000
         << tape, one file per tape file. >>                            55824000
         <<------------------------------->>                            55826000
                                                                        55828000
   IF SHOW'FLAG THEN                                                    55830000
      BEGIN                                                             55832000
      SENDMESSAGE (M'BLANK'LINE);                                       55834000
      SENDMESSAGE (M'HEADING);                                          55836000
      SENDMESSAGE (M'BLANK'LINE);                                       55838000
      END;                                                              55840000
                                                                        55842000
   FILE'NUMBER:=1D;                                                     55844000
                                                                        55846000
   SAVE'STATE (STATE'6);                                                55848000
                                                                        55850000
   WHILE FILE'NUMBER <= FILES'TO'HANDLE DO                              55852000
      BEGIN                                                             55854000
                                                                        55856000
      STORE'A'FILE;                                                     55862000
                                                                        55864000
      FILE'NUMBER:=FILE'NUMBER + 1D;                                    55866000
                                                                        55868000
      END;                                                              55870000
                                                                        55872000
   LAST'FILE := TRUE;                                          <<06361>>55872100
                                                               <<06361>>55872200
         <<--------------------------------------------->>              55874000
         <<Wait for all io to complete                  >>              55876000
         <<--------------------------------------------->>              55878000
                                                                        55880000
   IF USING'ATTIO THEN                                                  55882000
      BEGIN                                                             55884000
      SAVE'REEL := TL'REELNUM;                                          55886000
      IF CHECK'IO'STATUS (WAIT'ALL) = FAILED THEN                       55888000
         RECOVER'ERROR (SR'TAPE'WRITE'FAIL);                            55890000
      END;                                                              55892000
                                                                        55894000
         <<--------------------------------------------->>              55908000
         <<All files have now been stored and unlocked. >>              55910000
         <<Close Logical reel now.                      >>              55912000
         <<--------------------------------------------->>              55914000
                                                                        55916000
                                                                        55918000
   FINISH'REEL (TDBUF, TRUE);                   <<end of final reel>>   55920000
                                                                        55922000
   IF T'NUM <> 0 THEN                                                   55924000
      FCLOSE (T'NUM, TAPE'CLOSE'DISP, 0);                      <<04726>>55926000
   T'NUM := 0;                                                          55928000
                                                                        55930000
   IF USING'ATTIO THEN RELEASE'BUFFERS;                                 55932000
                                                                        55934000
                                                                        55936000
END'FSTORE:                                                             55938000
                                                                        55940000
         <<copy local good/failed counts into globals...>>              55942000
                                                                        55944000
   FAILED'FILE'COUNT:=FAILED'COUNT;                                     55946000
   GOOD'FILE'COUNT:=GOOD'COUNT;                                         55948000
                                                                        55950000
   UNLOCK'FILES (ALL'FILES, 0);                                         55952000
                                                                        55954000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        55956000
   IF DEBUGGING THEN                                                    55958000
      BEGIN                                                             55960000
      SAY "END FSTORE" ENDSAY;                                          55962000
      SEND;                                                             55964000
      SEND;                                                             55966000
      END;                                                              55968000
$IF                           <<DEBUGGING CODE>>                        55970000
                                                                        55972000
   END <<FSTORE PROC>>;                                                 55974000
!CONTROL NOLIST      !LIST                                              60000000
$PAGE "[RESTORE]  IRESTORE --- produce list of files to be RESTOREd"    60001000
<<*****************************************************************>>   60002000
$CONTROL SEGMENT=IRESTORE                                               60003000
LOGICAL PROCEDURE IRESTORE (TDBUF);                                     60004000
         INTEGER ARRAY TDBUF;                                           60005000
         OPTION PRIVILEGED, UNCALLABLE;                                 60006000
                                                                        60007000
   BEGIN                                                                60008000
                                                                        60009000
                                                                        60010000
   DOUBLE ARRAY                                                         60011000
      GBUF'D      (0:G'RECSIZE/2);                                      60012000
                                                                        60013000
   DOUBLE                                                               60014000
      C'REC             := 0D,                                          60014100
      FIRST'FILE'ON'VOL := 0D;                                          60015000
                                                                        60016000
   INTEGER ARRAY                                                        60017000
      BUFFER  (0:D'BLOCKSIZE-1),                                        60018000
      CANDIDAT'BUF (0:CANDIDAT'RECSIZE-1),                              60019000
      GBUF        (*) = GBUF'D (0);                                     60020000
                                                                        60021000
   INTEGER                                                              60022000
      DIRECTORY'TAPE'RECSIZE := MAX'7970'RECSIZE,                       60023000
      DUMMY'I,                                                          60024000
      LEFT'OVER   := 0,                                                 60025000
      LEN'TAPE    := 0,                                                 60026000
      ML          := 0,                                                 60027000
      SAVX        := 0;                                                 60028000
                                                                        60029000
   LOGICAL                                                              60030000
      DONE        := FALSE,                                             60031000
      YES;                                                              60032000
                                                                        60033000
   BYTE ARRAY                                                           60034000
      TDBUF'      (*) = TDBUF (0);                                      60035000
                                                                        60036000
   EQUATE                                                               60037000
      MAX'DIRECTORY'TAPE'RECSIZE = MAX'7970'RECSIZE;                    60038000
                                                                        60039000
   LABEL                                                                60040000
      END'IRESTORE;                                                     60041000
                                                                        60042000
$PAGE "[RESTORE]  IRESTORE --- error handling subroutines"              60043000
   <<------------------------>>                                         60044000
   <<  FAIL                  >>                                         60045000
   <<------------------------>>                                         60046000
                                                                        60047000
   SUBROUTINE FAIL (ERRNUM);                                            60048000
            VALUE   ERRNUM;                                             60049000
            INTEGER ERRNUM;                                             60050000
      BEGIN                                                             60051000
                                                                        60052000
      UNLOCK'FILES (ALL'FILES, 0);                                      60053000
                                                                        60054000
      IF ERRNUM <> 0 THEN                                               60055000
         SENDMESSAGE (ERRNUM);                                          60056000
                                                                        60057000
      CLOSE'FILES (NO'FILE);                                            60058000
                                                                        60059000
      IRESTORE:=FAILED;                                                 60060000
                                                                        60061000
      GO END'IRESTORE;                                                  60062000
                                                                        60063000
      END <<FAIL SUB>>;                                                 60064000
                                                                        60065000
   <<------------------------>>                                         60066000
   <<  FILE'FAIL             >>                                         60067000
   <<------------------------>>                                         60068000
                                                                        60069000
   SUBROUTINE FILE'FAIL (FID, ERRNUM);                                  60070000
            VALUE   FID, ERRNUM;                                        60071000
            INTEGER FID, ERRNUM;                                        60072000
      BEGIN                                                             60073000
                                                                        60074000
      PRINT'FILE'ERROR (FID);                                           60075000
                                                                        60076000
      FAIL (ERRNUM);                                                    60077000
                                                                        60078000
      END <<FILE'FAIL SUB>>;                                            60079000
$PAGE "[RESTORE]  IRESTORE -- utility subroutines"                      60080000
                                                                        60081000
<<------------------------>>                                            60082000
<< EVALUATE               >>                                            60083000
<<------------------------>>                                            60084000
                                                                        60085000
SUBROUTINE EVALUATE(N);                                                 60086000
   VALUE N;                                                             60087000
   INTEGER N;                                                           60088000
BEGIN                                                                   60089000
   IF (N<>0) THEN FAIL(N);                                              60090000
END;                                                                    60091000
   <<---------------------->>                                           60092000
   <<  INCREMENT'REJECTED  >>                                           60093000
   <<---------------------->>                                           60094000
                                                                        60095000
   SUBROUTINE INCREMENT'REJECTED (SUBTYPE);                             60096000
            DOUBLE SUBTYPE;                                             60097000
                                                                        60098000
      BEGIN                                                             60099000
                                                                        60100000
      FILES'REJECTED:=FILES'REJECTED + 1D;                              60101000
                                                                        60102000
      SUBTYPE:=SUBTYPE + 1D;                                            60103000
                                                                        60104000
      END <<INCREMENT'REJECTED SUB>>;                                   60105000
$PAGE                                                                   60106000
   <<-------------------->>                                             60107000
   <<  ADD'FILE'TO'GOOD  >>                                             60108000
   <<-------------------->>                                             60109000
                                                                        60110000
   SUBROUTINE ADD'FILE'TO'GOOD;                                         60111000
                                                                        60112000
      BEGIN                                                             60113000
                                                                        60114000
      IF (FILES'SELECTED:=FILES'SELECTED + 1D) = 1D THEN                60115000
         FIRST'FILE'SELECTED:=FILES'ON'TAPE;                            60116000
                                                                        60117000
            <<build info for GOOD file...array consists of              60118000
              file#, file part, group part, acct part,                  60119000
              label address, disc ldev...>>                             60120000
                                                                        60121000
      FILL (GBUF, G'RECSIZE, 0);                                        60122000
                                                                        60123000
      GBUF'D(G'FILENUM'INX'D) := FILES'ON'TAPE;                         60124000
      GBUF'D(G'ADDRESS'INX'D) := FILE'ADDRESS;                          60125000
      GBUF  (G'LDEV'INX)      := FILE'LDEV;                             60126000
      MOVE GBUF(G'TITLE'INX) := TDBUF(ML), (3*FILE'PART'WORDS);         60127000
                                                                        60128000
      FILES'TO'HANDLE := FILES'TO'HANDLE+ 1D;                           60129000
                                                                        60130000
      FWRITE (G'NUM, GBUF, G'RECSIZE, 0);                               60131000
                                                                        60132000
      IF < THEN                                                         60133000
         FILE'FAIL (G'NUM, SR'G'NUM'ERROR)                              60134000
      ELSE IF > THEN                                                    60135000
         FAIL (RS'GOOD'FILE'FULL);                                      60136000
                                                                        60137000
      END <<ADD'FILE'TO'GOOD SUB>>;                                     60138000
$PAGE                                                                   60139000
   <<----------------------------->>                                    60140000
   <<  CHECK'FILE'ACCESS          >>                                    60141000
   <<----------------------------->>                                    60142000
                                                                        60143000
   LOGICAL SUBROUTINE CHECK'FILE'ACCESS;                                60144000
                                                                        60145000
            <<Returns GOOD if file is an accessible file, else          60146000
              a FAILED.                                                 60147000
                                                                        60148000
              File title is in LOOK'TITLE', LOOK'FILE',                 60149000
              LOOK'GROUP', LOOK'ACCT', and LOOK'LOCK'>>                 60150000
                                                                        60151000
      BEGIN                                                             60152000
                                                                        60153000
      CHECK'FILE'ACCESS:=FAILED;                                        60154000
                                                                        60155000
            <<well, the user wants this file...see if                   60156000
              he is allowed to RESTORE it into the                      60157000
              correct group & account (as determined                    60158000
              by the file's group & account and by                      60159000
              the GROUP/ACCT/LOCAL keywords)...>>                       60160000
                                                                        60161000
      IF SM'TOG OR LOCAL'FLAG OR SEEN'ACCT OR                           60162000
            (LOGON'ACCT'=LOOK'ACCT',(FILE'PART'SIZE) LAND               60163000
                (CAP'AM LOR SEEN'GROUP LOR                              60164000
                    (LOGON'GROUP'=LOOK'GROUP',(FILE'PART'SIZE))         60165000
                )                                                       60166000
            )                                                           60167000
            THEN                                                        60168000
         CHECK'FILE'ACCESS:=GOOD                                        60169000
                                                                        60170000
      ELSE                                                              60171000
         BEGIN                                                          60172000
         MOVE CURR'TITLE':=LOOK'TITLE',(MAX'STD'LEN);                   60173000
         SENDMESSAGE (M'CANT'RESTORE'THIS'FILE);                        60174000
         END;                                                           60175000
                                                                        60176000
      END <<CHECK'FILE'ACCESS SUB>>;                                    60177000
$PAGE                                                                   60177010
   <<----------------------------->>                                    60177020
   <<  CHECK'UNUSED'CANDIDAT      >>                                    60177030
   <<----------------------------->>                                    60177040
                                                                        60177050
   SUBROUTINE CHECK'UNUSED'CANDIDATS;                                   60177060
                                                                        60177061
      ! Tell user which files were not found on tape                    60177062
                                                                        60177063
      BEGIN                                                             60177070
      FCONTROL (CANDIDAT, REWIND, DUMMY'I);                             60177080
                                                                        60177090
      IF <> THEN                                                        60177100
         FILE'FAIL (CANDIDAT, RS'REWIND'CANDIDAT'FAIL);                 60177110
                                                                        60177120
      FREAD (CANDIDAT, CANDIDAT'BUF, CANDIDAT'RECSIZE);                 60177130
                                                                        60177140
      WHILE = DO                                                        60177150
         BEGIN                                                          60177160
         IF NOT LOGICAL (CANDIDAT'USED) THEN                            60177170
            BEGIN                                                       60177171
            MOVE LOOK'PATTERNS := CANDIDAT'BUF (FILE'PART'WORDS + 1),   60177172
                                     (LOOK'PATTERNS'LENGTH);            60177173
            SENDMESSAGE (M'NOT'ON'TAPE);                                60177180
            BAD'FILE'COUNT := BAD'FILE'COUNT + 1D;                      60177181
            END;                                                        60177190
         FREAD (CANDIDAT, CANDIDAT'BUF, CANDIDAT'RECSIZE);              60177280
         END;                                                           60177380
                                                                        60177390
      END;                                                              60177480
$PAGE                                                                   60178000
   <<----------------------------->>                                    60179000
   <<  CHECK'WANTED'FILE          >>                                    60180000
   <<----------------------------->>                                    60181000
                                                                        60182000
   LOGICAL SUBROUTINE CHECK'WANTED'FILE (P');                           60183000
            VALUE        P';                                            60184000
            BYTE POINTER P';                                            60185000
                                                                        60186000
            <<Returns GOOD if file is a wanted file, otherwise          60187000
              a FAILED...>>                                             60188000
                                                                        60189000
      BEGIN                                                             60190000
                                                                        60191000
$IF X1=ON THEN                <<Debugging code>>                        60192000
      IF DEBUG'DIR THEN                                                 60193000
         BEGIN                                                          60194000
         SAY "         check'wanted'file: " ENDSAY;                     60195000
         SAY P',(24) ENDSAY;                                            60196000
         SEND;                                                          60197000
         END;                                                           60198000
$IF                           <<Debugging code>>                        60199000
                                                                        60200000
      CHECK'WANTED'FILE:=FAILED;                                        60201000
                                                                        60202000
$IF X1=ON THEN                <<Debugging code>>                        60203000
      IF DEBUG'IRESTORE THEN                                            60204000
         BEGIN                                                          60205000
         SAY "Inject error into file title from tape? " ENDSAY;         60206000
         SEND;                                                          60207000
         AFFIRM (YES, FALSE);                                           60208000
         IF YES THEN                                                    60209000
            GO FAKE'ERR;                                                60210000
         END;                                                           60211000
$IF                           <<Debugging code>>                        60212000
                                                                        60213000
      FILL' (LOOK'TITLE', MAX'STD'LEN, 0);                              60214000
                                                                        60215000
      IF DISPLAY'3'TO'STANDARD (P', P'(8), P'(16), LOOK'TITLE',         60216000
                                ERROR'CODE) = FAILED THEN               60217000
         BEGIN                                                          60218000
FAKE'ERR:                                                               60219000
         PARMS'TEMPI'1:=@P';                                            60220000
         PARMS'TEMPI'2:=24;            <<length of title>>              60221000
         SENDMESSAGE (M'BAD'IRESTORE'TITLE);                            60222000
         RETURN;              <<Note: doesn't terminate!>>              60223000
         END;                                                           60224000
                                                                        60225000
      STANDARD'TO'3'DISPLAY (LOOK'TITLE',                               60226000
            LOOK'FILE', LOOK'GROUP', LOOK'ACCT', ERROR'CODE);           60227000
                                                                        60228000
            <<see if this title matches any title in                    60229000
              the CANDIDAT file...>>                                    60230000
                                                                        60231000
      C'REC := 0D;                                                      60232000
                                                                        60233000
      WHILE TRUE DO                 <<do until hit CANDIDAT eof>>       60237000
         BEGIN                                                          60238000
                                                                        60239000
               <<read: LOOK'ACCT', ..., LOOK'ACCT'PAT, ...>>            60240000
               <<and: NOT'ACCT'PAT...                     >>            60241000
                                                                        60242000
         FREADDIR (CANDIDAT, CANDIDAT'BUF, CANDIDAT'RECSIZE, C'REC);    60243000
                                                                        60244000
         IF < THEN                                                      60245000
            FILE'FAIL (CANDIDAT, RS'READ'CANDIDAT'FAIL);                60246000
                                                                        60247000
         IF > THEN                                                      60248000
            RETURN;                    <<failed to find match>>         60249000
                                                                        60250000
         C'REC := C'REC + 1D;                                           60250100
                                                                        60250200
         MOVE LOOK'LOCK := CANDIDAT'BUF (1), (FILE'PART'WORDS);         60251000
         MOVE LOOK'PATTERNS := CANDIDAT'BUF (FILE'PART'WORDS + 1),      60252000
                                (LOOK'PATTERNS'LENGTH);                 60253000
                                                                        60254000
$IF X1=ON THEN                <<Debugging code>>                        60255000
         IF DEBUG'DIR THEN                                              60256000
            BEGIN                                                       60257000
            SAY "            pattern: " ENDSAY;                         60258000
            SAY'PATTERN (LOOK'FILE'PAT);                                60259000
            SAY1 (".");                                                 60260000
            SAY'PATTERN (LOOK'GROUP'PAT);                               60261000
            SAY1 (".");                                                 60262000
            SAY'PATTERN (LOOK'ACCT'PAT);                                60263000
            SAY "  -  " ENDSAY;                                         60264000
            SAY'PATTERN (NOT'FILE'PAT);                                 60265000
            SAY1 (".");                                                 60266000
            SAY'PATTERN (NOT'GROUP'PAT);                                60267000
            SAY1 (".");                                                 60268000
            SAY'PATTERN (NOT'ACCT'PAT);                                 60269000
            SEND;                                                       60270000
            END;                                                        60271000
$IF                           <<Debugging code>>                        60272000
                                                                        60273000
         IF PATTERN'3'MATCH (P', P'(8), P'(16),                         60274000
                  LOOK'FILE'PAT, LOOK'GROUP'PAT, LOOK'ACCT'PAT,         60275000
                  ERROR'CODE)                                           60276000
               = GOOD THEN                                              60277000
            BEGIN                   <<it matches...>>                   60278000
$IF X1=ON THEN                <<Debugging code>>                        60279000
            IF DEBUG'DIR THEN                                           60280000
               BEGIN                                                    60281000
               SAY "               matched! " ENDSAY;                   60282000
               SEND;                                                    60283000
               END;                                                     60284000
$IF                           <<Debugging code>>                        60285000
            IF NOT'FILE'PAT <> 0 THEN                                   60286000
               BEGIN                <<check vs exception title>>        60287000
               IF PATTERN'3'MATCH (P', P'(8), P'(16),                   60288000
                             NOT'FILE'PAT, NOT'GROUP'PAT,               60289000
                             NOT'ACCT'PAT, ERROR'CODE)                  60290000
                     = GOOD THEN                                        60291000
                  BEGIN                                                 60292000
$IF X1=ON THEN                <<Debugging code>>                        60293000
      IF DEBUG'DIR THEN                                                 60294000
                     BEGIN                                              60295000
                     SAY "   " ENDSAY;                                  60296000
                     SAY "         matches exception title" ENDSAY;     60297000
                     SEND;                                              60298000
                     END;                                               60299000
$IF                           <<Debugging code>>                        60300000
                  END                                                   60301000
               ELSE                                                     60302000
                  BEGIN                                                 60303000
                  CHECK'WANTED'FILE:=GOOD;                              60304000
                  IF NOT LOGICAL (CANDIDAT'USED) THEN                   60304100
                     BEGIN                                              60304200
                     CANDIDAT'USED := TRUE;                             60304300
                     FUPDATE (CANDIDAT, CANDIDAT'BUF, CANDIDAT'RECSIZE);60304400
                     END;                                               60304500
                  RETURN;           <<we like it!>>                     60305000
                  END                                                   60306000
               END                                                      60307000
                                                                        60308000
            ELSE                                                        60309000
               BEGIN                                                    60310000
               CHECK'WANTED'FILE:=GOOD;                                 60311000
                  IF NOT LOGICAL (CANDIDAT'USED) THEN                   60311100
                     BEGIN                                              60311200
                     CANDIDAT'USED := TRUE;                             60311300
                     FUPDATE (CANDIDAT, CANDIDAT'BUF, CANDIDAT'RECSIZE);60311400
                     END;                                               60311500
               RETURN;                                                  60312000
               END;                                                     60313000
                                                                        60314000
            END;                                                        60315000
         END;                                                           60316000
                                                                        60317000
      END <<CHECK'WANTED'FILE SUB>>;                                    60318000
$PAGE                                                                   60319000
   <<----------------------------->>                                    60320000
   <<  GET'PRIOR'VOLUME           >>                                    60321000
   <<----------------------------->>                                    60322000
                                                                        60323000
   DOUBLE SUBROUTINE GET'PRIOR'VOLUME;                                  60324000
                                                                        60325000
      BEGIN                                                             60326000
                                                                        60327000
      ERROR'CODE:=0;                                                    60328000
                                                                        60329000
      IF LABELED THEN                                                   60330000
         GET'PRIOR'VOLUME:=GET'PRIOR'LABELED'VOLUME                     60331000
      ELSE                                                              60332000
         GET'PRIOR'VOLUME:=GET'PRIOR'UNLABELED'VOLUME;                  60333000
                                                                        60334000
      IF ERROR'CODE <> 0 THEN                                           60335000
         FAIL (0);            <<message already printed>>               60336000
                                                                        60337000
      END <<GET'PRIOR'VOLUME SUB>>;                                     60338000
$PAGE                                                                   60339000
   <<----------------------------->>                                    60340000
   <<  HANDLE'DIRECTORY'RECORD    >>                                    60341000
   <<----------------------------->>                                    60342000
                                                                        60343000
   SUBROUTINE HANDLE'DIRECTORY'RECORD;                                  60344000
                                                                        60345000
      BEGIN                                                             60346000
                                                                        60347000
$IF X1=ON THEN                <<Debugging code>>                        60348000
      IF DEBUG'DIR THEN                                                 60349000
         BEGIN                                                          60350000
         SAY "   HANDLE'DIRECTORY'RECORD" ENDSAY;                       60351000
         SEND;                                                          60352000
         END;                                                           60353000
$IF                           <<Debugging code>>                        60354000
                                                                        60355000
      IF (LEN'TAPE MOD TAPE'DIR'RECSIZE) <> 0 THEN                      60356000
         FAIL (RS'T'BAD'RECSIZE);       !HELP BAD MESSAGE               60357000
                                                                        60358000
      IF LEN'TAPE > TAPE'RECSIZE THEN                                   60359000
         FAIL (RS'T'BAD'BLOCKSIZE);                                     60360000
                                                                        60361000
      ML:=-TAPE'DIR'RECSIZE;                                            60362000
                                                                        60363000
$IF X1=ON THEN                <<Debugging code>>                        60364000
      IF DEBUG'DIR THEN                                                 60365000
         BEGIN                                                          60366000
         SAY "      ML = " ENDSAY; SAYNUM (ML);                         60367000
         SAY ", LEN'TAPE = " ENDSAY; SAYNUM (LEN'TAPE);                 60368000
         SEND;                                                          60369000
         END;                                                           60370000
$IF                           <<Debugging code>>                        60371000
                                                                        60372000
      WHILE (ML:=ML+TAPE'DIR'RECSIZE) < LEN'TAPE DO                     60373000
         BEGIN                   <<process directory record>>           60374000
                                                                        60375000
         FILES'ON'TAPE:=FILES'ON'TAPE + 1D;                             60376000
                                                                        60377000
$IF X1=ON THEN                <<Debugging code>>                        60378000
         IF DEBUG'DIR THEN                                              60379000
            BEGIN                                                       60380000
            SAY "      DIR: " ENDSAY;                                   60381000
            SAY TDBUF'(ML*2),(24) ENDSAY;                               60382000
            SEND;                                                       60383000
            END;                                                        60384000
$IF                           <<Debugging code>>                        60385000
                                                                        60386000
         IF CHECK'WANTED'FILE (TDBUF'(ML*2)) = GOOD THEN                60387000
            BEGIN                                                       60388000
$IF X1=ON THEN                <<Debugging code>>                        60389000
            IF DEBUG'DIR THEN                                           60390000
               BEGIN                                                    60391000
               SAY "         want the file! " ENDSAY;                   60392000
               SEND;                                                    60393000
               END;                                                     60394000
$IF                           <<Debugging code>>                        60395000
                                                                        60396000
            IF CHECK'FILE'ACCESS = FAILED THEN                          60397000
               INCREMENT'REJECTED (FILES'REJ'ACCESS)                    60398000
            ELSE                                                        60399000
               ADD'FILE'TO'GOOD;                                        60400000
            END                                                         60401000
                                                                        60402000
         ELSE                                                           60403000
            INCREMENT'REJECTED (FILES'REJ'TITLE);                       60404000
                                                                        60405000
         END;                                                           60406000
                                                                        60407000
                                                                        60408000
      ML := 0;                                                          60409000
      WHILE ML < LEN'TAPE DO                                            60410000
         IF LEN'TAPE - ML + LEFT'OVER >= D'BLOCKSIZE THEN               60411000
            BEGIN                                                       60412000
            MOVE BUFFER (LEFT'OVER) := TDBUF (ML),                      60413000
                   (D'BLOCKSIZE - LEFT'OVER);                           60414000
            FWRITE (D'NUM, BUFFER, D'BLOCKSIZE, 0);                     60415000
            IF < THEN FAIL (RS'D'FILE'ERROR)                            60416000
            ELSE IF > THEN FAIL (RS'EOF'D'FILE);                        60417000
            ML := ML + D'BLOCKSIZE - LEFT'OVER;                         60418000
            LEFT'OVER := 0;                                             60419000
            END                                                         60420000
         ELSE                                                           60421000
            BEGIN                                                       60422000
            MOVE BUFFER (LEFT'OVER) := TDBUF (ML), (LEN'TAPE - ML);     60423000
            LEFT'OVER := LEFT'OVER + LEN'TAPE - ML;                     60424000
            ML := LEN'TAPE;                                             60425000
            END;                                                        60426000
                                                                        60427000
$IF X1=ON THEN                <<Debugging code>>                        60428000
      IF DEBUG'DIR THEN                                                 60429000
         BEGIN                                                          60430000
         SAY "   END HANDLE'DIRECTORY" ENDSAY;                          60431000
         SEND;                                                          60432000
         END;                                                           60433000
$IF                           <<Debugging code>>                        60434000
                                                                        60435000
      END <<HANDLE'DIRECTORY'RECORD SUB>>;                              60436000
$PAGE                                                                   60437000
   <<----------------------->>                                          60438000
   <<  INITIALIZE'IRESTORE  >>                                          60439000
   <<----------------------->>                                          60440000
                                                                        60441000
   SUBROUTINE INITIALIZE'IRESTORE;                                      60442000
                                                                        60443000
      BEGIN                                                             60444000
                                                                        60445000
$IF X1=ON THEN                <<Debugging code>>                        60446000
      IF DEBUGGING THEN                                                 60447000
         BEGIN                                                          60448000
         SAY "Started IRESTORE,  # of CANDIDAT records: " ENDSAY;       60449000
         SAYDNUM (C'REC'COUNT);                                         60450000
         SEND;                                                          60451000
         END;                                                           60452000
$IF                           <<Debugging code>>                        60453000
                                                                        60454000
      IF TAPE'RECSIZE > MAX'DIRECTORY'TAPE'RECSIZE THEN                 60455000
         DIRECTORY'TAPE'RECSIZE := MAX'DIRECTORY'TAPE'RECSIZE           60456000
      ELSE                                                              60457000
         DIRECTORY'TAPE'RECSIZE := TAPE'RECSIZE;                        60458000
                                                                        60459000
      FILES'ON'TAPE := -1D;                                             60460000
      IRESTORE:=GOOD;                                                   60461000
                                                                        60462000
      END <<INITIALIZE'IRESTORE SUB>>;                                  60463000
$PAGE                                                                   60464000
   <<----------------->>                                                60465000
   <<  POSITION'TAPE  >>                                                60466000
   <<----------------->>                                                60467000
                                                                        60468000
   SUBROUTINE POSITION'TAPE;                                            60469000
                                                                        60470000
      BEGIN                                                             60471000
                                                                        60472000
      IF LABELED THEN                                                   60473000
         RETURN;                                                        60474000
                                                                        60475000
      IF NOT REEL'1'MOUNTED THEN                                        60476000
         RETURN;                                                        60477000
                                                                        60478000
      ISSUE'SKIP (TRUE);                                                60479000
      IF ERROR'CODE <> 0 THEN                                           60480000
         FILE'FAIL (T'NUM, RS'T'FSF'FAIL);                              60481000
                                                                        60482000
      END <<POSITION'TAPE SUB>>;                                        60483000
$PAGE "[RESTORE]  IRESTORE --- outer block"                             60484000
   <<--------------------------------------------------------->>        60485000
   <<   OUTER BLOCK OF IRESTORE                               >>        60486000
   <<--------------------------------------------------------->>        60487000
                                                                        60488000
   INITIALIZE'IRESTORE;                                                 60489000
                                                                        60490000
   POSITION'TAPE;                                                       60491000
                                                                        60492000
                                                                        60493000
         <<at this point, the CANDIDAT file has C'REC'COUNT records,    60494000
           each of which is a single fileset name (with or              60495000
           without wildcards.  We now proceed to read the               60496000
           tape directory and compare each file title in the            60497000
           directory to the filesets in CANDIDAT.  As soon as           60498000
           a file title matches ANY fileset name in CANDIDAT,           60499000
           it is written to the GOOD file (and, therefore, is           60500000
           going to be RESTOREd later on). >>                           60501000
                                                                        60502000
                                                                        60503000
         <<loop thru tape directory...>>                                60504000
                                                                        60505000
                                                                        60506000
                                                                        60507000
   DONE:=FALSE;                                                         60508000
                                                                        60509000
   WHILE NOT DONE DO                                                    60510000
      BEGIN                                                             60511000
                                                                        60512000
      CHECK'BREAK;            <<wont come back if break sensed>>        60513000
                                                                        60514000
      ISSUE'READ (TDBUF, DIRECTORY'TAPE'RECSIZE, TRUE);                 60515000
      LEN'TAPE := READ'TAPE'LEN;                                        60516000
                                                                        60517000
      IF ERROR'CODE <> 0 THEN                                           60518000
         FILE'FAIL (T'NUM, RS'T'READ'DIR'FAIL);                         60519000
                                                                        60520000
      IF READ'TAPE'EOF THEN                                             60521000
         BEGIN                                                          60522000
            IF LABELED THEN                                             60523000
               IF NEXTTAPEFILE(T'NUM) <> 0 THEN                         60524000
                  FILE'FAIL (T'NUM, RS'T'READ'DIR'FAIL);                60525000
            DONE := TRUE;                                               60526000
         END;                                                           60527000
                                                                        60528000
$IF X1=ON THEN                <<Debugging code>>                        60529000
      IF DEBUGGING THEN                                                 60530000
         BEGIN                                                          60531000
         SAY "READ LEN=" ENDSAY;                                        60532000
         SAYNUM (LEN'TAPE);                                             60533000
         SAY ", TEXT = " ENDSAY;                                        60534000
         SEND;                                                          60535000
         SAY TDBUF',(80) ENDSAY;                                        60536000
         SEND;                                                          60537000
         END;                                                           60538000
$IF                           <<Debugging code>>                        60539000
                                                                        60540000
                                                                        60541000
      IF NOT DONE THEN                                                  60542000
         HANDLE'DIRECTORY'RECORD;                                       60543000
                                                                        60544000
$IF X1=ON THEN                <<Debugging code>>                        60545000
      IF DEBUGGING THEN                                                 60546000
         BEGIN                                                          60547000
         SAY "Back to first main loop in IRESTORE..." ENDSAY;           60548000
         SEND;                                                          60549000
         SAY "DONE = " ENDSAY;                                          60550000
         SAYNUM (DONE.(15:01));                                         60551000
         SEND;                                                          60552000
         END;                                                           60553000
$IF                           <<Debugging code>>                        60554000
                                                                        60555000
      END;                                                              60556000
                                                                        60557000
$PAGE                                                                   60558000
                                                                        60559000
   IF LEFT'OVER > 0 THEN                                                60560000
      BEGIN                                                             60561000
      FWRITE (D'NUM, BUFFER, LEFT'OVER, 0);                             60562000
      IF < THEN FAIL (RS'D'FILE'ERROR)                                  60563000
      ELSE IF > THEN FAIL (RS'EOF'D'FILE);                              60564000
      END;                                                              60565000
                                                                        60566000
$IF X1=ON THEN                <<Debugging code>>                        60567000
   IF DEBUGGING THEN                                                    60568000
      BEGIN                                                             60569000
      SAY "#FILES ON TAPE = " ENDSAY;                                   60570000
      SAYDNUM (FILES'ON'TAPE);                                          60571000
      SAY ", FIRST'FILE'SELECTED = " ENDSAY;                            60572000
      SAYDNUM (FIRST'FILE'SELECTED);                                    60573000
      FIRST'FILE'ON'VOL := DOUBLE (TL'FILEINX);                         60574000
      SAY ", FIRST'FILE'ON'VOL = " ENDSAY;                              60575000
      SAYDNUM (FIRST'FILE'ON'VOL);                                      60576000
      SEND;                                                             60577000
      SAY "#SELECTED = " ENDSAY;                                        60578000
      SAYDNUM (FILES'SELECTED);                                         60579000
      SAY ", #REJECTED = " ENDSAY;                                      60580000
      SAYDNUM (FILES'REJECTED);                                         60581000
      SEND;                                                             60582000
      SAY "   ACCESS   = " ENDSAY; SAYDNUM (FILES'REJ'ACCESS);SEND;     60583000
      SAY "   RELOAD   = " ENDSAY; SAYDNUM (FILES'REJ'RELOAD);SEND;     60584000
      SAY "   TITLE    = " ENDSAY; SAYDNUM (FILES'REJ'TITLE);SEND;      60585000
      END;                                                              60586000
$IF                           <<Debugging code>>                        60587000
                                                                        60588000
   CHECK'UNUSED'CANDIDATS;                                              60588100
                                                                        60589000
   FIRST'FILE'ON'VOL := DOUBLE (TL'FILEINX+TL'SPANTOG);                 60590000
                                                                        60591000
   IF SEEN'STARTHERE THEN                                               60592000
      BEGIN                                                             60593000
         REWIND'GOOD'FILE;                                              60594000
         READ'GOOD'FILE;                                                60595000
         WHILE = AND (GBUF'D (G'FILENUM'INX'D) < FIRST'FILE'ON'VOL) DO  60596000
            BEGIN                                                       60597000
               G'IGNORE'bit := TRUE;                                    60598000
               UPDATE'GOOD'FILE;                                        60599000
               READ'GOOD'FILE;                                          60600000
            END;                                                        60601000
         IF > THEN FAIL (RS'NO'FILES'AFTER'HERE);                       60602000
      END                                                               60603000
                                                                        60604000
   ELSE IF FILES'SELECTED > 0D THEN                                     60605000
      BEGIN                                                             60606000
         WHILE (FIRST'FILE'SELECTED<FIRST'FILE'ON'VOL) DO               60607000
                                                                        60608000
            FIRST'FILE'ON'VOL := GET'PRIOR'VOLUME;                      60609000
                                                                        60610000
         IF FIRST'FILE'ON'VOL < 0D THEN                                 60611000
            FAIL (RS'T'OP'COULD'NOT'FIND'TAPE);                         60612000
         SENDMESSAGE (M'RESTORE'PREVIEW);                               60613000
                                                                        60614000
         IF NOT LABELED AND TL'SPANTOG THEN                             60615000
            BEGIN                                                       60616000
            ISSUE'SKIP (TRUE);                                          60617000
            IF ERROR'CODE <> 0 THEN FAIL (RS'SKIPPING'PARTIAL'FILE);    60618000
            END;                                                        60619000
      END;                                                              60620000
                                                                        60621000
END'IRESTORE:                                                           60622000
                                                                        60623000
$IF X1=ON THEN                <<Debugging code>>                        60624000
   IF DEBUGGING THEN                                                    60625000
      BEGIN                                                             60626000
      SAY "END OF IRESTORE PROC" ENDSAY;                                60627000
      SEND;                                                             60628000
      END;                                                              60629000
$IF                           <<Debugging code>>                        60630000
                                                                        60631000
   END <<IRESTORE PROC>>;                                               60632000
$PAGE "[RESTORE]  GET'NEXT'VOLUME --- get correct continuation tape"    60633000
$CONTROL SEGMENT=IRESTORE                                               60634000
<<*****************************************************************>>   60635000
INTEGER PROCEDURE GET'NEXT'VOLUME (DESTINATION, DISTANCE);              60636000
         VALUE DESTINATION;                                             60637000
         DOUBLE DESTINATION, DISTANCE;                                  60638000
         OPTION PRIVILEGED, UNCALLABLE;                                 60639000
      <<If the reel switch fails, FAILED is returned, otherwise         60640000
        GOOD.  Two types of errors occur: (1)  wrong tape was           60641000
        mounted;  (2) bad tape was mounted.  >>                         60642000
   BEGIN                                                                60643000
                                                                        60644000
                                                                        60645000
   INTEGER ARRAY                                                        60646000
      ITMP        (0:3),                                                60647000
      SAVE'TAPE'LABEL (0:TAPE'LABEL'SIZE);                              60648000
                                                                        60649000
   INTEGER                                                              60650000
      LEN,                                                              60651000
      REPLY;                                                            60652000
                                                                        60653000
   BYTE ARRAY                                                           60654000
      ITMP'       (*) = ITMP;                                           60655000
                                                                        60656000
   DOUBLE ARRAY                                                         60657000
      ITMP'D      (*) = ITMP;                                           60658000
                                                                        60659000
   LABEL                                                                60660000
      END'PROC;                                                         60661000
                                                                        60662000
   DEFINE                                                               60663000
      NEWREEL     = ITMP(0) #;                                          60664000
                                                                        60665000
   <<-------------------------->>                                       60666000
   SUBROUTINE FAIL (N); VALUE N; INTEGER N;                             60667000
      BEGIN                                                             60668000
                                                                        60669000
      MOVE TAPE'LABEL:=SAVE'TAPE'LABEL,(TAPE'LABEL'SIZE);               60670000
                                                                        60671000
      IF N <> 0 THEN                                                    60672000
         SENDMESSAGE (N);                                               60673000
                                                                        60674000
      GET'NEXT'VOLUME:=N;                                               60675000
                                                                        60676000
      GO END'PROC;                                                      60677000
                                                                        60678000
      END <<FAIL SUB>>;                                                 60679000
   <<-------------------------->>                                       60680000
                                                                        60681000
   GET'NEXT'VOLUME:=0;                                                  60682000
                                                                        60683000
   IF USING'ATTIO THEN                                                  60684000
      WAIT'FOR'ALL'ATTIO;                                               60685000
                                                                        60686000
   NEWREEL:=TL'REELNUM+1;                                               60687000
   TL'REELNUM:=NEWREEL;                                                 60688000
                                                                        60689000
   MOVE ITMP:=TL'REELNUM,(4);    <<reel, date, time>>                   60690000
                                                                        60691000
   FCONTROL (T'NUM, REWIND'UNLOAD, LEN);  <<rewind old tape>>           60692000
                                                                        60693000
   IF <> THEN                                                           60694000
      FAIL (RS'T'REWIND'FAIL);                                          60695000
                                                                        60696000
   FFILEINFO (T'NUM, ITEM'LDEV, TAPE'LDEV);                             60697000
   IF <> THEN                                                           60698000
      FAIL (RS'T'FGETINFO'FAIL);                                        60699000
                                                                        60700000
   MOVE SAVE'TAPE'LABEL:=TAPE'LABEL,(TAPE'LABEL'SIZE);                  60701000
                                                                        60702000
         <<ask for continuation reel...>>                               60703000
                                                                        60704000
   GENMSG (1, 20, %11000, NEWREEL, TAPE'LDEV, , , , 0);                 60705000
                                                                        60706000
NEXT:                                                                   60707000
                                                                        60708000
   ISSUE'READ (TAPE'LABEL, TAPE'LABEL'SIZE+1, TRUE);                    60709000
                                                                        60710000
   IF READ'TAPE'EOF THEN                                                60711000
      ISSUE'READ (TAPE'LABEL, TAPE'LABEL'SIZE+1, TRUE);                 60712000
                                                                        60713000
   IF READ'TAPE'EOF THEN                                                60714000
      ISSUE'READ (TAPE'LABEL, TAPE'LABEL'SIZE+1, TRUE);                 60715000
                                                                        60716000
   LEN := READ'TAPE'LEN;                                                60717000
                                                                        60718000
   IF ERROR'CODE <> 0 THEN                                              60719000
      FAIL (RS'T'READ'SR'LABEL);                                        60720000
                                                                        60721000
   IF READ'TAPE'EOF OR LEN <> TAPE'LABEL'SIZE OR                        60722000
                       TAPE'LABEL' <> LABELTEXT THEN                    60723000
      BEGIN                            <<wrong tape mounted>>           60724000
      SENDMESSAGE (SR'NOT'A'STORE'RESTORE'TAPE,,TRUE);                  60725000
WRONGTAPE:                                                              60726000
      PARMS'TEMPI'1 := NEWREEL;                                         60727000
      PARMS'TEMPI'2 := ITMP (1);                                        60728000
      PARMS'TEMPD'1 := ITMP'D (1);                                      60729000
      SENDMESSAGE (M'TAPE'DESIRED,,TRUE);                               60730000
      FCONTROL (T'NUM, REWIND'UNLOAD, LEN);                             60731000
            <<is another reel available?>>                              60732000
      GENMSG (1, 10, %10000, TAPE'LDEV, , , , , 0, 1, @REPLY);          60733000
      IF REPLY=0 THEN                                                   60734000
         FAIL (RS'T'OP'COULD'NOT'FIND'TAPE);                            60735000
      GOTO NEXT;                                                        60736000
      END;                                                              60737000
                                                                        60738000
   IF (TL'DATE' <> ITMP' (2), (6)) LOR          <<checks: date,time>>   60739000
      ((DESTINATION = 0D) LAND (NEWREEL <> TL'REELNUM)) LOR             60740000
      ((DESTINATION <> 0D) LAND                                         60741000
         (DOUBLE (TL'FILEINX + TL'SPANTOG) > DESTINATION)) THEN         60742000
                                                                        60743000
      BEGIN                                                             60744000
      PARMS'TEMPI'1 := TL'REELNUM;                                      60745000
      PARMS'TEMPI'2 := TL'DATE;                                         60746000
      PARMS'TEMPD'1'1 := TL'HHMM;                                       60747000
      PARMS'TEMPD'1'2 := TL'SSTT;                                       60748000
      SENDMESSAGE (M'REEL'SUPPLIED,,TRUE);                              60749000
      GO WRONGTAPE;                                                     60750000
      END;                                                              60751000
                                                                        60752000
   ISSUE'SKIP (TRUE);                                                   60753000
   IF ERROR'CODE <> 0 THEN                                              60754000
      FAIL (RS'T'FSF'FAIL);                                             60755000
                                                                        60756000
   DISTANCE := DESTINATION - DOUBLE (TL'FILEINX);                       60757000
END'PROC:                                                               60758000
   END <<GET'NEXT'VOLUME PROC>> ;                                       60759000
$PAGE "[RESTORE]  GET'PRIOR'LABELED'VOLUME"                             60760000
!CONTROL LIST        !LIST                                              60761000
$CONTROL SEGMENT=IRESTORE                                               60762000
<<*****************************************************************>>   60763000
DOUBLE PROCEDURE GET'PRIOR'LABELED'VOLUME;                              60764000
         OPTION PRIVILEGED,UNCALLABLE;                                  60765000
   BEGIN                                                                60766000
                                                                        60767000
                                                                        60768000
   INTEGER ARRAY                                                        60769000
      ITMP        (0:5),                                                60770000
      SAVE'TAPE'LABEL (0:TAPE'LABEL'SIZE);                              60771000
                                                                        60772000
   INTEGER                                                              60773000
      LEN,                                                              60774000
      REPLY;                                                            60775000
                                                                        60776000
   LOGICAL                                                              60777000
      DONE        := FALSE;                                             60778000
                                                                        60779000
   BYTE ARRAY                                                           60780000
      ITMP'       (*) = ITMP (0);                                       60781000
                                                                        60782000
   LABEL                                                                60783000
      END'PROC;                                                         60784000
                                                                        60785000
   DEFINE                                                               60786000
      PREVREEL    = ITMP(0) #;                                          60787000
                                                                        60788000
   <<---------------------------->>                                     60789000
   SUBROUTINE FAIL (N); VALUE N; INTEGER N;                             60790000
      BEGIN                                                             60791000
                                                                        60792000
      MOVE TAPE'LABEL:=SAVE'TAPE'LABEL,(TAPE'LABEL'SIZE);               60793000
                                                                        60794000
      IF N <> 0 THEN                                                    60795000
         SENDMESSAGE (N);                                               60796000
                                                                        60797000
      GET'PRIOR'LABELED'VOLUME := -1D;                                  60798000
                                                                        60799000
      GO END'PROC;                                                      60800000
                                                                        60801000
      END <<FAIL SUB>>;                                                 60802000
   <<----------------------------->>                                    60803000
   SUBROUTINE ASK'FOR'ANOTHER'REEL;                                     60804000
      BEGIN                                                             60805000
            <<are previous reels available?>>                           60806000
                                                                        60807000
      MOVE TAPE'LABEL:=SAVE'TAPE'LABEL,(TAPE'LABEL'SIZE);               60808000
                                                                        60809000
      GENMSG (1, 10, %10000, TAPE'LDEV, , , , , 0, 1, @REPLY);          60810000
                                                                        60811000
      IF REPLY = 0 THEN                                                 60812000
         FAIL (RS'T'OP'COULD'NOT'FIND'TAPE);                            60813000
                                                                        60814000
      END <<ASK'FOR'ANOTHER'REEL SUB>>;                                 60815000
   <<----------------------------->>                                    60816000
                                                                        60817000
                                                                        60818000
   PREVREEL:=TL'REELNUM-1;                                              60819000
   MOVE ITMP(1):=TL'IIBID, (2);                                         60820000
   MOVE ITMP(3):=TL'DATE, (3);                                          60821000
                                                                        60822000
   FGETINFO (T'NUM, , TAPE'FOPTIONS, TAPE'AOPTIONS);                    60823000
   IF <> THEN                                                           60824000
      FAIL (RS'T'FGETINFO'FAIL);                                        60825000
   FFILEINFO (T'NUM, ITEM'LDEV, TAPE'LDEV);                             60825100
   IF <> THEN                                                           60825200
      FAIL (RS'T'FGETINFO'FAIL);                                        60825300
                                                                        60826000
   MOVE SAVE'TAPE'LABEL:=TAPE'LABEL,(TAPE'LABEL'SIZE);                  60827000
                                                                        60828000
   DONE:=FALSE;                                                         60829000
                                                                        60830000
   WHILE NOT DONE DO                                                    60831000
      BEGIN                                                             60832000
      REELSWITCH (TAPE'LDEV, -PREVREEL);                                60833000
      IF < THEN FAIL (RS'MOUNT'PREV'FAIL);                              60834000
                                                                        60835000
      FREADLABEL (T'NUM, TAPE'LABEL, TAPE'LABEL'SIZE);                  60836000
                                                                        60837000
      IF <> THEN                                                        60838000
         FAIL (RS'T'READ'SR'LABEL);                                     60839000
                                                                        60840000
      IF TAPE'LABEL' <> LABELTEXT THEN                                  60841000
         ASK'FOR'ANOTHER'REEL                                           60842000
                                                                        60843000
      ELSE                                                              60844000
         BEGIN             <<examine the label...>>                     60845000
!        DO                                                             60846000
!           BEGIN                                                       60847000
!           LEN:=FREAD (T'NUM, ITMP, 2);      <<SHORT READ>>            60848000
!           REOPEN'FILE (T'NUM,                                         60849000
!                        TAPE'NAME, TAPE'FOPTIONS, TAPE'AOPTIONS,       60850000
!                        4096);                                         60851000
!           END                                                         60852000
!        UNTIL                                                          60853000
!           PREVREEL = 1;              <<PAST DIR & CONT>>              60854000
                                                                        60855000
         IF TL'IIBID' <> ITMP'(2),(4) THEN                              60856000
            ASK'FOR'ANOTHER'REEL                                        60857000
         ELSE IF TL'DATE' <> ITMP'(6),(6) THEN                          60858000
            ASK'FOR'ANOTHER'REEL                                        60859000
         ELSE IF TL'REELNUM > PREVREEL THEN                             60860000
            ASK'FOR'ANOTHER'REEL                                        60861000
         ELSE                                                           60862000
            DONE:=TRUE;                                                 60863000
                                                                        60864000
         END <<apparently valid label>>;                                60865000
      END <<while not done loop>>;                                      60866000
                                                                        60867000
   IF DOUBLE(TL'FILEINX + TL'SPANTOG) <= FIRST'FILE'SELECTED THEN       60868000
      BEGIN    <<this tape is ok - position tape>>                      60869000
         IF TL'REELNUM <> 1 THEN                                        60870000
            BEGIN                           ! skip over file continuatio60871000
               NEXTTAPEFILE (T'NUM);                                    60872000
               IF < THEN FAIL(RS'MOUNT'PREV'FAIL);                      60873000
               IF > THEN ASK'FOR'ANOTHER'REEL;                          60874000
            END;                                                        60875000
                                                                        60876000
         NEXTTAPEFILE (T'NUM);                                          60877000
         IF < THEN FAIL(RS'MOUNT'PREV'FAIL);                            60878000
         IF > THEN ASK'FOR'ANOTHER'REEL;                                60879000
      END;                                                              60880000
                                                                        60881000
   GET'PRIOR'LABELED'VOLUME:=DOUBLE(TL'FILEINX+TL'SPANTOG);             60882000
                                                                        60883000
END'PROC:                                                               60884000
                                                                        60885000
   END <<GET'PRIOR'LABELED'VOLUME PROC>>;                               60886000
!CONTROL NOLIST      !LIST                                              60887000
$PAGE "[RESTORE]  GET'PRIOR'UNLABELED'VOLUME"                           60888000
$CONTROL SEGMENT=IRESTORE                                               60889000
<<*****************************************************************>>   60890000
DOUBLE PROCEDURE GET'PRIOR'UNLABELED'VOLUME;                            60891000
         OPTION PRIVILEGED,UNCALLABLE;                                  60892000
   BEGIN                                                                60893000
                                                                        60894000
                                                                        60895000
   INTEGER ARRAY                                                        60896000
      ITMP        (0:5),                                                60897000
      SAVE'TAPE'LABEL (0:TAPE'LABEL'SIZE);                              60898000
                                                                        60899000
   INTEGER                                                              60900000
      DUMMY,                                                            60901000
      LEN,                                                              60902000
      REPLY;                                                            60903000
                                                                        60904000
   LOGICAL                                                              60905000
      DONE;                                                             60906000
                                                                        60907000
   BYTE ARRAY                                                           60908000
      ITMP'       (*) = ITMP (0);                                       60909000
                                                                        60910000
   LABEL                                                                60911000
      END'PROC;                                                         60912000
                                                                        60913000
   DEFINE                                                               60914000
      PREVREEL    = ITMP(0) #;                                          60915000
                                                                        60916000
   <<---------------------------->>                                     60917000
   SUBROUTINE FAIL (N); VALUE N; INTEGER N;                             60918000
      BEGIN                                                             60919000
                                                                        60920000
      MOVE TAPE'LABEL:=SAVE'TAPE'LABEL,(TAPE'LABEL'SIZE);               60921000
                                                                        60922000
      IF N <> 0 THEN                                                    60923000
         SENDMESSAGE (N);                                               60924000
                                                                        60925000
      GET'PRIOR'UNLABELED'VOLUME := -1D;                                60926000
                                                                        60927000
      GO END'PROC;                                                      60928000
                                                                        60929000
      END <<FAIL SUB>>;                                                 60930000
   <<---------------------------->>                                     60931000
   SUBROUTINE ASK'FOR'ANOTHER'REEL;                                     60932000
      BEGIN                                                             60933000
                                                                        60934000
      MOVE TAPE'LABEL:=SAVE'TAPE'LABEL,(TAPE'LABEL'SIZE);               60935000
                                                                        60936000
      FCONTROL (T'NUM, REWIND'UNLOAD, DUMMY);                           60937000
      IF <> THEN                                                        60938000
         FAIL (RS'T'REWIND'FAIL);                                       60939000
                                                                        60940000
            <<ARE PREV REELS AVAILABLE>>                                60941000
      GENMSG (1, 10, %10000, TAPE'LDEV, , , , , 0, 1, @REPLY);          60942000
                                                                        60943000
      IF REPLY = 0 THEN                                                 60944000
         FAIL (RS'T'OP'COULD'NOT'FIND'TAPE);                            60945000
                                                                        60946000
      END <<ASK'FOR'ANOTHER'REEL SUB>>;                                 60947000
   <<----------------------------->>                                    60948000
                                                                        60949000
   PREVREEL:=TL'REELNUM-1;                                              60950000
   MOVE ITMP(1):=TL'IIBID, (2);                                         60951000
   MOVE ITMP(3):=TL'DATE, (3);                                          60952000
                                                                        60953000
   FGETINFO (T'NUM, , TAPE'FOPTIONS, TAPE'AOPTIONS);                    60954000
   IF <> THEN                                                           60955000
      FAIL (RS'T'FGETINFO'FAIL);                                        60956000
   FFILEINFO (T'NUM, ITEM'LDEV, TAPE'LDEV);                             60956100
   IF <> THEN                                                           60956200
      FAIL (RS'T'FGETINFO'FAIL);                                        60956300
                                                                        60957000
   MOVE SAVE'TAPE'LABEL:=TAPE'LABEL,(TAPE'LABEL'SIZE);                  60958000
                                                                        60959000
   FCONTROL (T'NUM, REWIND'UNLOAD, DUMMY);                              60960000
   IF <> THEN                                                           60961000
      FAIL (RS'T'REWIND'FAIL);                                          60962000
                                                                        60963000
         <<ASK FOR A PREV REEL>>                                        60964000
   GENMSG (1, 21, %11000, PREVREEL, TAPE'LDEV, , , , 0);                60965000
                                                                        60966000
   DONE:=FALSE;                                                         60967000
                                                                        60968000
LOOP:                                                                   60969000
                                                                        60970000
   WHILE NOT DONE DO                                                    60971000
      BEGIN                                                             60972000
                                                                        60973000
      ISSUE'READ (TAPE'LABEL, TAPE'LABEL'SIZE+1, TRUE);                 60974000
      IF ERROR'CODE <> 0 THEN FAIL (RS'T'READ'SR'LABEL);                60975000
      LEN := READ'TAPE'LEN;                                             60976000
                                                                        60977000
      IF READ'TAPE'EOF THEN                                             60978000
         BEGIN                                                          60979000
         ISSUE'SKIP (TRUE);                                             60980000
         IF ERROR'CODE <> 0 THEN FAIL (RS'T'FSF'FAIL);                  60981000
         ISSUE'READ (TAPE'LABEL, TAPE'LABEL'SIZE+1, TRUE);              60982000
         IF ERROR'CODE <> 0 THEN FAIL (RS'T'READ'SR'LABEL);             60983000
         LEN := READ'TAPE'LEN;                                          60984000
         END                                                            60985000
                                                                        60986000
      ELSE IF LEN <> TAPE'LABEL'SIZE THEN                               60987000
         BEGIN                                                          60988000
         ISSUE'SKIP (TRUE);                                             60989000
         IF ERROR'CODE <> 0 THEN FAIL (RS'T'FSF'FAIL);                  60990000
         ISSUE'SKIP (TRUE);                                             60991000
         IF ERROR'CODE <> 0 THEN FAIL (RS'T'FSF'FAIL);                  60992000
         ISSUE'READ (TAPE'LABEL, TAPE'LABEL'SIZE+1, TRUE);              60993000
         IF ERROR'CODE <> 0 THEN FAIL (RS'T'READ'SR'LABEL);             60994000
         LEN := READ'TAPE'LEN;                                          60995000
         END;                                                           60996000
                                                                        60997000
                                                                        60998000
      IF READ'TAPE'EOF THEN                                             60999000
         ASK'FOR'ANOTHER'REEL                                           61000000
      ELSE IF LEN <> TAPE'LABEL'SIZE OR TAPE'LABEL' <> LABELTEXT THEN   61001000
         ASK'FOR'ANOTHER'REEL          <<wrong tape mounted>>           61002000
      ELSE IF TL'IIBID' <> ITMP'(2),(4) THEN                            61003000
         ASK'FOR'ANOTHER'REEL                                           61004000
      ELSE IF TL'DATE' <> ITMP'(6),(6) THEN                             61005000
         ASK'FOR'ANOTHER'REEL                                           61006000
      ELSE IF TL'REELNUM > PREVREEL THEN                                61007000
         ASK'FOR'ANOTHER'REEL                                           61008000
      ELSE                                                              61009000
         DONE:=TRUE;                                                    61010000
      END <<while not done loop>>;                                      61011000
                                                                        61012000
   ISSUE'SKIP (TRUE);                                                   61013000
                                                                        61014000
   IF ERROR'CODE <> 0 THEN                                              61015000
      FAIL (RS'T'FSF'FAIL);                                             61016000
                                                                        61017000
   IF TL'REELNUM = 1 THEN                                               61018000
      BEGIN                                                             61019000
      ISSUE'SKIP (TRUE);                                                61020000
      IF ERROR'CODE <> 0 THEN                                           61021000
         FAIL (RS'T'FSF'FAIL);                                          61022000
      END;                                                              61023000
                                                                        61024000
   GET'PRIOR'UNLABELED'VOLUME:=DOUBLE(TL'FILEINX+TL'SPANTOG);           61025000
                                                                        61026000
END'PROC:                                                               61027000
   END <<GET'PRIOR'UNLABELED'VOLUME PROC>>;                             61028000
$PAGE "CREATE'DIR'ENTRY"                                                70000000
$CONTROL SEGMENT=RESTORE                                                70001000
<<------------------------------>>                                      70002000
<< CREATE'DIR'ENTRY             >>                                      70003000
<<------------------------------>>                                      70004000
                                                                        70005000
INTEGER PROCEDURE CREATE'DIR'ENTRY (LEVEL, NAME);                       70006000
   VALUE LEVEL;                                                         70007000
   INTEGER LEVEL;                                                       70008000
   LOGICAL ARRAY NAME;                                                  70009000
                                                                        70010000
   << This procedure creates either an acct, a group, or a user.  >>    70011000
   << The command intrinsic is called with the correct string to  >>    70012000
   << do this.                                                    >>    70013000
                                                                        70014000
BEGIN                                                                   70015000
   LOGICAL ARRAY NTRY'GROUP (0:9) = PB :=                               70016000
      "NEWGROUP  ", "        ", %006415;                                70017000
   LOGICAL ARRAY NTRY'ACCT  (0:11) = PB :=                              70018000
      "NEWACCT   ", "        ", ",MGR", %006415;                        70019000
   LOGICAL ARRAY NTRY'USER  (0:9) = PB :=                               70020000
      "NEWUSER   ", "        ", %006415;                                70021000
                                                                        70022000
   LOGICAL ARRAY                                                        70023000
      BUFFER  (0:30);                                                   70024000
                                                                        70025000
   INTEGER                                                              70026000
      COM'ERROR := 0,                                                   70027000
      COM'PARM  := 0;                                                   70028000
                                                                        70029000
   << Create the string for the command intrinsic >>                    70030000
                                                                        70031000
   IF LEVEL=GROUPLEVEL THEN                                             70032000
      MOVE BUFFER := NTRY'GROUP, (10)                                   70033000
   ELSE IF LEVEL=ACCTLEVEL THEN                                         70034000
      MOVE BUFFER := NTRY'ACCT,  (12)                                   70035000
   ELSE IF LEVEL=USERLEVEL THEN                                         70036000
      MOVE BUFFER := NTRY'USER,  (10);                                  70037000
                                                                        70038000
   MOVE BUFFER(5) := NAME, (FILE'PART'WORDS);                           70039000
                                                                        70040000
   << Call the COMMAND intrinsic and process the return>>               70041000
                                                                        70042000
   COMMAND (BUFFER,COM'ERROR,COM'PARM);                                 70043000
   IF COM'ERROR<>0 THEN CREATE'DIR'ENTRY := M'NO'CREATE                 70044000
   ELSE                                                                 70045000
      BEGIN                                                             70046000
      PARMS'TEMPI'1 := LEVEL;                                           70047000
      SENDMESSAGE (M'CREATED'DIR'ENTRY);                                70048000
      CREATE'DIR'ENTRY := 0;                                            70049000
      END;                                                              70050000
END;                                                                    70051000
$PAGE "MOUNT'VOLUME'SET"                                                70052000
$CONTROL SEGMENT=RESTORE                                                70053000
<<-------------------->>                                                70054000
<<  MOUNT'VOLUME'SET  >>                                                70055000
<<-------------------->>                                                70056000
                                                                        70057000
LOGICAL PROCEDURE MOUNT'VOLUME'SET (VSGROUP', VSACCT', INFO);           70058000
   INTEGER INFO;                                                        70059000
   BYTE ARRAY VSGROUP', VSACCT';                                        70060000
                                                                        70061000
   << PERFORMS "mount *.vsgroup.vsacct" RETURNING info FOR DISMOUNT>>   70062000
   << The MOUNT actually performs a BIND which allows DIRECSCAN to >>   70063000
   << find files on private volumes without giving the PVINFO      >>   70064000
                                                                        70065000
BEGIN                                                                   70066000
   INTEGER REQ'TYPE;                                                    70067000
                                                                        70068000
$IF X1=ON THEN                                                          70069000
   IF DEBUGGING THEN                                                    70070000
      BEGIN                                                             70071000
      SAY "MOUNT'VOLUME'SET - *" ENDSAY;                                70072000
      SAY VSGROUP', (FILE'PART'SIZE) ENDSAY;                            70073000
      SAY "." ENDSAY;                                                   70074000
      SAY VSACCT', (FILE'PART'SIZE) ENDSAY;                             70075000
      SEND;                                                             70076000
      END;                                                              70077000
$IF                                                                     70078000
                                                                        70079000
   REQ'TYPE := CONDMOUNT'BIND;                                          70080000
   MOUNT (STAR, VSGROUP', VSACCT', REQ'TYPE, -1, INFO);                 70081000
   IF < THEN MOUNT'VOLUME'SET := FAILED                                 70082000
   ELSE                                                                 70083000
      BEGIN                                                             70084000
      MOUNTED'VS := TRUE;                                               70085000
      MOUNT'VOLUME'SET := GOOD;                                         70086000
      INFO.(PVf) := PV;                                                 70087000
                                                                        70088000
$IF X1=ON THEN                                                          70089000
      IF DEBUGGING THEN                                                 70090000
         BEGIN                                                          70091000
         SAY "   successful - pvinfo = %" ENDSAY;                       70092000
         SAYOCTAL (INFO);                                               70093000
         SEND;                                                          70094000
         END;                                                           70095000
$IF                                                                     70096000
                                                                        70097000
      END;                                                              70098000
END;                                                                    70099000
$PAGE "DISMOUNT'VOLUME'SET"                                             70100000
$CONTROL SEGMENT=RESTORE                                                70101000
<<----------------------->>                                             70102000
<<  DISMOUNT'VOLUME'SET  >>                                             70103000
<<----------------------->>                                             70104000
                                                                        70105000
PROCEDURE DISMOUNT'VOLUME'SET (VSGROUP', VSACCT', INFO);                70106000
   BYTE ARRAY VSGROUP', VSACCT';                                        70107000
   INTEGER INFO;                                                        70108000
                                                                        70109000
   << PERFORMS "dismount *.vsgroup'.vsacct'". INFO comes from >>        70110000
   << MOUNT'VOLUME'SET. Performs UNBINDING.                   >>        70111000
                                                                        70112000
BEGIN                                                                   70113000
   INTEGER REQ'TYPE;                                                    70114000
                                                                        70115000
$IF X1=ON THEN                                                          70116000
   IF DEBUGGING THEN                                                    70117000
      BEGIN                                                             70118000
      SAY "DISMOUNT'VOLUME'SET - *." ENDSAY;                            70119000
      SAY VSGROUP', (FILE'PART'SIZE) ENDSAY;                            70120000
      SAY "." ENDSAY;                                                   70121000
      SAY VSACCT', (FILE'PART'SIZE) ENDSAY;                             70122000
      SAY " - PVINFO = %" ENDSAY;                                       70123000
      SAYOCTAL (INFO);                                                  70124000
      SEND;                                                             70125000
      END;                                                              70126000
$IF                                                                     70127000
                                                                        70128000
   REQ'TYPE := CONDDISMOUNT'BIND;                                       70129000
   DISMOUNT (STAR, VSGROUP', VSACCT', REQ'TYPE, INFO);                  70130000
   INFO := 0;                                                           70131000
   MOUNTED'VS := FALSE;                                                 70132000
END;                                                                    70133000
$PAGE "DIRECTORY'ERROR"                                                 70134000
$CONTROL SEGMENT=RESTORE                                                70135000
<<---------------------------------------->>                            70136000
<<  DIRECTORY'ERROR                       >>                            70137000
<<---------------------------------------->>                            70138000
                                                                        70139000
INTEGER PROCEDURE DIRECTORY'ERROR (DIREC'RET);                          70140000
   VALUE DIREC'RET;                                                     70141000
   DOUBLE DIREC'RET;                                                    70142000
                                                                        70143000
   ! This procedure provides the capability of turning a directory      70144000
   ! error into a STORE/RESTORE error.  This procedure can be called    70145000
   ! with the return of any of the directory routines.                  70146000
                                                                        70147000
BEGIN                                                                   70148000
   INTEGER                                                              70149000
      DRA         = DIREC'RET + 1,                                      70150000
      DRB         = DIREC'RET;                                          70151000
                                                                        70152000
   PARMS'TEMPD'2 := DIREC'RET;       ! HOLDS RETURN FOR USING IN MSG    70153000
                                                                        70154000
   IF DRA=0 OR DRA=1 THEN                                               70155000
      DIRECTORY'ERROR := M'DIREC'UNXPECTED'ERROR                        70156000
   ELSE IF DRA=2 THEN                                                   70157000
      IF DRB=GROUPLEVEL THEN DIRECTORY'ERROR := M'NO'GROUP              70158000
      ELSE IF DRB=ACCTLEVEL THEN DIRECTORY'ERROR := M'NO'ACCT           70159000
      ELSE DIRECTORY'ERROR := M'DIREC'UNXPECTED'ERROR                   70160000
   ELSE IF DRA=3 THEN                                                   70161000
      IF DRB=GROUPLEVEL THEN DIRECTORY'ERROR := M'GROUP'SAVE'ACCESS     70162000
      ELSE IF DRB=ACCTLEVEL THEN DIRECTORY'ERROR := M'ACCT'SAVE'ACCESS  70163000
      ELSE DIRECTORY'ERROR := M'DIREC'UNXPECTED'ERROR                   70164000
   ELSE IF DRA=4 OR DRA=5 OR DRA=6 THEN                                 70165000
      DIRECTORY'ERROR := M'DIREC'NO'ROOM                                70166000
   ELSE IF DRA=7 THEN                                                   70167000
      DIRECTORY'ERROR := M'DIREC'UNXPECTED'ERROR                        70168000
   ELSE IF DRA=8 THEN                                                   70169000
      IF DRB=GROUPLEVEL THEN DIRECTORY'ERROR := M'GROUP'DISC'SPACE      70170000
      ELSE IF DRB=ACCTLEVEL THEN DIRECTORY'ERROR := M'ACCT'DISC'SPACE   70171000
      ELSE DIRECTORY'ERROR := M'DIREC'UNXPECTED'ERROR                   70172000
   ELSE DIRECTORY'ERROR := M'DIREC'UNXPECTED'ERROR;                     70173000
                                                                        70174000
   ENABLE'ARITHMETIC'TRAPS;                                             70175000
$IF X1=ON THEN                                                          70176000
   IF DEBUGGING THEN                                                    70177000
      BEGIN                                                             70178000
      SAY "DIRECTORY ERROR - DRA = " ENDSAY;                            70179000
      SAYNUM (DRA);                                                     70180000
      SAY "; DRB = " ENDSAY;                                            70181000
      SAYNUM (DRB);                                                     70182000
      SEND;                                                             70183000
      END;                                                              70184000
$IF                                                                     70185000
END;                                                                    70186000
$PAGE "RC'LOCK'DIRECTORY"                                               70187000
$CONTROL SEGMENT=RESTORE                                                70188000
<<---------------------------------------->>                            70189000
<<  RC'LOCK'DIRECTORY                     >>                            70190000
<<---------------------------------------->>                            70191000
                                                                        70192000
INTEGER PROCEDURE RC'LOCK'DIRECTORY (ELEMENT, LEVEL, PARMS, SIR);       70193000
   VALUE LEVEL, PARMS, SIR;                                             70194000
   INTEGER LEVEL, PARMS;                                                70195000
   INTEGER ARRAY ELEMENT;                                               70196000
   DOUBLE SIR;                                                          70197000
   OPTION PRIVILEGED, UNCALLABLE;                                       70198000
                                                                        70199000
   << This procedure is the recipient procedure of a       >>           70200000
   << DIRECSCAN call.  RC'LOCK'DIRECTORY ups the use count >>           70201000
   << for the group entry and possibly the ACCT entry.     >>           70202000
   << It also fills in the global variables ACCT'INDEX'PTR >>           70203000
   << and GROUP'INDEX'PTR.                                 >>           70204000
                                                                        70205000
   << The PARMS array is as follows                        >>           70206000
   <<     word 0     - If TRUE then do both ACCT and GROUP     >>       70207000
   <<                  Else do just GROUP                      >>       70208000
   <<     word 1     - ERROR return                            >>       70209000
   <<     word 2     - ACCOUNT-GROUP Index pointer             >>       70210000
   <<     word 3     - ACCOUNT-USER  Index pointer             >>       70211000
   <<     word 4,5   - GROUP-FILE Index pointer                >>       70212000
   <<     word 6     - If TRUE then LOCK else UNLOCK           >>       70213000
   <<     word 7-10  - ACCOUNT name                            >>       70214000
   <<     word 11-14 - GROUP   name                            >>       70215000
                                                                        70216000
                                                                        70217000
BEGIN                                                                   70218000
                                                                        70219000
   DEFINE                                                               70220000
      P'DO'ACCT        = ARQ (PARMS+0).(15:1) #,                        70221000
      P'DO'GROUP       = ARQ (PARMS+0).(14:1) #,                        70222000
      P'ERROR          = ARQ (PARMS+1) #,                               70223000
      P'GROUP'INX      = ARQ (PARMS+2) #,                               70224000
      P'USER'INX       = ARQ (PARMS+3) #,                               70225000
      P'FILE'INX'1     = ARQ (PARMS+4) #,                               70226000
      P'FILE'INX'2     = ARQ (PARMS+5) #,                               70227000
      P'LOCK           = ARQ (PARMS+6) #,                               70228000
      P'ACCT'NAME      = ARQ (PARMS+7) #,                               70229000
      P'GROUP'NAME     = ARQ (PARMS+11) #;                              70230000
                                                                        70231000
   INTEGER ARRAY                                                        70232000
      ARQ        (*)  =  Q+0,                                           70233000
      DSEG       (*)  =  DB+0;                                          70234000
                                                                        70235000
   LOGICAL ARRAY                                                        70236000
      DSEG'L     (*)  =  DSEG;                                          70237000
                                                                        70238000
   LOGICAL                                                              70239000
      NEED'REL'DSIR   := FALSE,                                         70240000
      STILL'HAVE'DSIR := TRUE;                                          70241000
                                                                        70242000
   INTEGER                                                              70243000
      ENTRY'LOC,                                                        70244000
      SIR'NUMBER      =  SIR,                                           70245000
      SIR'INFO        =  SIR + 1;                                       70246000
                                                                        70247000
   DEFINE                                                               70248000
      CONTENTS        =  DSEG(%243)  #,                                 70249000
      INDEX'ADDR      =  DSEG(%257)  #,                                 70250000
      DADIRTY         =  DSEG'L(%221).(15:01) #,                        70251000
      DBDIRTY         =  DSEG'L(%247).(15:01) #;                        70252000
                                                                        70253000
   PARMS := PARMS - ARQ;                                                70254000
                                                                        70255000
   IF P'ERROR <> 0 THEN                                                 70256000
      RC'LOCK'DIRECTORY := RC'STOP                                      70257000
                                                                        70258000
   ELSE IF LEVEL = 2 THEN                                               70259000
      BEGIN                                                             70260000
      P'GROUP'INX := ELEMENT (A'AGIPNTR);                               70261000
      P'USER'INX  := ELEMENT (A'AUIPNTR);                               70262000
      RC'LOCK'DIRECTORY := 0;                                           70263000
      END                                                               70264000
                                                                        70265000
   ELSE IF LEVEL = 1 THEN      <<GROUP>>                                70266000
      BEGIN                                                             70267000
      IF LOGICAL (P'DO'ACCT) THEN                                       70268000
         BEGIN                                                          70269000
         IF LOGICAL (P'LOCK) THEN                                       70270000
            INDEX'ADDR := INDEX'ADDR + 1                                70271000
         ELSE                                                           70272000
            INDEX'ADDR := INDEX'ADDR - 1;                               70273000
         DBDIRTY := TRUE;                                               70274000
         END;                                                           70275000
                                                                        70276000
      IF LOGICAL (P'DO'GROUP) THEN                                      70277000
         BEGIN                                                          70278000
         P'FILE'INX'2 := ELEMENT (GFIPNTR);                             70279000
         IF ELEMENT (GLINKAGE).(PVf)  = PV THEN                         70280000
            BEGIN                                                       70281000
            IF DBDIRTY THEN          << Clean out data area B>>         70282000
               BEGIN                                                    70283000
               DIRWRITE (DATA'AREA'B);                                  70284000
               DBDIRTY := FALSE;                                        70285000
               END;                                                     70286000
                                                                        70287000
            TOS := SIR;                                                 70288000
            RELSIR (SIR'NUMBER, SIR'INFO);                              70289000
            NEED'REL'DSIR := TRUE;                                      70290000
            STILL'HAVE'DSIR := FALSE;                                   70291000
                                                                        70292000
            EXCHANGEDB (0);                                             70293000
            IF LOGICAL (P'LOCK) THEN                                    70294000
               BEGIN                                                    70295000
               IF MOUNT'VOLUME'SET (P'GROUP'NAME, P'ACCT'NAME, PV'INFO) 70296000
                                                       = FAILED THEN    70297000
                  BEGIN                                                 70298000
                  P'ERROR := M'MOUNT'FAILED;                            70299000
                  RC'LOCK'DIRECTORY := RC'STOP;                         70300000
                  END                                                   70301000
               ELSE                                                     70302000
                  P'FILE'INX'1 := PV'INFO;                              70303000
               END                                                      70304000
            ELSE                                                        70305000
               DISMOUNT'VOLUME'SET (P'GROUP'NAME, P'ACCT'NAME, PV'INFO);70306000
                                                                        70307000
            SIR'INFO := GETSIR (SIR'NUMBER);                            70308000
            STILL'HAVE'DSIR := TRUE;                                    70309000
                                                                        70310000
            EXCHANGEDB (DIRDST);                                        70311000
                                                                        70312000
            END;                                                        70313000
                                                                        70314000
         IF P'ERROR = 0 THEN                                            70315000
            BEGIN                                                       70316000
            DIRREAD (P'FILE'INX'2, DATA'AREA'B, 0<<?>>, 0<<?>>);        70317000
                                                                        70318000
            IF LOGICAL (P'LOCK) THEN                                    70319000
               INDEX'ADDR := INDEX'ADDR + 1                             70320000
            ELSE                                                        70321000
               INDEX'ADDR := INDEX'ADDR - 1;                            70322000
            DBDIRTY := TRUE;                                            70323000
            RC'LOCK'DIRECTORY := 0;                                     70324000
            P'ERROR := 0;                                               70325000
            END;                                                        70326000
         END;                                                           70327000
      END                                                               70328000
                                                                        70329000
   ELSE   <<ILLEGAL LEVEL>>                                             70330000
      BEGIN                                                             70331000
      RC'LOCK'DIRECTORY := RC'STOP;                                     70332000
      P'ERROR := SR'DIR'BAD'LEVEL;                                      70333000
      END;                                                              70334000
                                                                        70335000
   IF NEED'REL'DSIR THEN                                                70336000
      BEGIN                                                             70337000
      RELSIR (SIR'NUMBER, SIR'INFO);                                    70338000
      STILL'HAVE'DSIR := FALSE;                                         70339000
      END;                                                              70340000
                                                                        70341000
   RC'LOCK'DIRECTORY.(15:1) := STILL'HAVE'DSIR;                         70342000
                                                                        70343000
END;                                                                    70344000
$PAGE "LOCK'DIRECTORY"                                                  70345000
$CONTROL SEGMENT=RESTORE                                                70346000
<<---------------------------------------->>                            70347000
<<  LOCK'DIRECTORY                        >>                            70348000
<<---------------------------------------->>                            70349000
                                                                        70350000
INTEGER PROCEDURE LOCK'DIRECTORY;                                       70351000
                                                                        70352000
   << This procedure unlocks the last group and acct and then locks >>  70353000
   << the current group and acct.  If LAST'ACCT is blank then no    >>  70354000
   << account is unlocked.  If RES'ACCT is blank then no account is >>  70355000
   << locked.  If LAST'ACCT = RES'ACCT then only groups are unlocked>>  70356000
   << and locked.  If the create flag is set and the current group  >>  70357000
   << and/or account are not in the directory then they will be     >>  70358000
   << created.  If the lastgroup was on a private volume then it    >>  70359000
   << will be dismounted.  If the current group is on a private     >>  70360000
   << volume then it will be mounted.                               >>  70361000
                                                                        70362000
   << Locking a group or account means incrementing the access count>>  70363000
   << Unlocking a group or acct means decrementing the access count.>>  70364000
                                                                        70365000
   << The variables FILE'INDEX'PTR, GROUP'INDEX'PTR, and            >>  70366000
   << USER'INDEX'PTR are updated when appropriate                   >>  70367000
                                                                        70368000
   << This routine calls DIRECSCAN with RC'LOCK'DIRECTORY as the    >>  70369000
   << recipient procedure.  See comment in RC'LOCK'DIRECTORY for    >>  70370000
   << description of the passed PARMS parameter.                    >>  70371000
                                                                        70372000
BEGIN                                                                   70373000
                                                                        70374000
   DEFINE                                                               70375000
      P'DO'ACCT        = PARMS(0).(15:1) #,                             70376000
      P'DO'GROUP       = PARMS(0).(14:1) #,                             70377000
      P'DO'NEITHER     = (PARMS(0).(14:2) = 0) #,                       70378000
      P'ERROR          = PARMS(1) #,                                    70379000
      P'GROUP'INX      = PARMS(2) #,                                    70380000
      P'USER'INX       = PARMS(3) #,                                    70381000
      P'FILE'INX       = PARMS'D (2) #,                                 70382000
      P'FILE'INX'1     = PARMS(4) #,                                    70383000
      P'FILE'INX'2     = PARMS(5) #,                                    70384000
      P'LOCK           = PARMS(6) #,                                    70385000
      P'ACCT'NAME      = PARMS(7) #,                                    70386000
      P'GROUP'NAME     = PARMS(11) #,                                   70387000
      P'SIZE           = 15 #;                                          70388000
                                                                        70389000
   INTEGER ARRAY                                                        70390000
      PARMS       (0:P'SIZE-1);                                         70391000
                                                                        70392000
   DOUBLE ARRAY                                                         70393000
      PARMS'D     (*) = PARMS;                                          70394000
                                                                        70395000
   LOGICAL ARRAY                                                        70396000
      NTRY      (0:GSIZE);                                              70397000
                                                                        70398000
   INTEGER                                                              70399000
      TYPE := 0;                                                        70400000
                                                                        70401000
   DOUBLE                                                               70402000
      DR;                                                               70403000
                                                                        70404000
   INTEGER                                                              70405000
      DRA = DR+1,                                                       70406000
      DRB = DR;                                                         70407000
                                                                        70408000
   SUBROUTINE FAIL (NUM);                                               70409000
      VALUE NUM;                                                        70410000
      INTEGER NUM;                                                      70411000
   BEGIN                                                                70412000
      LOCK'DIRECTORY := NUM;                                            70413000
      LAST'GROUP'ERROR := NUM;                                          70414000
      GOTO END'LOCK'DIRECTORY;                                          70415000
   END;                                                                 70416000
                                                                        70417000
   SUBROUTINE EVAL'RETURN (N);                                          70418000
      VALUE N;                                                          70419000
      INTEGER N;                                                        70420000
   BEGIN                                                                70421000
      IF N <> 0 THEN                                                    70422000
         FAIL (N);                                                      70423000
   END;                                                                 70424000
                                                                        70425000
                                                                        70426000
   LOCK'DIRECTORY := 0;                                                 70427000
                                                                        70428000
   FILL (PARMS, P'SIZE, 0);                                             70429000
                                                                        70430000
   IF RES'ACCT' = LAST'ACCT', (FILE'PART'SIZE) THEN                     70431000
      IF RES'GROUP' = LAST'GROUP', (FILE'PART'SIZE) THEN                70432000
         FAIL (LAST'GROUP'ERROR)    <<SAME GROUP AND ACCT>>             70433000
      ELSE                                                              70434000
         P'DO'ACCT := FALSE    <<SAME ACCT>>                            70435000
   ELSE                                                                 70436000
      P'DO'ACCT := TRUE;       <<DIFFERENT ACCT>>                       70437000
                                                                        70438000
   MOVE P'ACCT'NAME := RES'ACCT, (FILE'PART'WORDS);                     70439000
   MOVE P'GROUP'NAME := RES'GROUP,  (FILE'PART'WORDS);                  70440000
                                                                        70441000
   TYPE.(13:03) := IF GROUP'INDEX'PTR = 0 THEN 0  <<STARTLEVEL>>        70442000
                   ELSE 1;                                              70443000
   TYPE.(10:03) := GROUPLEVEL; <<ENDLEVEL = GROUPS>>                    70444000
   TYPE.(09:01) := 0;          <<ALLFLAG  = FALSE >>                    70445000
   TYPE.(06:03) := GROUPLEVEL; <<TOLEVEL  = GROUPS>>                    70446000
   TYPE.(05:01) := 1;          <<HITFLAG  = TRUE  >>                    70447000
                                                                        70448000
   IF GROUP'INDEX'PTR <> 0 THEN                                         70449000
      BEGIN                                                             70450000
      P'LOCK := FALSE;                                                  70451000
      MOVE P'ACCT'NAME := LAST'ACCT, (FILE'PART'WORDS);                 70452000
      MOVE P'GROUP'NAME := LAST'GROUP,  (FILE'PART'WORDS);              70453000
      IF LAST'GROUP' <> " " THEN                                        70454000
         P'DO'GROUP := TRUE;                                            70455000
                                                                        70456000
      IF NOT P'DO'NEITHER THEN                                          70457000
         BEGIN                                                          70458000
         DISABLE'ARITHMETIC'TRAPS;                                      70459000
         DR := DIRECSCAN (TYPE, DOUBLE (GROUP'INDEX'PTR), LAST'ACCT,    70460000
                          LAST'GROUP, LAST'GROUP,                       70461000
                          RC'LOCK'DIRECTORY, PARMS, 0);                 70462000
         ENABLE'ARITHMETIC'TRAPS;                                       70463000
         END;                                                           70464000
                                                                        70465000
      IF LOGICAL (P'DO'ACCT) THEN                                       70466000
         BEGIN                                                          70467000
         GROUP'INDEX'PTR := 0;                                          70468000
         USER'INDEX'PTR  := 0;                                          70469000
         LAST'ACCT' := " ";                                             70470000
         END;                                                           70471000
      FILE'INDEX'PTR := 0D;                                             70472000
      LAST'GROUP' := " ";                                               70473000
      END;                                                              70474000
                                                                        70475000
   IF RES'ACCT' <> " " THEN                                             70476000
      BEGIN                                                             70477000
                                                                        70478000
TRY'AGAIN:                                                              70479000
                                                                        70480000
      IF RES'GROUP' = " " THEN                                          70481000
         P'DO'GROUP := FALSE                                            70482000
      ELSE                                                              70483000
         P'DO'GROUP := TRUE;                                            70484000
                                                                        70485000
      TYPE.(13:03) := IF LOGICAL (P'DO'ACCT) THEN 0                     70486000
                      ELSE 1;                                           70487000
      P'LOCK := TRUE;                                                   70488000
      MOVE P'ACCT'NAME := RES'ACCT, (FILE'PART'WORDS);                  70489000
      MOVE P'GROUP'NAME := RES'GROUP,  (FILE'PART'WORDS);               70490000
                                                                        70491000
      IF NOT LOGICAL(P'DO'GROUP) THEN                                   70492000
         BEGIN                                                          70493000
         TYPE.(10:03) := ACCTLEVEL;                                     70494000
         TYPE.(06:03) := ACCTLEVEL;                                     70495000
         END;                                                           70496000
                                                                        70497000
      DISABLE'ARITHMETIC'TRAPS;                                         70498000
      DR := DIRECSCAN (TYPE, DOUBLE (GROUP'INDEX'PTR), RES'ACCT,        70499000
                       RES'GROUP, RES'GROUP,                            70500000
                       RC'LOCK'DIRECTORY, PARMS, 0);                    70501000
      ENABLE'ARITHMETIC'TRAPS;                                          70502000
      IF <> THEN                                                        70503000
         IF DRA = 2 THEN                                                70504000
            IF DRB = GROUPLEVEL AND CREATE'GROUP'FLAG THEN              70505000
               BEGIN                                                    70506000
               EVAL'RETURN (CREATE'DIR'ENTRY (GROUPLEVEL, RES'GROUP));  70507000
               GOTO TRY'AGAIN;                                          70508000
               END                                                      70509000
            ELSE IF DRB = ACCTLEVEL AND CREATE'ACCT'FLAG THEN           70510000
               BEGIN                                                    70511000
               EVAL'RETURN (CREATE'DIR'ENTRY (ACCTLEVEL, RES'ACCT));    70512000
               GOTO TRY'AGAIN;                                          70513000
               END                                                      70514000
            ELSE                                                        70515000
               BEGIN                                                    70516000
               PARMS'TEMPI'1 := DRB;                                    70517000
               FAIL (DIRECTORY'ERROR(DR));                              70518000
               END                                                      70519000
         ELSE                                                           70520000
            FAIL (DIRECTORY'ERROR (DR));                                70521000
                                                                        70522000
      IF LOGICAL (P'DO'ACCT) THEN                                       70523000
         BEGIN                                                          70524000
         GROUP'INDEX'PTR  := P'GROUP'INX;                               70525000
         USER'INDEX'PTR   := P'USER'INX;                                70526000
         END;                                                           70527000
                                                                        70528000
      IF LOGICAL (P'DO'GROUP) THEN                                      70529000
         BEGIN                                                          70530000
         MOVE LAST'GROUP' := RES'GROUP', (FILE'PART'SIZE);              70531000
         MOVE LAST'ACCT'  := RES'ACCT',  (FILE'PART'SIZE);              70532000
         FILE'INDEX'PTR := P'FILE'INX;                                  70533000
         END;                                                           70534000
                                                                        70535000
      IF P'ERROR <> 0 THEN FAIL (P'ERROR);                              70536000
                                                                        70537000
      IF MOUNTED'VS THEN                                                70538000
         BEGIN                                                          70539000
         DR := DIRECFIND (%10, DOUBLE (GROUP'INDEX'PTR), RES'ACCT,      70540000
                          RES'GROUP, RES'GROUP, NTRY);                  70541000
         IF <> THEN FAIL (SR'DIR'LOCK'UNXPCTD);                         70542000
         FILE'INDX'2 := NTRY (GFIPNTR);                                 70543000
         END;                                                           70544000
      END;                                                              70545000
                                                                        70546000
   LAST'GROUP'ERROR := 0;                                               70547000
                                                                        70548000
END'LOCK'DIRECTORY:                                                     70549000
                                                                        70550000
END;                                                                    70551000
$PAGE "CHECK'TAPE'LABEL"                                                70552000
$CONTROL SEGMENT=RESTORE                                                70553000
<<---------------------------------------->>                            70554000
<<  CHECK'TAPE'LABEL                      >>                            70555000
<<---------------------------------------->>                            70556000
                                                                        70557000
LOGICAL PROCEDURE CHECK'TAPE'LABEL (TDBUF);                             70558000
   LOGICAL ARRAY TDBUF;   << Tape Buffer  (r/o)                       >>70559000
                                                                        70560000
   << This routine checks to see if the current buffer is             >>70561000
   << a valid tape label.  The information is first moved to          >>70562000
   << the global array TAPE'LABEL and then the checks are made        >>70563000
                                                                        70564000
                                                                        70565000
BEGIN                                                                   70566000
   BYTE ARRAY                                                           70567000
      TDBUF' (*) = TDBUF;              << Tape buffer                 >>70568000
                                                                        70569000
   CHECK'TAPE'LABEL := TRUE;           << Innocent until proven guilty>>70570000
                                                                        70571000
   MOVE'TO'TAPE'LABEL;                                                  70572000
                                                                        70573000
   IF TAPE'LABEL' <> LABELTEXT THEN    << Does Label begin correctly  >>70574000
      CHECK'TAPE'LABEL := FALSE;                                        70575000
                                                                        70576000
END;                                                                    70577000
$PAGE "PRE'SCAN'FOR'MATCH"                                              70578000
$CONTROL SEGMENT=RESTORE                                                70579000
<<---------------------------------------->>                            70580000
<<  PRE'SCAN'FOR'MATCH                    >>                            70581000
<<---------------------------------------->>                            70582000
                                                                        70583000
LOGICAL PROCEDURE PRE'SCAN'FOR'MATCH (TDBUF, GBUF, LEN, ERRORNUM,       70584000
                                      EOFS'LEFT);                       70585000
   LOGICAL ARRAY                                                        70586000
      TDBUF,                           << Tape Buffer  (r/o)          >>70587000
      GBUF;                            << Buffer for GOOD record (r/o)>>70588000
                                                                        70589000
   INTEGER                                                              70590000
      ERRORNUM,                        << Error return   (w/o)        >>70591000
                                       <<    -1 = TERMINATE           >>70592000
      LEN;                             << Length of read (w/o)        >>70593000
                                                                        70594000
   DOUBLE                                                               70595000
      EOFS'LEFT;                       << # of EOFS left (r/w)        >>70596000
                                                                        70597000
   << This routine scans through the buffers that are outstanding     >>70598000
   << looking for the tape file that is passed in the GBUF array.     >>70599000
   << This code is used for the ATTACHIO method only.  Every          >>70600000
   << read that comes after an EOF is checked to see if it is the     >>70601000
   << correct file, or if it is necessary to switch volumes.          >>70602000
                                                                        70603000
                                                                        70604000
BEGIN                                                                   70605000
   BYTE ARRAY                                                           70606000
      GBUF'      (*)   =  GBUF,           << Buffer for GOOD record   >>70607000
      TDBUF'     (*)   =  TDBUF;          << Tape Buffer              >>70608000
                                                                        70609000
   DOUBLE ARRAY                                                         70610000
      GBUF'D     (*)   =  GBUF;           << Buffer for GOOD record   >>70611000
                                                                        70612000
   LOGICAL                                                              70613000
      FOUNDFLAG        := FALSE,          << Did a match occur?       >>70614000
      KEEP'GOING       := TRUE,           << Should we keep going?    >>70615000
      LAST'ONE'WAS'EOF := FALSE;          << Was last read an eof?    >>70616000
                                                                        70617000
   DOUBLE                                                               70618000
      ATTIO'RET            := 0D;         << return from WAITFORIO    >>70619000
                                                                        70620000
   INTEGER                                                              70621000
      ATTIO'RET'1          =  ATTIO'RET,     << 1st word of ATTIO'RET >>70622000
      ATTIO'RET'2          =  ATTIO'RET + 1; << 2nd word of ATTIO'RET >>70623000
$PAGE "FAIL of PRE'SCAN'FOR'MATCH"                                      70624000
   <<---------------------------------------->>                         70625000
   <<  FAIL of PRE'SCAN'FOR'MATCH            >>                         70626000
   <<---------------------------------------->>                         70627000
                                                                        70628000
   SUBROUTINE FAIL;                                                     70629000
                                                                        70630000
      << Called to start the termination of the process.  A return of >>70631000
      << -1 means to stop the entire program.                         >>70632000
                                                                        70633000
   BEGIN                                                                70634000
      ERRORNUM := -1;                        << Set error number to QU>>70635000
      GOTO END'PRE'SCAN'FOR'MATCH;           << Get out of here       >>70636000
   END;                                                                 70637000
$PAGE                                                                   70638000
   IF NOT USING'ATTIO THEN                   << Must be using ATTACHIO>>70639000
      RETURN;                                                           70640000
                                                                        70641000
   LEN                     := 0;                                        70642000
   FOUNDFLAG               := FALSE;                                    70643000
   ERRORNUM                := 0;                                        70644000
                                                                        70645000
   << Loop through outstanding IOs.  If the last read was a tapemark  >>70646000
   << then check to see if this read contains the file label of the   >>70647000
   << desired file.  If this read is prior error abort then ignore it >>70648000
   << because if there really was an error we have already stopped, an>>70649000
   << if it was just an EOF then its OK.                              >>70650000
                                                                        70651000
   WHILE KEEP'GOING DO                                                  70652000
      BEGIN                                                             70653000
                                                                        70654000
      IF OUTSTANDING'IOS = 0 THEN                   << No IOs left    >>70655000
         KEEP'GOING := FALSE                                            70656000
      ELSE                                                              70657000
         BEGIN                                                          70658000
                                                                        70659000
         CURR'WAIT'BUFFER := CURR'WAIT'BUFFER + 1;  << Update bufnum  >>70660000
         IF CURR'WAIT'BUFFER = NUM'BUFFERS THEN                         70661000
            CURR'WAIT'BUFFER := 0;                                      70662000
                                                                        70663000
         << Wait for the IO.  Mark IO as finished. Decrement number of>>70664000
         << outstanding IOs                                           >>70665000
                                                                        70666000
         ATTIO'RET := WAITFORIO (IO'QUEUE (2*CURR'WAIT'BUFFER) );       70667000
         IO'QUEUE'D (CURR'WAIT'BUFFER) := 0D;                           70668000
         OUTSTANDING'IOS := OUTSTANDING'IOS - 1;                        70669000
                                                                        70670000
$IF X1=ON THEN                                                          70671000
         IF DEBUGGING THEN                                              70672000
            BEGIN                                                       70673000
            SAY "PRESCANNING FOR MATCH - IOS = " ENDSAY;                70674000
            SAYNUM (OUTSTANDING'IOS);                                   70675000
            SAY " - BUFFER = " ENDSAY;                                  70676000
            SAYNUM (CURR'WAIT'BUFFER);                                  70677000
            SAY " - STATUS = " ENDSAY;                                  70678000
            SAYOCTAL (ATTIO'RET'1.(08:08));                             70679000
            IF ATTIO'RET'1.(13:3)=ATTIO'GOOD AND LAST'READ'WAS'EOF THEN 70680000
               BEGIN                                                    70681000
               SAY " - LEN = " ENDSAY;                                  70682000
               SAYNUM (ATTIO'RET'2);                                    70683000
               SAY " - '" ENDSAY;                                       70684000
               MOVE'DATA'IN (BUFFER'XDS (CURR'WAIT'BUFFER),             70685000
                             BUFFER'OFFSET (CURR'WAIT'BUFFER),          70686000
                             TDBUF, 3*FILE'PART'WORDS);                 70687000
               SAY TDBUF', (3*FILE'PART'SIZE) ENDSAY;                   70688000
               SAY "'" ENDSAY;                                          70689000
               END;                                                     70690000
            SEND;                                                       70691000
            END;                                                        70692000
$IF                                                                     70693000
                                                                        70694000
         IF ATTIO'RET'1.(13:3) = ATTIO'EOF THEN    << Tape Mark       >>70695000
            BEGIN                                                       70696000
            EOFS'LEFT        := EOFS'LEFT - 1D;                         70697000
            LAST'ONE'WAS'EOF := TRUE;                                   70698000
            END                                                         70699000
                                                                        70700000
         ELSE IF ATTIO'RET'1.(8:8) = ATTIO'PRIOR'ERROR THEN             70701000
            << Ignore - Prior Error Abort                             >>70702000
                                                                        70703000
         ELSE IF ATTIO'RET'1.(13:3) <> ATTIO'GOOD THEN    << Error    >>70704000
            BEGIN                                                       70705000
            ERRORNUM := ATTIO'RET'1.(8:8);                              70706000
            KEEP'GOING := FALSE;                                        70707000
            END                                                         70708000
                                                                        70709000
         ELSE                                 << Successful read      >>70710000
            BEGIN                                                       70711000
                                                                        70712000
            LEN := ATTIO'RET'2;                                         70713000
                                                                        70714000
            IF LEN = TAPE'LABEL'SIZE THEN     << Store/Restore Label  >>70715000
               BEGIN                                                    70716000
               CHECK'TAPE'LABEL (TDBUF);                                70717000
               IF LAST'REEL THEN END'OF'TAPE'SET := TRUE                70718000
               ELSE IF GET'NEXT'VOLUME (GBUF'D (G'FILENUM'INX'D),       70719000
                                        PARMS'TEMPD'1) <> 0 THEN FAIL;  70720000
               LAST'ONE'WAS'EOF := NOT TL'SPANTOG;                      70721000
               KEEP'GOING := FALSE;                                     70722000
               END                                                      70723000
                                                                        70724000
            ELSE IF LAST'ONE'WAS'EOF THEN     << This is a read after >>70725000
               BEGIN                                                    70726000
               MOVE'TO'TDBUF;                                           70727000
               IF TDBUF' = GBUF' (G'TITLE'INX'), (3*FILE'PART'SIZE) THEN70728000
                  BEGIN                                                 70729000
                  FOUNDFLAG  := TRUE;         << Yay, Found it.       >>70730000
                  EOFS'LEFT  := 0D;                                     70731000
                  KEEP'GOING := FALSE;                                  70732000
                  END;                                                  70733000
               LAST'ONE'WAS'EOF := FALSE;                               70734000
               END;                                                     70735000
            END;                                                        70736000
         END;                                                           70737000
      END;                                                              70738000
                                                                        70739000
   IF LAST'ONE'WAS'EOF AND EOFS'LEFT = 0D THEN  << Next read shld be i>>70740000
      BEGIN                                                             70741000
      START'A'READ (TAPE'RECSIZE);                                      70742000
      ISSUE'READ (TDBUF, TAPE'RECSIZE, FALSE);                          70743000
      MOVE'TO'TDBUF;                                                    70744000
      END;                                                              70745000
                                                                        70746000
END'PRE'SCAN'FOR'MATCH:                                                 70747000
                                                                        70748000
   PRE'SCAN'FOR'MATCH := FOUNDFLAG;             << Set return         >>70749000
                                                                        70750000
END;                                                                    70751000
$PAGE "LOOK'FOR'EOF"                                                    70752000
$CONTROL SEGMENT=RESTORE                                                70753000
<<---------------------------------------->>                            70754000
<<  LOOK'FOR'EOF                          >>                            70755000
<<---------------------------------------->>                            70756000
                                                                        70757000
INTEGER PROCEDURE LOOK'FOR'EOF (GBUF,  STOP'FOR'ERROR);                 70758000
   VALUE STOP'FOR'ERROR;                                                70759000
   LOGICAL STOP'FOR'ERROR;          << Should we stop for error(r/o)  >>70760000
   LOGICAL ARRAY                                                        70761000
      GBUF;                         << Buffer for GOOD record  (r/o)  >>70762000
                                                                        70763000
   << This routine checks through all the outstanding i/o looking     >>70764000
   << for a tape mark.  If a tape mark is found ATTIO'EOF is returned >>70765000
   << If no error occurs ATTIO'GOOD is returned.  If an error occurs  >>70766000
   << the error number is returned.  This code is only used by the    >>70767000
   << ATTACHIO code.                                                  >>70768000
                                                                        70769000
BEGIN                                                                   70770000
   LOGICAL                                                              70771000
      KEEP'GOING       := TRUE;     << Should we keep looping         >>70772000
                                                                        70773000
   DOUBLE                                                               70774000
      ATTACHIO'RET     := 0D;       << Return from WAITFORIO          >>70775000
                                                                        70776000
   INTEGER POINTER                                                      70777000
      TDBUF;                        << Dummy pointer                  >>70778000
                                                                        70779000
   INTEGER                                                              70780000
      ATTACHIO'RET'1   =  ATTACHIO'RET,                                 70781000
      ATTACHIO'RET'2   =  ATTACHIO'RET + 1,                             70782000
      NEW'WAIT'BUFFER;              << Temp var. for buffer number    >>70783000
                                                                        70784000
   DOUBLE ARRAY                                                         70785000
      GBUF'D (*)       = GBUF;      << Buffer for GOOD record         >>70786000
                                                                        70787000
   <<---------------------------------------->>                         70788000
   <<  FAIL of LOOK'FOR'EOF                  >>                         70789000
   <<---------------------------------------->>                         70790000
                                                                        70791000
   SUBROUTINE FAIL;                                                     70792000
                                                                        70793000
      << This procedure starts the termination of the program.        >>70794000
                                                                        70795000
   BEGIN                                                                70796000
      LOOK'FOR'EOF := -1;                                               70797000
      GOTO END'LOOK'FOR'EOF;                                            70798000
   END;                                                                 70799000
$PAGE                                                                   70800000
   IF NOT USING'ATTIO THEN       << Terminate if not using ATTACHIO co>>70801000
      RETURN;                                                           70802000
                                                                        70803000
   WHILE KEEP'GOING DO                                                  70804000
      BEGIN                                                             70805000
                                                                        70806000
      IF OUTSTANDING'IOS = 0 THEN                   << No more IOs    >>70807000
         KEEP'GOING := FALSE                                            70808000
      ELSE                                                              70809000
         BEGIN                                                          70810000
         CURR'WAIT'BUFFER := CURR'WAIT'BUFFER + 1;  << update buff num>>70811000
         IF CURR'WAIT'BUFFER = NUM'BUFFERS THEN                         70812000
            CURR'WAIT'BUFFER := 0;                                      70813000
                                                                        70814000
         << Wait for IO.  Decrement num of IOs.  Clear IOQ entry.     >>70815000
                                                                        70816000
         ATTACHIO'RET := WAITFORIO (IO'QUEUE (2*CURR'WAIT'BUFFER) );    70817000
         OUTSTANDING'IOS := OUTSTANDING'IOS - 1;                        70818000
         IO'QUEUE'D (CURR'WAIT'BUFFER) := 0D;                           70819000
                                                                        70820000
         << Intepret WAITFORIO return                                 >>70821000
                                                                        70822000
         IF ATTACHIO'RET'1.(8:8) = ATTIO'PRIOR'ERROR THEN               70823000
            KEEP'GOING := TRUE    ! Ignore - Prior Error Abort          70824000
                                                                        70825000
         ELSE IF ATTACHIO'RET'2 = TAPE'LABEL'SIZE THEN   ! Tape label   70826000
            BEGIN                                                       70827000
            KEEP'GOING := FALSE;                                        70828000
            CHECK'TAPE'LABEL (TDBUF);                                   70829000
            IF LAST'REEL THEN END'OF'TAPE'SET := TRUE                   70830000
            ELSE IF GET'NEXT'VOLUME (GBUF'D (G'FILENUM'INX'D),          70831000
                                     PARMS'TEMPD'1) <>   0 THEN FAIL;   70832000
            IF TL'SPANTOG THEN ATTACHIO'RET'1 := ATTIO'GOOD             70833000
            ELSE ATTACHIO'RET'1 := ATTIO'EOF;                           70834000
            END                                                         70835000
                                                                        70836000
         ELSE IF ATTACHIO'RET'1.(13:3) = ATTIO'GOOD THEN                70837000
            KEEP'GOING := TRUE           ! Not an EOF                   70838000
                                                                        70839000
         ELSE IF ATTACHIO'RET'1.(13:3) = ATTIO'EOF  THEN                70840000
            KEEP'GOING := FALSE          ! An EOF was found.            70841000
                                                                        70842000
         ELSE                            ! An error was found.          70843000
            KEEP'GOING := NOT STOP'FOR'ERROR;                           70844000
                                                                        70845000
$IF X1=ON THEN                                                          70846000
            IF DEBUGGING THEN                                           70847000
               BEGIN                                                    70848000
               SAY "LOOKING FOR EOF - IOS = " ENDSAY;                   70849000
               SAYNUM (OUTSTANDING'IOS);                                70850000
               SAY " - BUFFER = " ENDSAY;                               70851000
               SAYNUM (CURR'WAIT'BUFFER);                               70852000
               SAY " - STATUS = " ENDSAY;                               70853000
               SAYOCTAL (ATTACHIO'RET'1.(8:8));                         70854000
               SEND;                                                    70855000
               END;                                                     70856000
$IF                                                                     70857000
         END;                                                           70858000
      END;                                                              70859000
                                                                        70860000
END'LOOK'FOR'EOF:                                                       70861000
                                                                        70862000
   LOOK'FOR'EOF := ATTACHIO'RET'1.(13:3);    ! Set return to last status70863000
                                                                        70864000
END;                                                                    70865000
$PAGE "START'A'READ"                                                    70866000
$CONTROL SEGMENT=RESTORE                                                70867000
<<---------------------------------------->>                            70868000
<<  START'A'READ                          >>                            70869000
<<---------------------------------------->>                            70870000
                                                                        70871000
PROCEDURE START'A'READ (READLENGTH);                                    70872000
   VALUE READLENGTH;                                                    70873000
   INTEGER READLENGTH;             ! Length of read (r/o)               70874000
                                                                        70875000
   ! This procedure calls ATTACHIO which starts a read of length        70876000
   ! READLENGTH.  If there are no available buffers, no call is         70877000
   ! made.  This procedure is only used in the ATTACHIO code.           70878000
                                                                        70879000
BEGIN                                                                   70880000
   IF NOT USING'ATTIO THEN              ! Must be using ATTACHIO code   70881000
      RETURN;                                                           70882000
                                                                        70883000
$IF X1=ON THEN                                                          70884000
   IF DEBUGGING THEN                                                    70885000
      BEGIN                                                             70886000
      SAY "START'A'READ - BUFFER " ENDSAY;                              70887000
      SAYNUM (CURR'READ'BUFFER);                                        70888000
      SAY " - LENGTH " ENDSAY;                                          70889000
      SAYNUM (READLENGTH);                                              70890000
      SEND;                                                             70891000
      END;                                                              70892000
$IF                                                                     70893000
                                                                        70894000
   IF OUTSTANDING'IOS = NUM'BUFFERS THEN     ! Is there room for another70895000
      RETURN;                                ! read?                    70896000
                                                                        70897000
   DISABLE'ARITHMETIC'TRAPS;                                            70898000
                                                                        70899000
   IO'QUEUE'D (CURR'READ'BUFFER) := ATTACHIO (                          70900000
                  TAPE'LDEV,                          <<ldev>>          70901000
                  0,                                  <<qmisc>>         70902000
                  BUFFER'XDS (CURR'READ'BUFFER),      <<DST #>>         70903000
                  BUFFER'OFFSET (CURR'READ'BUFFER),   <<offset>>        70904000
                  ATTIO'READ,                         <<read>>          70905000
                  READLENGTH,                         <<buff size>>     70906000
                  0,                                  <<p1>>            70907000
                  0,                                  <<p2>>            70908000
                  0);                                 <<unblocked>>     70909000
                                                                        70910000
   ENABLE'ARITHMETIC'TRAPS;                                             70911000
                                                                        70912000
   OUTSTANDING'IOS := OUTSTANDING'IOS + 1;                              70913000
                                                                        70914000
   CURR'READ'BUFFER := CURR'READ'BUFFER + 1;   ! update read buffer num 70915000
   IF CURR'READ'BUFFER = NUM'BUFFERS THEN                               70916000
      CURR'READ'BUFFER := 0;                                            70917000
                                                                        70918000
$IF X1=ON THEN                                                          70919000
   IF DEBUGGING THEN                                                    70920000
      BEGIN                                                             70921000
      SAY "   ISSUED - NEW READ'BUFFER IS " ENDSAY;                     70922000
      SAYNUM (CURR'READ'BUFFER);                                        70923000
      SEND;                                                             70924000
      END;                                                              70925000
$IF                                                                     70926000
                                                                        70927000
END;                                                                    70928000
$PAGE "ISSUE'READ"                                                      70929000
$CONTROL SEGMENT=RESTORE                                                70930000
<<---------------------------------------->>                            70931000
<<  ISSUE'READ                            >>                            70932000
<<---------------------------------------->>                            70933000
                                                                        70934000
PROCEDURE ISSUE'READ (BUFFER, READLENGTH, USE'WAIT'IO);                 70935000
   VALUE READLENGTH, USE'WAIT'IO;                                       70936000
   LOGICAL ARRAY BUFFER;      ! Buffer for read (w/o)                   70937000
   INTEGER READLENGTH;        ! Length of read (w/o)                    70938000
   LOGICAL USE'WAIT'IO;       ! Use blocked IO? (r/o)                   70939000
                                                                        70940000
   ! This procedure does a read from the tape.  There are three types   70941000
   ! of read.  In all cases, length is returned in READ'TAPE'LEN, an    70942000
   ! error is indicated by a nonzero value in ERROR'CODE, and           70943000
   ! a tape mark is indicated by a TRUE in READ'TAPE'EOF.               70944000
   !                                                                    70945000
   !    FILESYS read - read is done by FREAD.  ERROR'CODE is set to     70946000
   !                   file system error number.  Data is placed in     70947000
   !                   BUFFER.  This method is used when not using the  70948000
   !                   ATTACHIO code.                                   70949000
   !                                                                    70950000
   !    WAIT read    - read is done by ATTACHIO.  The attachio uses a   70951000
   !                   blocked read.  ERROR'CODE is set to the          70952000
   !                   ATTACHIO error number. Data is placed in BUFFER. 70953000
   !                   This method is used when using the ATTACHIO code 70954000
   !                   and USE'WAIT'IO is TRUE.                         70955000
   !                                                                    70956000
   !    NOWAIT read  - read is done by ATTACHIO.  The attachio uses an  70957000
   !                   unblocked read.  ERROR'CODE is set to the        70958000
   !                   ATTACHIO error number.  Data is placed in the    70959000
   !                   extra data segment buffer pointed to by          70960000
   !                   CURR'WAIT'BUFFER.  This method is used when      70961000
   !                   using the ATTACHIO code and USE'WAIT'IO is       70962000
   !                   FALSE.                                           70963000
                                                                        70964000
BEGIN                                                                   70965000
                                                                        70966000
   BYTE ARRAY                                                           70967000
      BUFFER' (*) = BUFFER;            ! Buffer for read                70968000
                                                                        70969000
   DOUBLE                                                               70970000
      ATTACHIO'RET;                    ! Return from ATTACHIO/WAITFORIO 70971000
                                                                        70972000
   INTEGER                                                              70973000
      ATTACHIO'RET'1 = ATTACHIO'RET,                                    70974000
      ATTACHIO'RET'2 = ATTACHIO'RET + 1;                                70975000
$PAGE "WRITE'DEBUGGING'INFO of ISSUE'READ"                              70976000
   <<---------------------------------------->>                         70977000
   <<  WRITE'DEBUGGING'INFO of ISSUE'READ    >>                         70978000
   <<---------------------------------------->>                         70979000
                                                                        70980000
   SUBROUTINE WRITE'DEBUGGING'INFO;                                     70981000
                                                                        70982000
      ! This routin writes out information about this call of ISSUE'READ70983000
                                                                        70984000
   BEGIN                                                                70985000
$IF X1=ON THEN                                                          70986000
      IF DEBUGGING THEN                                                 70987000
         BEGIN                                                          70988000
         SAY "ISSUE'READ " ENDSAY;                                      70989000
         IF USING'ATTIO AND NOT USE'WAIT'IO THEN                        70990000
            BEGIN                                                       70991000
            SAY " - BUFFER = " ENDSAY;                                  70992000
            SAYNUM (CURR'WAIT'BUFFER);                                  70993000
            SAY " -" ENDSAY;                                            70994000
            END;                                                        70995000
         IF READ'TAPE'EOF THEN                                          70996000
            SAY "*EOF FOUND*" ENDSAY                                    70997000
         ELSE IF ERROR'CODE <> 0 THEN                                   70998000
            BEGIN                                                       70999000
            SAY "***ERROR=" ENDSAY;                                     71000000
            SAYNUM (ERROR'CODE);                                        71001000
            END                                                         71002000
         ELSE                                                           71003000
            BEGIN                                                       71004000
            SAY "-LEN=" ENDSAY;                                         71005000
            SAYNUM (READ'TAPE'LEN);                                     71006000
            IF USING'ATTIO AND NOT USE'WAIT'IO THEN                     71007000
               BEGIN                                                    71008000
               MOVE'DATA'IN (BUFFER'XDS (CURR'WAIT'BUFFER),             71009000
                             BUFFER'OFFSET (CURR'WAIT'BUFFER),          71010000
                             BUFFER, 10);                               71011000
               END;                                                     71012000
            SAY "-'" ENDSAY;                                            71013000
            SAY BUFFER', (20) ENDSAY;                                   71014000
            SAY1 ("'");                                                 71015000
            END;                                                        71016000
         SEND;                                                          71017000
         END;                                                           71018000
$IF                                                                     71019000
   END;                                                                 71020000
$PAGE "DEBUG'ISSUE'READ of ISSUE'READ"                                  71021000
   <<---------------------------------------->>                         71022000
   <<  DEBUG'ISSUE'READ of ISSUE'READ        >>                         71023000
   <<---------------------------------------->>                         71024000
                                                                        71025000
   SUBROUTINE DEBUG'ISSUE'READ;                                         71026000
                                                                        71027000
      ! For testing only - Changes the return values of successful reads71028000
                                                                        71029000
   BEGIN                                                                71030000
$IF X1=ON THEN                                                          71031000
      IF DEBUG'ERRORS THEN                                              71032000
         BEGIN                                                          71033000
         SAY "FREAD ON TAPE WORKED OK - INJECT'ERROR? " ENDSAY;         71034000
         SENDSTOP;                                                      71035000
         AFFIRM (PARMS'TEMPI'1,FALSE);                                  71036000
         IF LOGICAL (PARMS'TEMPI'1) THEN                                71037000
            BEGIN                                                       71038000
            BUFFER := "  ";                                             71039000
            SAY "EOF? " ENDSAY;                                         71040000
            SENDSTOP;                                                   71041000
            AFFIRM (PARMS'TEMPI'1, FALSE);                              71042000
            IF LOGICAL (PARMS'TEMPI'1) THEN READ'TAPE'EOF := TRUE       71043000
            ELSE ERROR'CODE := 3;                                       71044000
            END;                                                        71045000
         END;                                                           71046000
$IF                                                                     71047000
   END;                                                                 71048000
$PAGE "ISSUE'READ'FILE'SYS of ISSUE'READ"                               71049000
   <<---------------------------------------->>                         71050000
   <<  ISSUE'READ'FILE'SYS of ISSUE'READ     >>                         71051000
   <<---------------------------------------->>                         71052000
                                                                        71053000
   SUBROUTINE ISSUE'READ'FILE'SYS;                                      71054000
                                                                        71055000
      ! This routine calls FREAD against the tape                       71056000
                                                                        71057000
   BEGIN                                                                71058000
      READ'TAPE'LEN := FREAD (T'NUM, BUFFER, READLENGTH);               71059000
      IF = THEN DEBUG'ISSUE'READ                                        71060000
      ELSE IF > THEN READ'TAPE'EOF := TRUE                              71061000
      ELSE IF < THEN FCHECK (T'NUM, ERROR'CODE);                        71062000
   END;                                                                 71063000
$PAGE "ISSUE'READ'WAIT'ATTIO of ISSUE'READ"                             71064000
   <<---------------------------------------->>                         71065000
   <<  ISSUE'READ'WAIT'ATTIO of ISSUE'READ   >>                         71066000
   <<---------------------------------------->>                         71067000
                                                                        71068000
   SUBROUTINE ISSUE'READ'WAIT'ATTIO;                                    71069000
                                                                        71070000
      ! This routine issues a read with a waited ATTACHIO               71071000
                                                                        71072000
   BEGIN                                                                71073000
      DISABLE'ARITHMETIC'TRAPS;                                         71074000
      ATTACHIO'RET := ATTACHIO (TAPE'LDEV,      <<ldev>>                71075000
                                 0,              <<qmisc>>              71076000
                                 0,              <<use stack>>          71077000
                                 @BUFFER,        <<buffer>>             71078000
                                 ATTIO'READ,     <<read>>               71079000
                                 READLENGTH,     <<buffer size>>        71080000
                                 0,              <<p1>>                 71081000
                                 0,              <<p2>>                 71082000
                                 1);             <<blocked>>            71083000
                                                                        71084000
      ENABLE'ARITHMETIC'TRAPS;                                          71085000
                                                                        71086000
      IF ATTACHIO'RET'1.(13:3) = ATTIO'EOF THEN         <<EOF>>         71087000
         READ'TAPE'EOF := TRUE                                          71088000
      ELSE IF ATTACHIO'RET'1.(13:3) <> ATTIO'GOOD THEN                  71089000
         ERROR'CODE := ATTACHIO'RET'1.(08:08)                           71090000
      ELSE                                                              71091000
         BEGIN                                                          71092000
         READ'TAPE'LEN := ATTACHIO'RET'2;                               71093000
         DEBUG'ISSUE'READ;                                              71094000
         END;                                                           71095000
   END;                                                                 71096000
$PAGE "ISSUE'READ'NO'WAIT'ATTIO of ISSUE'READ"                          71097000
   <<---------------------------------------->>                         71098000
   <<  ISSUE'READ'NO'WAIT'ATTIO of ISSUE'READ>>                         71099000
   <<---------------------------------------->>                         71100000
                                                                        71101000
   SUBROUTINE ISSUE'READ'NO'WAIT'ATTIO;                                 71102000
                                                                        71103000
      ! This routine waits for an already started read to finish        71104000
                                                                        71105000
   BEGIN                                                                71106000
                                                                        71107000
START'AGAIN:                                                            71108000
                                                                        71109000
      IF OUTSTANDING'IOS = 0 THEN                                       71110000
         START'A'READ (TAPE'RECSIZE);                                   71111000
                                                                        71112000
      CURR'WAIT'BUFFER := CURR'WAIT'BUFFER + 1;                         71113000
      IF CURR'WAIT'BUFFER = NUM'BUFFERS THEN                            71114000
         CURR'WAIT'BUFFER := 0;                                         71115000
                                                                        71116000
      IF IO'QUEUE'D (CURR'WAIT'BUFFER) = 0D THEN                        71117000
         ERROR'CODE := 1                                                71118000
      ELSE                                                              71119000
         BEGIN                                                          71120000
         DISABLE'ARITHMETIC'TRAPS;                                      71121000
                                                                        71122000
         ATTACHIO'RET := WAITFORIO (IO'QUEUE (2*CURR'WAIT'BUFFER) );    71123000
                                                                        71124000
         ENABLE'ARITHMETIC'TRAPS;                                       71125000
                                                                        71126000
         OUTSTANDING'IOS := OUTSTANDING'IOS - 1;                        71127000
                                                                        71128000
         IO'QUEUE'D (CURR'WAIT'BUFFER) := 0D;                           71129000
                                                                        71130000
         IF ATTACHIO'RET'1.(13:3) = ATTIO'EOF THEN         <<EOF>>      71131000
            READ'TAPE'EOF := TRUE                                       71132000
         ELSE IF ATTACHIO'RET'1.(8:8) = ATTIO'PRIOR'ERROR THEN          71133000
            BEGIN                                                       71134000
            START'A'READ (READLENGTH);                                  71135000
            GO TO START'AGAIN;                                          71136000
            END                                                         71137000
         ELSE IF ATTACHIO'RET'1.(13:3) <> ATTIO'GOOD THEN               71138000
            ERROR'CODE := ATTACHIO'RET'1.(08:08)  ! Error               71139000
                                                                        71140000
         ELSE                       ! Read was successful               71141000
            BEGIN                                                       71142000
            READ'TAPE'LEN := ATTACHIO'RET'2;   ! Set Length             71143000
            DEBUG'ISSUE'READ;                                           71144000
            END;                                                        71145000
                                                                        71146000
         END;                                                           71147000
                                                                        71148000
   END;                                                                 71149000
$PAGE "ISSUE'READ mainline"                                             71150000
   ! Initialize return variables                                        71151000
                                                                        71152000
   BUFFER        := "  ";                                               71153000
   ERROR'CODE    := 0;                                                  71154000
   READ'TAPE'EOF := FALSE;                                              71155000
   READ'TAPE'LEN := 0;                                                  71156000
                                                                        71157000
   IF END'OF'TAPE'SET THEN                                              71158000
      BEGIN                                                             71159000
      READ'TAPE'EOF := TRUE;                                            71160000
      RETURN;                                                           71161000
      END;                                                              71162000
                                                                        71163000
   ! Call appropriate subroutine                                        71164000
                                                                        71165000
   IF NOT USING'ATTIO THEN                                              71166000
      ISSUE'READ'FILE'SYS                                               71167000
                                                                        71168000
   ELSE IF USE'WAIT'IO THEN                                             71169000
      ISSUE'READ'WAIT'ATTIO                                             71170000
                                                                        71171000
   ELSE                                                                 71172000
      ISSUE'READ'NO'WAIT'ATTIO;                                         71173000
                                                                        71174000
   WRITE'DEBUGGING'INFO;                                                71175000
                                                                        71176000
END;                                                                    71177000
$PAGE "ISSUE'CTRL"                                                      71178000
$CONTROL SEGMENT=RESTORE                                                71179000
<<---------------------------------------->>                            71180000
<<  ISSUE'CTRL                            >>                            71181000
<<---------------------------------------->>                            71182000
                                                                        71183000
PROCEDURE ISSUE'CTRL (FUNC);                                            71184000
   VALUE   FUNC;                                                        71185000
   LOGICAL FUNC;           ! Function to be performed (r/o)             71186000
                                                                        71187000
   ! This procedure issues a control statement to the tape drive.       71188000
   ! If an error occurs ERROR'CODE will be set to a nonzero  value.     71189000
   ! If using the ATTACHIO code, ISSUE'CTRL uses ATTACHIO. Otherwise,   71190000
   ! FCONTROL is used.  FUNC is the control function to be performed.   71191000
                                                                        71192000
BEGIN                                                                   71193000
                                                                        71194000
   DOUBLE                                                               71195000
      ATTACHIO'RET;        ! Return from ATTACHIO                       71196000
                                                                        71197000
   INTEGER                                                              71198000
      ATTACHIO'RET'1 = ATTACHIO'RET,                                    71199000
      ATTACHIO'RET'2 = ATTACHIO'RET + 1;                                71200000
                                                                        71201000
   <<---------------------------------------->>                         71202000
   <<  ISSUE'CTRL'FILE'SYS of ISSUE'CTRL     >>                         71203000
   <<---------------------------------------->>                         71204000
                                                                        71205000
   SUBROUTINE ISSUE'CTRL'FILE'SYS;                                      71206000
                                                                        71207000
      ! Routine calls FCONTROL and sets ERROR'CODE if an error occurs   71208000
                                                                        71209000
   BEGIN                                                                71210000
      FCONTROL (T'NUM, FUNC, PARMS'TEMPI'1);                            71211000
      IF <> THEN                                                        71212000
         FCHECK (T'NUM, ERROR'CODE);                                    71213000
   END;                                                                 71214000
                                                                        71215000
                                                                        71216000
                                                                        71217000
                                                                        71218000
   <<---------------------------------------->>                         71219000
   <<  ISSUE'CTRL'ATTIO of ISSUE'CTRL        >>                         71220000
   <<---------------------------------------->>                         71221000
                                                                        71222000
   SUBROUTINE ISSUE'CTRL'ATTIO;                                         71223000
                                                                        71224000
      ! Routine calls ATTACHIO and sets ERROR'CODE if an error occurs   71225000
                                                                        71226000
   BEGIN                                                                71227000
      DISABLE'ARITHMETIC'TRAPS;                                         71228000
      ATTACHIO'RET := ATTACHIO ( TAPE'LDEV,      <<ldev>>               71229000
                                  0,              <<qmisc>>             71230000
                                  0,              <<use stack>>         71231000
                                  0,              <<buffer addr>>       71232000
                                  FUNC,           <<file skip fwd>>     71233000
                                  0,              <<count>>             71234000
                                  0,              <<p1>>                71235000
                                  0,              <<p2>>                71236000
                                  1);             <<wait>>              71237000
                                                                        71238000
      ENABLE'ARITHMETIC'TRAPS;                                          71239000
                                                                        71240000
      IF ATTACHIO'RET'1.(13:3) <> ATTIO'GOOD THEN                       71241000
         ERROR'CODE := ATTACHIO'RET'1.(8:8);                            71242000
   END;                                                                 71243000
                                                                        71244000
                                                                        71245000
$IF X1=ON THEN                                                          71246000
   IF DEBUGGING THEN                                                    71247000
      BEGIN                                                             71248000
      SAY "ENTERING ISSUE'CTRL - FUNC = " ENDSAY;                       71249000
      SAYNUM (FUNC);                                                    71250000
      SEND;                                                             71251000
      END;                                                              71252000
$IF                                                                     71253000
                                                                        71254000
   ! Zero ERROR'CODE and call appropriate subroutine.                   71255000
                                                                        71256000
   ERROR'CODE := 0;                                                     71257000
                                                                        71258000
   IF END'OF'TAPE'SET THEN                                              71259000
      RETURN;                                                           71260000
                                                                        71261000
   IF NOT USING'ATTIO THEN                                              71262000
      ISSUE'CTRL'FILE'SYS                                               71263000
   ELSE                                                                 71264000
      ISSUE'CTRL'ATTIO;                                                 71265000
                                                                        71266000
$IF X1=ON THEN                                                          71267000
   IF DEBUGGING THEN                                                    71268000
      BEGIN                                                             71269000
      SAY "   CTRL COMPLETED - ERROR'CODE = " ENDSAY;                   71270000
      SAYNUM (ERROR'CODE);                                              71271000
      SEND;                                                             71272000
      END;                                                              71273000
$IF                                                                     71274000
END;                                                                    71275000
$PAGE "ISSUE'SKIP"                                                      71276000
$CONTROL SEGMENT=RESTORE                                                71277000
<<---------------------------------------->>                            71278000
<<  ISSUE'SKIP                            >>                            71279000
<<---------------------------------------->>                            71280000
                                                                        71281000
PROCEDURE ISSUE'SKIP (USE'WAIT'IO);                                     71282000
   VALUE USE'WAIT'IO;                                                   71283000
   LOGICAL USE'WAIT'IO;                                                 71284000
                                                                        71285000
   ! This procedure issues a File-Skip-Forward to the tape drive.  If   71286000
   ! an error occurs, ERROR'CODE will be set to a nonzero value.        71287000
   ! There are four different ways this procedure talks to the tape     71288000
   ! drive.                                                             71289000
   !                                                                    71290000
   !   UNLABELED FILESYS  - calls ISSUE'CTRL which uses FCONTROL.       71291000
   !   LABELED   FILESYS  - issues a NEXTTAPEFILE.                      71292000
   !   WAIT      ATTACHIO - calls ISSUE'CTRL which uses blocked ATTACHIO71293000
   !   NOWAIT    ATTACHIO - issues a WAITFORIO against an io started by 71294000
   !                        START'A'SKIP.                               71295000
                                                                        71296000
BEGIN                                                                   71297000
                                                                        71298000
   DOUBLE                                                               71299000
      ATTACHIO'RET;                                                     71300000
                                                                        71301000
   INTEGER                                                              71302000
      ATTACHIO'RET'1         = ATTACHIO'RET,                            71303000
      ATTACHIO'RET'2         = ATTACHIO'RET;                            71304000
$PAGE "ISSUE'SKIP'LABELED of ISSUE'SKIP"                                71305000
   <<---------------------------------------->>                         71306000
   <<  ISSUE'SKIP'LABELED of ISSUE'SKIP      >>                         71307000
   <<---------------------------------------->>                         71308000
                                                                        71309000
   SUBROUTINE ISSUE'SKIP'LABELED;                                       71310000
                                                                        71311000
      ! Calls NextTapeFile to skip to the next file on a labeled tape   71312000
                                                                        71313000
   BEGIN                                                                71314000
      ERROR'CODE := NEXTTAPEFILE (T'NUM);                               71315000
      IF = THEN ERROR'CODE := 0;                                        71316000
   END;                                                                 71317000
                                                                        71318000
   <<---------------------------------------->>                         71319000
   <<  ISSUE'SKIP'NO'WAIT'IO of ISSUE'SKIP   >>                         71320000
   <<---------------------------------------->>                         71321000
                                                                        71322000
   SUBROUTINE ISSUE'SKIP'NO'WAIT'IO;                                    71323000
                                                                        71324000
      ! Waits for an already started ATTACHIO (code=7) to complete      71325000
                                                                        71326000
   BEGIN                                                                71327000
      DISABLE'ARITHMETIC'TRAPS;                                         71328000
                                                                        71329000
      ATTACHIO'RET := WAITFORIO (IOQ'FSF (0));                          71330000
                                                                        71331000
      IOQ'FSF'D (0) := IOQ'FSF'D (1);                                   71332000
      IOQ'FSF'D (1) := 0D;                                              71333000
                                                                        71334000
      ENABLE'ARITHMETIC'TRAPS;                                          71335000
                                                                        71336000
      IF ATTACHIO'RET'1.(13:3) <> ATTIO'GOOD THEN                       71337000
         ERROR'CODE := ATTACHIO'RET'1.(8:8);                            71338000
   END;                                                                 71339000
$PAGE "ISSUE'SKIP MAINLINE"                                             71340000
   ! Call appropriate routine                                           71341000
                                                                        71342000
   ERROR'CODE := 0;                                                     71343000
                                                                        71344000
   IF END'OF'TAPE'SET THEN                                              71345000
      RETURN;                                                           71346000
                                                                        71347000
   IF LABELED THEN                                                      71348000
      ISSUE'SKIP'LABELED                                                71349000
   ELSE IF NOT USING'ATTIO OR USE'WAIT'IO THEN                          71350000
      ISSUE'CTRL (ATTIO'FSF)                                            71351000
   ELSE                                                                 71352000
      ISSUE'SKIP'NO'WAIT'IO;                                            71353000
END;                                                                    71354000
$PAGE "START'A'SKIP"                                                    71355000
$CONTROL SEGMENT=RESTORE                                                71356000
<<---------------------------------------->>                            71357000
<<  START'A'SKIP                          >>                            71358000
<<---------------------------------------->>                            71359000
                                                                        71360000
PROCEDURE START'A'SKIP;                                                 71361000
                                                                        71362000
   ! This procedure starts a SKIP by calling ATTACHIO with unblocked    71363000
   ! io.  At most, two SKIPS may be outstanding.  If one skip is        71364000
   ! pending, then this adds the new skip AFTER the old one.            71365000
   ! This code is used only with the ATTACHIO code.                     71366000
                                                                        71367000
BEGIN                                                                   71368000
   INTEGER QUEUE'NUM;                                                   71369000
   INTEGER STAT;                                                        71370000
                                                                        71371000
   IF END'OF'TAPE'SET THEN                                              71372000
      RETURN;                                                           71373000
                                                                        71374000
   IF NOT USING'ATTIO THEN                                              71375000
      RETURN;                                                           71376000
                                                                        71377000
   IF IOQ'FSF'D = 0D THEN QUEUE'NUM := 0                                71378000
   ELSE QUEUE'NUM := 1;                                                 71379000
                                                                        71380000
$IF X1=ON THEN                                                          71381000
   IF DEBUGGING THEN                                                    71382000
      BEGIN                                                             71383000
      SAY "START'A'SKIP - QUEUE NUM = " ENDSAY;                         71384000
      SAYNUM (QUEUE'NUM);                                               71385000
      END;                                                              71386000
$IF                                                                     71387000
                                                                        71388000
!  STAT := LOOK'FOR'EOF;                                                71389000
!  IF STAT = ATTIO'GOOD THEN                                            71390000
   IF TRUE THEN                                                         71391000
      BEGIN                                                             71392000
      DISABLE'ARITHMETIC'TRAPS;                                         71393000
                                                                        71394000
      IOQ'FSF'D (QUEUE'NUM) := ATTACHIO (                               71395000
                                  TAPE'LDEV,      <<ldev>>              71396000
                                  0,              <<qmisc>>             71397000
                                  0,              <<use stack>>         71398000
                                  0,              <<buffer addr>>       71399000
                                  ATTIO'FSF,      <<file skip fwd>>     71400000
                                  0,              <<count>>             71401000
                                  0,              <<p1>>                71402000
                                  0,              <<p2>>                71403000
                                  0);             <<wait>>              71404000
                                                                        71405000
      ENABLE'ARITHMETIC'TRAPS;                                          71406000
      END                                                               71407000
                                                                        71408000
   ELSE IF STAT <> ATTIO'EOF THEN                                       71409000
      ERROR'CODE := STAT;                                               71410000
                                                                        71411000
$IF X1=ON THEN                                                          71412000
   IF DEBUGGING THEN                                                    71413000
      BEGIN                                                             71414000
      SAY "   ATTACHIO ISSUED" ENDSAY;                                  71415000
      SEND;                                                             71416000
      END;                                                              71417000
$IF                                                                     71418000
                                                                        71419000
END;                                                                    71420000
$PAGE "ADJUSTFPTR"                                                      71421000
$CONTROL SEGMENT=RESTORE                                                71422000
<<---------------------------------------->>                            71423000
<<  ADJUST'FPTR                           >>                            71424000
<<---------------------------------------->>                            71425000
                                                                        71426000
INTEGER PROCEDURE ADJUST'FPTR (ELEMENT, LEVEL, PARMS, SIR);             71427000
   VALUE LEVEL,PARMS,SIR;                                               71428000
   INTEGER LEVEL, PARMS;                                                71429000
   INTEGER ARRAY ELEMENT;                                               71430000
   DOUBLE SIR;                                                          71431000
   OPTION PRIVILEGED, UNCALLABLE;                                       71432000
                                                                        71433000
   ! This procedure is the recipient procedure of DIRECSCAN.  When      71434000
   ! called (at the file level), ADJUST'FPTR changes the file label     71435000
   ! disc address of the file entry to the double word value in the     71436000
   ! first two words of PARMS.  The dirty bit is then set and away it   71437000
   ! goes.                                                              71438000
                                                                        71439000
BEGIN                                                                   71440000
   INTEGER ARRAY ARQ (*) = Q+0;                                         71441000
   LOGICAL ARRAY DSEG (*) = DB+0;                                       71442000
   DEFINE DADIRTY = DSEG(%221).(15:01) #;                               71443000
                                                                        71444000
   PARMS := PARMS-ARQ;                                                  71445000
   ELEMENT (4) := ARQ (PARMS);                                          71446000
   ELEMENT (5) := ARQ (PARMS+1);                                        71447000
   DADIRTY := 1;                                                        71448000
   ADJUST'FPTR := 1;                                                    71449000
END;                                                                    71450000
$PAGE "DISPLAY'3'TO'DISPLAY"                                            71451000
<<----------------------------->>                                       71452000
<< DISPLAY'3'TO'DISPLAY        >>                                       71453000
<<----------------------------->>                                       71454000
                                                                        71455000
$CONTROL SEGMENT=RESTORE                                                71456000
PROCEDURE DISPLAY'3'TO'DISPLAY (TARGET,LEN,FILENAME,GROUPNAME,ACCTNAME);71457000
   INTEGER LEN;                         ! return length of target  (W/O)71458000
   BYTE ARRAY                                                           71459000
      TARGET,                           ! TARGET STRING            (W/O)71460000
      FILENAME,                         ! FILE NAME                (R/O)71461000
      GROUPNAME,                        ! GROUP NAME               (R/O)71462000
      ACCTNAME;                         ! ACCOUNT NAME             (R/O)71463000
                                                                        71464000
   ! Takes filename, groupname, and accountname                         71465000
   ! and places in target a string that is the concatenation of         71466000
   ! the above with proper seperators.  LEN is the return length        71467000
   ! of target. Blanks are suppressed.  Maximum of LEN is 26.           71468000
   !                                                                    71469000
   !    filename.groupname.acctname                                     71470000
                                                                        71471000
BEGIN                                                                   71472000
   DEFINE                                                               71473000
      BLANKS'27  = "                           "#;                      71474000
   BYTE POINTER                                                         71475000
      SCANSTOP;                         ! POSITION WHERE SCAN STOPPED   71476000
                                                                        71477000
   MOVE TARGET := BLANKS'27;                                            71478000
                                                                        71479000
   MOVE TARGET := FILENAME, (FILE'PART'SIZE);                           71480000
   SCAN TARGET UNTIL "  ",1;                                            71481000
   @SCANSTOP := TOS;                                                    71482000
   SCANSTOP := ".";                                                     71483000
                                                                        71484000
   MOVE SCANSTOP(1) := GROUPNAME, (FILE'PART'SIZE);                     71485000
   SCAN SCANSTOP UNTIL "  ", 1;                                         71486000
   @SCANSTOP := TOS;                                                    71487000
   SCANSTOP := ".";                                                     71488000
                                                                        71489000
   MOVE SCANSTOP(1) := ACCTNAME, (FILE'PART'SIZE);                      71490000
   SCAN SCANSTOP UNTIL "  ", 1;                                         71491000
   @SCANSTOP := TOS;                                                    71492000
   LEN := LOGICAL (@SCANSTOP) - LOGICAL (@TARGET);                      71493000
                                                                        71494000
                                                                        71495000
$IF X1=ON THEN                <<Debugging code>>                        71496000
   IF DEBUGGING THEN                                                    71497000
      BEGIN                                                             71498000
      SAY "FILE TITLE IS '" ENDSAY;                                     71499000
      SAY TARGET, (LEN) ENDSAY;                                         71500000
      SAY "'" ENDSAY;                                                   71501000
      SEND;                                                             71502000
      END;                                                              71503000
$IF                                                                     71504000
                                                                        71505000
END <<DISPLAY'3'TO'DISPLAY>>;                                           71506000
$page "MATCH'LOCKWORD"                                                  71507000
$CONTROL SEGMENT=RESTORE                                                71508000
<<---------------------------------------->>                            71509000
<<  MATCH'LOCKWORD                        >>                            71510000
<<---------------------------------------->>                            71511000
                                                                        71512000
LOGICAL PROCEDURE MATCH'LOCKWORD (MESS',LEN,PASS');                     71513000
   VALUE LEN;                                                           71514000
   INTEGER LEN;                         ! LENGTH OF PASSED MESSAGE (R/O)71515000
   BYTE ARRAY                                                           71516000
      MESS',                            ! MESSAGE TO BE PRINTED    (R/O)71517000
      PASS';                            ! PASSWORD TO BE MATCHED   (R/O)71518000
                                                                        71519000
   ! Sends MESS' to the terminal and waits for a reply.                 71520000
   ! If reply matches PASS' then returns GOOD, otherwise it             71521000
   ! returns FAILED                                                     71522000
                                                                        71523000
BEGIN                                                                   71524000
   BYTE ARRAY HOLD' (0:80);             ! BUFFER PASSED TO FREPLY  (R/W)71525000
                                                                        71526000
   MOVE HOLD' := MESS' , (LEN);                                         71527000
                                                                        71528000
   HOLD'(LEN) := "?";                                                   71529000
   IF NOT FREPLY (HOLD', LEN+1) THEN                                    71530000
      MATCH'LOCKWORD := FAILED                                          71531000
   ELSE IF HOLD' = PASS', (FILE'PART'SIZE) THEN                         71532000
      MATCH'LOCKWORD := GOOD                                            71533000
   ELSE                                                                 71534000
      MATCH'LOCKWORD := FAILED;                                         71535000
END <<MATCH'LOCKWORD>>;                                                 71536000
$PAGE "CHANGE'JIT'ACCT"                                                 71537000
$CONTROL SEGMENT=RESTORE                                                71538000
<<----------------------------->>                                       71539000
<< CHANGE'JIT'ACCT             >>                                       71540000
<<----------------------------->>                                       71541000
PROCEDURE CHANGE'JIT'ACCT (DSTNO, ACCTNAME);                            71542000
   VALUE DSTNO;                                                         71543000
   INTEGER DSTNO;                                                       71544000
   LOGICAL ARRAY ACCTNAME;                                              71545000
                                                                        71546000
   ! Changes the account field in the JIT to RES'ACCT.  This is what    71547000
   ! makes it possible for RESTORE to build files in other accounts.    71548000
                                                                        71549000
BEGIN                                                                   71550000
   MOVE'DATA'OUT (DSTNO, 16, ACCTNAME, 4);                              71551000
END;                                                                    71552000
$PAGE "GET'JITDST"                                                      71553000
$CONTROL SEGMENT=RESTORE                                                71554000
<<----------------------------->>                                       71555000
<< GET'JITDST                  >>                                       71556000
<<----------------------------->>                                       71557000
INTEGER PROCEDURE GET'JITDST;                                           71558000
                                                                        71559000
   << This procedure returns the DST number of the JIT. >>              71560000
   << May be called in split stack mode.                >>              71561000
                                                                        71562000
BEGIN                                                                   71563000
                                                                        71564000
   INTEGER                                                              71565000
      PCBGLOBLOC,        << Q-relative pointer to PCBX Global>>         71566000
      S0  = S-0;                                                        71567000
                                                                        71568000
   INTEGER ARRAY                                                        71569000
      QARRAY (*) = Q + 0;                                               71570000
                                                                        71571000
   PXGLOBAL;                                                            71572000
   GET'JITDST := PXG'JITDST;                                            71572100
END;                                                                    71572200
$PAGE "LABELIO"                                                         71573000
$CONTROL SEGMENT=RESTORE                                                71574000
<<--------------------------->>                                         71575000
<< LABELIO                   >>                                         71576000
<<--------------------------->>                                         71577000
                                                                        71578000
INTEGER PROCEDURE LABELIO (TARGET, LDEV, ADDRESS, RW, FILENAME);        71579000
   VALUE LDEV, ADDRESS, RW;                                             71580000
   LOGICAL ARRAY TARGET, FILENAME;                                      71581000
   LOGICAL LDEV, RW;                                                    71582000
   DOUBLE ADDRESS;                                                      71583000
                                                                        71584000
   ! This routine reads/writes a file label from/to disc.  In a         71585000
   ! read, the label is read from the disc address specified by         71586000
   ! LDEV/ADDRESS and placed into TARGET.  In a write, the label        71587000
   ! is taken from TARGET and written to the disc address specified     71588000
   ! by LDEV/ADDRESS.  Returns 0 if good, error number otherwise.       71589000
                                                                        71590000
BEGIN                                                                   71591000
   INTEGER ERRCODE;                                                     71592000
                                                                        71593000
$IF X1=ON THEN                                                          71594000
   IF DEBUGGING THEN                                                    71595000
      BEGIN                                                             71596000
      SAY "   LABELIO LDEV=" ENDSAY;                                    71597000
      SAYNUM (LDEV);                                                    71598000
      SAY "; ADRESS=%" ENDSAY;                                          71599000
      SAYDOCTAL (ADDRESS);                                              71600000
      IF RW=0 THEN SAY "; READ" ENDSAY                                  71601000
      ELSE SAY "; WRITE" ENDSAY;                                        71602000
      SEND;                                                             71603000
      END;                                                              71604000
$IF                                                                     71605000
   ERRCODE := FLABIO (LDEV, ADDRESS, RW, TARGET);                       71606000
                                                                        71607000
   IF ERRCODE <> 0 THEN                                                 71608000
      BEGIN                                                             71609000
                                                                        71610000
$IF X1=ON THEN                                                          71611000
      IF DEBUGGING THEN                                                 71612000
         BEGIN                                                          71613000
         SAY "FLABIO RETURNS ERRCODE = " ENDSAY;                        71614000
         SAYNUM (ERRCODE);                                              71615000
         SEND;                                                          71616000
         END;                                                           71617000
$IF                                                                     71618000
                                                                        71619000
      FLABIOERR (ERRCODE, 0, @FILENAME);                                71620000
      IF RW=ATTIO'READ THEN LABELIO := M'READ'FILE'LABEL'FAILED         71621000
      ELSE LABELIO := M'WRITE'FILE'LABEL'FAILED;                        71622000
      END                                                               71623000
   ELSE                                                                 71624000
      LABELIO := 0;                                                     71625000
$IF X1=ON THEN                                                          71626000
   IF DEBUGGING THEN                                                    71627000
      BEGIN                                                             71628000
      IF ERRCODE =  0 THEN SAY "   LABELIO OK" ENDSAY                   71629000
      ELSE SAY "   LABELIO FAILED" ENDSAY;                              71630000
      SEND;                                                             71631000
      END;                                                              71632000
$IF                                                                     71633000
END;                                                                    71634000
$PAGE "PICK A DEVICE"                                                   71635000
<<----------------------------->>                                       71636000
<< PICK'A'DEVICE               >>                                       71637000
<<----------------------------->>                                       71638000
                                                                        71639000
$CONTROL SEGMENT=IRESTORE                                               71640000
LOGICAL PROCEDURE  PICK'A'DEVICE (EXT'SIZES);                           71641000
   DOUBLE ARRAY                                                         71642000
      EXT'SIZES;                                                        71643000
                                                                        71644000
   ! This procedure finds disc space for the file.                      71645000
   !                                                                    71646000
   ! NOTE: This procedure will attempt to find one large contiguous     71647000
   !       area for the file.  If it fails to do that then it will      71648000
   !       try to find space for the file, extent by extent.            71649000
   !       Therefore it is possible that the following algorithm may    71650000
   !       be gone through twice.  Once for contiguous space, and if    71651000
   !       that fails then another time for disjoint space.             71652000
   !                                                                    71653000
   ! The algorithm is                                                   71654000
   !                                                                    71655000
   !    If the user specified the DEV parameter then                    71656000
   !       If we can get space on specified device then                 71657000
   !          SUCCESS                                                   71658000
   !       Else                                                         71659000
   !          FAILURE                                                   71660000
   !                                                                    71661000
   !    ELSE                                                            71662000
   !       If we can get space on device class in file label then       71663000
   !          SUCCESS                                                   71664000
   !       Else If we can get space on a device with the same device    71665000
   !                type and subtype as in the file label then          71666000
   !          SUCCESS                                                   71667000
   !       Else If we can get space on a device with the same device    71668000
   !                type as in the file label then                      71669000
   !          SUCCESS                                                   71670000
   !       Else If we can get space on device class "DISC" then         71671000
   !          SUCCESS                                                   71672000
   !       Else                                                         71673000
   !          FAILURE                                                   71674000
   !                                                                    71675000
   ! FAILURE means PICK'A'DEVICE returns FAILED.                        71676000
   ! SUCCESS means PICK'A'DEVICE returns GOOD.                          71677000
                                                                        71678000
BEGIN                                                                   71679000
                                                                        71680000
   DOUBLE                                                               71681000
      CHUNK'ADDR;                       ! ADDRESS OF FIRST EXTENT       71682000
                                                                        71683000
   INTEGER                                                              71684000
      CHUNK'ADDR'1  = CHUNK'ADDR,       ! ADDRESS OF FIRST EXTENT       71685000
      CHUNK'LDEV,                       ! LDEV                          71686000
      CHUNK'VTAB,                       ! VTAB                          71687000
      ENTRY'SIZE,                       ! ENTRY SIZE-LOGICAL DEVICE TABL71688000
      HOLD'PVINFO,                      ! HOLDER FOR PRIVATE VOL INFO   71689000
      I,                                ! COUNTER                       71690000
      LAST'LDEV,                        ! THE HIGHEST NUMBER LDEV ON SYS71691000
      NUMEXTS,                          ! NUMBER OF EXTENTS             71692000
      LDT'INDEX,                        ! OFFSET INTO LOGICAL DEV TABLE 71693000
      LPDT'INDEX,                       ! OFFSET INTO LPDT              71694000
      SIR'INFO,                         ! GETSIR RETURN                 71695000
      SUB'LDN,                          ! LOOP COUNTER - LOG DEV NUMSM  71696000
      SUB'RET;                          ! PROCEDURE RETURN HOLDER       71697000
                                                                        71698000
   LOGICAL                                                              71699000
      R'PICK'A'DEVICE = PICK'A'DEVICE,  ! RETURN                        71700000
      SUB'STOP,                         ! FLAG                          71701000
      TRY'CHUNK;                        ! USE CHUNK ALGORITHM           71702000
                                                                        71703000
   INTEGER ARRAY                                                        71704000
      INFO  (0:1+SIZE'OF'LPDT'ENTRY+                                    71705000
             SIZE'OF'LDT'ENTRY);        ! DEVICE INFORMATION ARRAY      71706000
                                                                        71707000
   DOUBLE ARRAY                                                         71708000
      EXTENTS (0:MAX'NUM'EXTENTS);      ! BUFFER FOR DISKALLOC          71709000
                                                                        71710000
   DOUBLE POINTER                                                       71711000
      FL'EXTMAP'D  := @FLEXTMAP'D;                                      71712000
                                                                        71713000
   DOUBLE                                                               71714000
      EXT'LEN;                                                          71715000
$PAGE "CHUNK'EXTENTS of PICK'A'DEVICE"                                  71716000
<<-------------------------------------->>                              71717000
<< CHUNK'EXTENTS of PICK'A'DEVICE       >>                              71718000
<<-------------------------------------->>                              71719000
                                                                        71720000
SUBROUTINE CHUNK'EXTENTS (EXTSIZES, BIGEXTENTS, NUMEXTS);               71721000
   DOUBLE ARRAY EXTSIZES, BIGEXTENTS;                                   71722000
   INTEGER NUMEXTS;                                                     71723000
                                                                        71724000
   ! This routine takes the original extent size map and creates        71725000
   ! a new extent size map that has the same total space, but only      71726000
   ! one extent.                                                        71727000
                                                                        71728000
BEGIN                                                                   71729000
   I := -1;                                                             71730000
                                                                        71731000
   BIGEXTENTS (0) := 0D;                                                71732000
                                                                        71733000
   WHILE (I:=I+1) < NUMEXTS DO                                          71734000
      BIGEXTENTS (0) := BIGEXTENTS (0) + EXTSIZES(I);                   71735000
                                                                        71736000
   NUMEXTS := 1;                                                        71737000
                                                                        71738000
$IF X1=ON THEN                                                          71739000
   IF DEBUGGING THEN                                                    71740000
      BEGIN                                                             71741000
      SAY "CHUNKED EXTENT SIZE = " ENDSAY;                              71742000
      SAYDOCTAL (BIGEXTENTS (0));                                       71743000
      SEND;                                                             71744000
      END;                                                              71745000
$IF                                                                     71746000
                                                                        71747000
END;                                                                    71748000
$PAGE "UNCHUNK'EXTENTS of PICK'A'DEVICE"                                71749000
<<-------------------------------------->>                              71750000
<< UNCHUNK'EXTENTS of PICK'A'DEVICE     >>                              71751000
<<-------------------------------------->>                              71752000
                                                                        71753000
SUBROUTINE UNCHUNK'EXTENTS (EXT'ADDRESS, EXTSIZES, FLAB'EXTS, NUMEXTS); 71754000
   VALUE EXT'ADDRESS, NUMEXTS;                                          71755000
   DOUBLE EXT'ADDRESS;                                                  71756000
   DOUBLE ARRAY EXTSIZES, FLAB'EXTS;                                    71757000
   INTEGER NUMEXTS;                                                     71758000
                                                                        71759000
   ! This procedure undoes what CHUNK'EXTENTS does.  The one large      71760000
   ! disc extent is divided into extents of the correct size.           71761000
   !                                                                    71762000
   ! In addition the use count of the device in the LDT has to          71763000
   ! be adjusted to the correct number of extents.  (DISKALLOC bumps    71764000
   ! the usecount by the number of extents it allocates.  DISKDEALLOC   71765000
   ! drops the usecount by the number of extents it deallocates.        71766000
   ! Since we use DISKDEALLOC with the correct number of extents, but   71767000
   ! we use DISKALLOC with one extent, this would result in dropping    71768000
   ! the usecount below zero, which would indeed be a bad thing.        71769000
                                                                        71770000
BEGIN                                                                   71771000
   I := -1;                                                             71772000
                                                                        71773000
   WHILE (I:=I+1) < NUMEXTS DO                                          71774000
      IF EXTSIZES (I) <> 0D THEN                                        71775000
         BEGIN                                                          71776000
         EXT'LEN := EXTSIZES (I);                                       71777000
         FLAB'EXTS (I) := EXT'ADDRESS;                                  71778000
         EXT'ADDRESS := EXT'ADDRESS + EXT'LEN;                          71779000
         END;                                                           71780000
                                                                        71781000
   CHUNK'ADDR := FLAB'EXTS (0);                                         71782000
   CHUNK'VTAB := CHUNK'ADDR'1.(0:8);                                    71783000
   CHUNK'LDEV := LUN (CHUNK'VTAB, PVMVTABX);                            71784000
                                                                        71785000
   ! Now up the use count.                                              71786000
   SIR'INFO := GETSIR (LDT'SIR);                                        71787000
   EXCHANGEDB (LDT'DST);                                                71788000
                                                                        71789000
   LDT'INDEX := CHUNK'LDEV * SIZE'OF'LDT'ENTRY;                         71790000
   LDT'FILE'USE'CNT := LDT'FILE'USE'CNT + LOGICAL(NUMEXTS-1);           71791000
                                                                        71792000
   EXCHANGEDB (0);                                                      71793000
   RELSIR (LDT'SIR, SIR'INFO);                                          71794000
END;                                                                    71795000
$PAGE "TRY'DISKALLOC of PICK'A'DEVICE"                                  71796000
<<---------------------------------------->>                            71797000
<<  TRY'DISKALLOC of PICK'A'DEVICE        >>                            71798000
<<---------------------------------------->>                            71799000
                                                                        71800000
LOGICAL SUBROUTINE TRY'DISKALLOC (INDX);                                71801000
   VALUE INDX;                                                          71802000
   INTEGER INDX;                                                        71803000
                                                                        71804000
   ! This routine calls DISKALLOC and inteprets the results.  If        71805000
   ! TRY'CHUNK is TRUE then CHUNK'EXTENTS is called.  If TRY'CHUNK      71806000
   ! is TRUE and DISKALLOC succeeds then UNCHUNK'EXTENTS is called.     71807000
   !                                                                    71808000
   ! If DISKALLOC succeeds the subroutine returns TRUE, and the global  71809000
   ! variables FILE'ADDRESS and FILE'LDEV are set.  Otherwise the       71810000
   ! subroutine returns FALSE.                                          71811000
                                                                        71812000
BEGIN                                                                   71813000
   NUMEXTS := FLNUMEXTS+1;                                              71814000
   IF TRY'CHUNK THEN                                                    71815000
      CHUNK'EXTENTS (EXT'SIZES, EXTENTS, NUMEXTS)                       71816000
   ELSE                                                                 71817000
      MOVE EXTENTS := EXT'SIZES, (2*(FLNUMEXTS+1));                     71818000
                                                                        71819000
   DISABLE'ARITHMETIC'TRAPS;                                            71820000
   SUB'RET := DISKALLOC (INDX,NUMEXTS,EXTENTS,PV'INFO);                 71821000
                                                                        71822000
   ENABLE'ARITHMETIC'TRAPS;                                             71823000
                                                                        71824000
   IF SUB'RET = 0 THEN                                                  71825000
      BEGIN                                                             71826000
      TRY'DISKALLOC := GOOD;                                            71827000
      IF TRY'CHUNK THEN                                                 71828000
         UNCHUNK'EXTENTS (EXTENTS, EXT'SIZES,                           71829000
                          FL'EXTMAP'D, FLNUMEXTS+1)                     71830000
      ELSE                                                              71831000
         MOVE FL'EXTMAP'D := EXTENTS, (2*(FLNUMEXTS+1));                71832000
                                                                        71833000
      FILE'ADDRESS := FLEXTMAP'D;                                       71834000
      FILE'LDEV := FILE'ADDR'1.(00:08);                                 71835000
      FILE'ADDR'1.(00:08) := 0;                                         71836000
                                                                        71837000
$IF X1=ON THEN                                                          71838000
      IF DEBUGGING THEN                                                 71839000
         BEGIN                                                          71840000
         SAY "   SUCCESSFUL" ENDSAY;                                    71841000
         SEND;                                                          71842000
         SAY "      FILE'LDEV = " ENDSAY;                               71843000
         SAYNUM (FILE'LDEV);                                            71844000
         SAY "      FILE'ADDRESS = %" ENDSAY;                           71845000
         SAYDOCTAL (FILE'ADDRESS);                                      71846000
         SEND;                                                          71847000
         SUB'RET := -1;                                                 71848000
         WHILE (SUB'RET:=SUB'RET+1) <= FLNUMEXTS DO                     71849000
            BEGIN                                                       71850000
            SAY "   %" ENDSAY;                                          71851000
            SAYDOCTAL (FL'EXTMAP'D (SUB'RET));                          71852000
            IF SUB'RET MOD 4 = 3 THEN SEND;                             71853000
            END;                                                        71854000
         IF FLNUMEXTS+1 MOD 4 <> 3 THEN SEND;                           71855000
         END;                                                           71856000
$IF                                                                     71857000
      END                                                               71858000
   ELSE                                                                 71859000
      BEGIN                                                             71860000
      TRY'DISKALLOC := FAILED;                                          71861000
$IF X1=ON THEN                                                          71862000
      IF DEBUGGING THEN                                                 71863000
         BEGIN                                                          71864000
         SAY "   DISKALLOC RETURNS " ENDSAY;                            71865000
         SAYNUM (SUB'RET);                                              71866000
         SEND;                                                          71867000
         END;                                                           71868000
$IF                                                                     71869000
      END;                                                              71870000
END;                                                                    71871000
$PAGE "TRY'DEFAULT'OR'PASSED'CLASS of PICK'A'DEVICE"                    71872000
<<----------------------------------------------->>                     71873000
<<  TRY'DEFAULT'OR'PASSED'CLASS of PICK'A'DEVICE >>                     71874000
<<----------------------------------------------->>                     71875000
                                                                        71876000
LOGICAL SUBROUTINE TRY'DEFAULT'OR'PASSED'CLASS;                         71877000
                                                                        71878000
   ! This is a do-nothing subroutine that tries either the passed class 71879000
   ! (the user used the ;DEV= parm.) or the default class of "DISC ".   71880000
                                                                        71881000
BEGIN                                                                   71882000
                                                                        71883000
$IF X1=ON THEN                                                          71884000
   IF DEBUGGING THEN                                                    71885000
      SAY "TRY'DEFAULT'OR'PASSED'CLASS" ENDSAY;                         71886000
$IF                                                                     71887000
                                                                        71888000
   TRY'DEFAULT'OR'PASSED'CLASS := TRY'DISKALLOC (DEVICEINFO);           71889000
END;                                                                    71890000
$PAGE "TRY'SAME'CLASS of PICK'A'DEVICE"                                 71891000
<<---------------------------------------->>                            71892000
<<  TRY'SAME'CLASS of PICK'A'DEVICE       >>                            71893000
<<---------------------------------------->>                            71894000
                                                                        71895000
LOGICAL SUBROUTINE TRY'SAME'CLASS;                                      71896000
                                                                        71897000
   ! This subroutine calls TRY'DISKALLOC with the class from the file   71898000
   ! label.                                                             71899000
                                                                        71900000
BEGIN                                                                   71901000
                                                                        71902000
$IF X1=ON THEN                                                          71903000
   IF DEBUGGING THEN                                                    71904000
      BEGIN                                                             71905000
      SAY "TRY'SAME'CLASS CLASS=" ENDSAY;                               71906000
      SAY FLCLASS', (FILE'PART'SIZE) ENDSAY;                            71907000
      END;                                                              71908000
$IF                                                                     71909000
                                                                        71910000
   SUB'RET := GETDEVINFO (FLCLASS, INFO);                               71911000
   IF (SUB'RET) = 0 AND                 ! GETDEVINFO WORKED OK          71912000
      INFO(1).(10:3) = 0 THEN          ! AND DEVICE WAS DISC            71913000
         TRY'SAME'CLASS := TRY'DISKALLOC (INFO);                        71914000
END;                                                                    71915000
$PAGE "TRY'SAME'TYPE'AND'OR'SUBTYPE of PICK'A'DEVICE"                   71916000
<<-------------------------------------------------->>                  71917000
<< TRY'SAME'TYPE'AND'OR'SUBTYPE OF PICK'A'DEVICE    >>                  71918000
<<-------------------------------------------------->>                  71919000
                                                                        71920000
LOGICAL SUBROUTINE TRY'SAME'TYPE'AND'OR'SUBTYPE (CHECKSUB);             71921000
   VALUE CHECKSUB;                                                      71922000
   LOGICAL CHECKSUB;                    ! CHECK SUBTYPE FLAG            71923000
                                                                        71924000
   ! If CHECKSUB is set then this calls TRY'FOPEN for each              71925000
   ! device that has the same device type and subtype.  If              71926000
   ! CHECKSUB is not set then this calls TRY'FOPEN for each             71927000
   ! device that has the same device type.                              71928000
   !                                                                    71929000
   ! The device name it passes TRY'FOPEN is the ascii representation    71930000
   ! of the logical device number.                                      71931000
                                                                        71932000
BEGIN                                                                   71933000
                                                                        71934000
$IF X1=ON THEN                                                          71935000
   IF DEBUGGING THEN                                                    71936000
      BEGIN                                                             71937000
      SAY "TRY SAME TYPE" ENDSAY;                                       71938000
      IF CHECKSUB THEN SAY " AND SUBTYPE" ENDSAY;                       71939000
      SEND;                                                             71940000
      END;                                                              71941000
$IF                                                                     71942000
                                                                        71943000
   SUB'STOP := FALSE;                                                   71944000
   HOLD'PVINFO := PV'INFO;                                              71945000
                                                                        71946000
   EXCHANGEDB (LDT'DST);                                                71947000
                                                                        71948000
   LAST'LDEV   := LDT'NUM'ENTRIES;                                      71949000
                                                                        71950000
   SUB'LDN     := 0;                                                    71951000
   LDT'INDEX   := 0;                                                    71952000
                                                                        71953000
   WHILE NOT (SUB'STOP) AND ( (SUB'LDN := SUB'LDN + 1) <= LAST'LDEV) DO 71954000
      BEGIN                                                             71955000
      LDT'INDEX  := SUB'LDN * SIZE'OF'LDT'ENTRY;                        71956000
      LPDT'INDEX := SUB'LDN * SIZE'OF'LPDT'ENTRY;                       71957000
                                                                        71958000
      IF LDT'AVAIL'TO'SYS AND LDT'DEVICE'TYPE = FLDEVTYPE THEN          71959000
         IF NOT (CHECKSUB) OR LPDT'SUBTYPE = FLDEVSUBTYPE THEN          71960000
                                                                        71961000
            IF FLDEVTYPE = 0 THEN                                       71962000
               IF LPDT'NOT'PV'OR'SYS OR                                 71963000
                  (HOLD'PVINFO = 0 LAND LPDT'NON'SYS'DOMAIN)   OR       71964000
                  (HOLD'PVINFO <> 0 LAND NOT LPDT'NON'SYS'DOMAIN)       71965000
               THEN <<NULL>>                                            71966000
               ELSE                                                     71967000
                  BEGIN                                                 71968000
                  EXCHANGEDB (0);                                       71969000
$IF X1=ON THEN                                                          71970000
                  IF DEBUGGING THEN                                     71971000
                     BEGIN                                              71972000
                     SAY "  TRYING LDEV #" ENDSAY;                      71973000
                     SAYNUM (SUB'LDN);                                  71974000
                     END;                                               71975000
$IF                                                                     71976000
                  SUB'STOP := TRY'DISKALLOC (SUB'LDN);                  71977000
                  IF NOT SUB'STOP THEN EXCHANGEDB (LDT'DST);            71978000
                  END;                                                  71979000
      END;                                                              71980000
                                                                        71981000
   EXCHANGEDB (0);                                                      71982000
                                                                        71983000
   DIFFERENT'DEVICE := TRUE;                                            71984000
   IF SUB'STOP THEN TRY'SAME'TYPE'AND'OR'SUBTYPE := TRUE                71985000
   ELSE TRY'SAME'TYPE'AND'OR'SUBTYPE := FALSE;                          71986000
                                                                        71987000
END <<TRY'OPEN'TYPE'AND'OR'SUBTYPE OF PICK'A'DEVICE>>;                  71988000
$PAGE "PICK'A'DEVICE mainline"                                          71989000
! For a description of the algorithm, see the block comment at the      71990000
! beginning of the procedure.                                           71991000
                                                                        71992000
$IF X1=ON THEN                <<Debugging code>>                        71993000
IF DEBUGGING THEN                                                       71994000
   BEGIN                                                                71995000
   SAY "ENTERING PICK A DEVICE - EXTSIZES ARE" ENDSAY;                  71996000
   SEND;                                                                71997000
   SUB'RET := -1;                                                       71998000
   WHILE (SUB'RET:=SUB'RET+1) <= FLNUMEXTS DO                           71999000
      BEGIN                                                             72000000
      SAY "   %" ENDSAY;                                                72001000
      SAYDOCTAL (EXT'SIZES (SUB'RET));                                  72002000
      IF SUB'RET MOD 4 = 3 THEN SEND;                                   72003000
      END;                                                              72004000
   IF FLNUMEXTS MOD 4 <> 3 THEN SEND;                                   72005000
   END;                                                                 72006000
$IF                                                                     72007000
TRY'CHUNK := TRUE;                                                      72008000
                                                                        72009000
TRY'AGAIN:                                                              72010000
                                                                        72011000
IF SEEN'DEV THEN                                                        72012000
   IF TRY'DEFAULT'OR'PASSED'CLASS THEN                                  72013000
      PICK'A'DEVICE := TRUE                                             72014000
   ELSE                                                                 72015000
      PICK'A'DEVICE := FALSE                                            72016000
ELSE                                                                    72017000
   BEGIN                                                                72018000
   IF TRY'SAME'CLASS THEN                                               72019000
      PICK'A'DEVICE := TRUE                                             72020000
   ELSE IF TRY'SAME'TYPE'AND'OR'SUBTYPE (TRUE) THEN                     72021000
      PICK'A'DEVICE := TRUE                                             72022000
   ELSE IF TRY'SAME'TYPE'AND'OR'SUBTYPE (FALSE) THEN                    72023000
      PICK'A'DEVICE := TRUE                                             72024000
   ELSE IF TRY'DEFAULT'OR'PASSED'CLASS THEN                             72025000
      PICK'A'DEVICE := TRUE                                             72026000
   ELSE                                                                 72027000
      PICK'A'DEVICE := FALSE;                                           72028000
   END;                                                                 72029000
                                                                        72030000
IF TRY'CHUNK AND NOT R'PICK'A'DEVICE THEN                               72031000
   BEGIN                                                                72032000
   TRY'CHUNK := FALSE;                                                  72033000
   GO TO TRY'AGAIN;                                                     72034000
   END;                                                                 72035000
                                                                        72036000
END'PROC:                                                               72037000
                                                                        72038000
$IF X1=ON THEN                <<Debugging code>>                        72039000
IF DEBUGGING THEN                                                       72040000
   BEGIN                                                                72041000
   SAY "LEAVING PICK'A'DEVICE" ENDSAY;                                  72042000
   SEND;                                                                72043000
   SEND;                                                                72044000
   END;                                                                 72045000
$IF                                                                     72046000
                                                                        72047000
                                                                        72048000
END; <<PICK'A'DEVICE>>                                                  72049000
$PAGE "HIDE OLD COPY"                                                   72050000
!CONTROL LIST                 !LIST                                     72051000
<<----------------------------->>                                       72052000
<< HIDE'OLD'COPY               >>                                       72053000
<<----------------------------->>                                       72054000
                                                                        72055000
$CONTROL SEGMENT=IRESTORE                                               72056000
INTEGER PROCEDURE HIDE'OLD'COPY;                                        72057000
                                                                        72058000
   ! This routine checks to see if there is a disc file that will       72059000
   ! need to be purged.  If there isn't then set OLD'COPY'EXISTS to     72060000
   ! FALSE and RETURN.                                                  72061000
   !                                                                    72062000
   ! If there is and it is not busy, then the file is locked.           72063000
   ! After that access capabilities, privileged file code violations,   72064000
   ! lockword violations, and group and account file space limitations  72065000
   ! are checked.  If any of those things fail then the procedure will  72066000
   ! return a nonzero value, which will prohibit the file from being    72067000
   ! RESTOREd.  Also the file will be unlocked.                         72068000
                                                                        72069000
BEGIN                                                                   72070000
   INTEGER ARRAY                                                        72071000
      FILE'NTRY(0:5);                   ! FILE ENTRY                    72072000
                                                                        72073000
   DOUBLE ARRAY                                                         72074000
      FILE'NTRY'D(*) = FILE'NTRY;                                       72075000
                                                                        72076000
   BYTE ARRAY                                                           72077000
      MESS' (0:72);                                                     72078000
                                                                        72079000
   DOUBLE                                                               72080000
      DR;                                                               72081000
                                                                        72082000
   INTEGER                                                              72083000
      DRA          = DR + 1,                                            72084000
      DRB          = DR,                                                72085000
      ERRCODE,                                                          72086000
      HOLD,                                                             72087000
      I,                                                                72088000
      LEN,                                                              72089000
      TITLE'LEN,                                                        72089100
      TYPE;                                                             72090000
                                                                        72091000
   LOGICAL                                                              72092000
      FILE'LOCKED     := FALSE,                                         72093000
      SECMX;                                                            72094000
                                                                        72095000
   DOUBLE POINTER                                                       72096000
      OLD'EXTMAP'D := @OLD'EXTMAPD;                                     72097000
                                                                        72098000
   DEFINE                                                               72099000
      FILE'NTRY'ADDRESS  = FILE'NTRY'D (0)            #,                72100000
      FILE'NTRY'GROUP'SEC= FILE'NTRY'D (1)            #,                72101000
      FILE'NTRY'ACCT'SEC = FILE'NTRY   (4)            #;                72102000
$PAGE "HIDE'OLD'COPY - UNLOCK'OLD'COPY and RET and EVAL'RETURN"         72103000
<<---------------------------------->>                                  72104000
<< UNLOCK'OLD'COPY of HIDE'OLD'COPY >>                                  72105000
<<---------------------------------->>                                  72106000
                                                                        72107000
SUBROUTINE UNLOCK'OLD'COPY;                                             72108000
                                                                        72109000
   ! Unlocks the old copy of the file.  Is called when HIDE'OLD'COPY    72110000
   ! fails and the file is already locked.                              72111000
                                                                        72112000
BEGIN                                                                   72113000
   HOLD := LABELIO (OLD'FLAB, OLD'LDEV, OLD'ADDRESS, ATTIO'READ,        72114000
                    RES'TITLE);                                         72115000
                                                                        72116000
   IF HOLD <> 0 THEN                                                    72117000
      BEGIN                                                             72118000
      SENDMESSAGE (HOLD);                                               72119000
      SENDMESSAGE (RS'UNABLE'TO'UNLOCK'OLD'FILE);                       72120000
      RETURN;                                                           72121000
      END;                                                              72122000
                                                                        72123000
   OLD'FLSTORERESTORE := NO'LOCKv;                                      72124000
                                                                        72125000
   HOLD := LABELIO (OLD'FLAB, OLD'LDEV, OLD'ADDRESS, ATTIO'WRITE,       72126000
                    RES'TITLE);                                         72127000
   IF HOLD <> 0 THEN                                                    72128000
      BEGIN                                                             72129000
      SENDMESSAGE (HOLD);                                               72130000
      SENDMESSAGE (RS'UNABLE'TO'UNLOCK'OLD'FILE);                       72131000
      RETURN;                                                           72132000
      END;                                                              72133000
                                                                        72134000
END;                                                                    72135000
                                                                        72136000
<<----------------------------->>                                       72137000
<< RET of HIDE'OLD'COPY        >>                                       72138000
<<----------------------------->>                                       72139000
                                                                        72140000
SUBROUTINE RET(A);                                                      72141000
   VALUE A;                                                             72142000
   INTEGER A;                                                           72143000
                                                                        72144000
   ! Places the value passed into the procedure return and goes to      72145000
   ! the end of the procedure.  If the return value is nonzero then     72146000
   ! and the file was locked then UNLOCK'OLD'COPY is called.            72147000
                                                                        72148000
BEGIN                                                                   72149000
   HIDE'OLD'COPY := A;                                                  72150000
                                                                        72151000
   IF A <> 0 AND FILE'LOCKED THEN UNLOCK'OLD'COPY;                      72152000
                                                                        72153000
   GO TO END'PROC;                                                      72154000
END <<RET OF HIDE'OLD'COPY>>;                                           72155000
                                                                        72156000
                                                                        72157000
<<----------------------------->>                                       72158000
<< EVAL'RETURN of HIDE'OLD'COPY>>                                       72159000
<<----------------------------->>                                       72160000
                                                                        72161000
SUBROUTINE EVAL'RETURN(RETVAL);                                         72162000
   VALUE RETVAL;                                                        72163000
   INTEGER RETVAL;                                                      72164000
                                                                        72165000
   ! This routine is used to evaluate the return from another procedure.72166000
   ! If the return value is non-zero then HIDE'OLD'COPY returns that    72167000
   ! same value                                                         72168000
                                                                        72169000
BEGIN                                                                   72170000
   IF RETVAL <> 0 THEN RET(RETVAL);                                     72171000
END <<EVAL'RETURN OF HIDE'OLD'COPY>>;                                   72172000
$PAGE "HIDE'OLD'COPY - FILE'CODE'CHECK"                                 72173000
<<----------------------------------->>                                 72174000
<< FILE'CODE'CHECK of HIDE'OLD'COPY  >>                                 72175000
<<----------------------------------->>                                 72176000
SUBROUTINE FILE'CODE'CHECK;                                             72177000
                                                                        72178000
   ! This routine checks to see that there is no privileged file code   72179000
   ! violation.  If the file has a negative filecode and the user       72180000
   ! has neither PM, SM nor OP capabilities then the user cannot purge  72181000
   ! the file and therefore the current file cannot be RESTOREd.        72182000
                                                                        72183000
BEGIN                                                                   72184000
   IF (OLD'FCODE < 0) AND (NOT SM'TOG) AND (NOT CAP'PM) AND             72185000
      NOT IGNORE'PRIV'CHECK'FLAG THEN                                   72186000
         RET (M'NEGATIVE'FILECODE);                                     72187000
                                                                        72188000
$IF X1=ON THEN                                                          72189000
   IF DEBUGGING THEN                                                    72190000
      BEGIN                                                             72191000
      SAY "   OLD FILECODE OK" ENDSAY;                                  72192000
      SEND;                                                             72193000
      END;                                                              72194000
$IF                                                                     72195000
                                                                        72196000
END;                                                                    72197000
$PAGE "OLD'LOCKWORD'CHECK of HIDE'OLD'COPY"                             72199000
<<-------------------------------------->>                              72200000
<< OLD'LOCKWORD'CHECK of HIDE'OLD'COPY  >>                              72201000
<<-------------------------------------->>                              72202000
                                                                        72203000
SUBROUTINE OLD'LOCKWORD'CHECK;                                          72204000
                                                                        72205000
   ! This routine does the lockword checking on the old file.  If the   72206000
   ! user has SM, OP, or AM capabilities or if there is no lockword     72207000
   ! then no checking occurs.  The user is prompted for the correct     72208000
   ! password.  If it is not given then the file is not RESTOREd.       72209000
                                                                        72210000
BEGIN                                                                   72211000
   IF SM'TOG OR CAP'AM THEN                                             72212000
   ELSE IF FLLOCKWORD' = OLD'LOCKWORD', (FILE'PART'SIZE) THEN           72213000
   ELSE IF LOOK'LOCK'  = OLD'LOCKWORD', (FILE'PART'SIZE) THEN           72213100
   ELSE IF OLD'LOCKWORD' = " " THEN                                     72214000
   ELSE                                                                 72214100
      BEGIN                                                             72215000
      SENDMESSAGE (RS'LOCKWORDS'DIFFERENT);                             72216000
      SENDMESSAGE (RS'MESS'DISC'LOCKWORD,,,MESS');                      72216100
      SCAN MESS' UNTIL 0, 1;                                            72216200
      LEN := TOS - @MESS';                                              72216300
      MESS' (LEN) := " ";                                               72216400
      STANDARD'TO'DISPLAY (CURR'TITLE',MESS'(LEN+1),ERRCODE,TITLE'LEN); 72217000
      LEN := LEN + TITLE'LEN + 1;                                       72218000
      MESS' (LEN) := "?";                                               72219000
      LEN := LEN + 1;                                                   72220000
      IF FREPLY (MESS', LEN) = FALSE THEN                               72221000
         RET (M'LOCKWORD'VIOL)                                          72222000
      ELSE IF MESS' <> OLD'LOCKWORD', (FILE'PART'SIZE) THEN             72223000
         RET (M'LOCKWORD'VIOL);                                         72224000
      END;                                                              72225000
                                                                        72225300
$IF X1=ON THEN                                                          72226000
   IF DEBUGGING THEN                                                    72227000
      BEGIN                                                             72228000
      SAY "   OLD LOCKWORD OK" ENDSAY;                                  72229000
      SEND;                                                             72230000
      END;                                                              72231000
$IF                                                                     72232000
END;                                                                    72233000
$PAGE "ADJUST'SECTORS of HIDE'OLD'COPY"                                 72234000
<<---------------------------------------->>                            72235000
<<  ADJUST'SECTORS of HIDE'OLD'COPY       >>                            72236000
<<---------------------------------------->>                            72237000
                                                                        72238000
SUBROUTINE ADJUST'SECTORS;                                              72239000
                                                                        72240000
   ! This routine adjusts the disc sector counts for the group and acct.72241000
                                                                        72242000
BEGIN                                                                   72243000
                                                                        72244000
   DISABLE'ARITHMETIC'TRAPS;                                            72245000
                                                                        72246000
   DR := DIRECADJUST (FILE'MAX'SECTORS - OLD'SECTORS,                   72247000
                      PARMS'TEMPI'1, RES'ACCT, RES'GROUP, PVMVTABX);    72248000
                                                                        72249000
   IF <> THEN RET (DIRECTORY'ERROR (DR));                               72250000
                                                                        72251000
   ENABLE'ARITHMETIC'TRAPS;                                             72252000
                                                                        72253000
END;                                                                    72254000
$PAGE "HIDE'OLD'COPY - DOES'OLD'COPY'EXIST"                             72255000
<<-------------------------------------->>                              72256000
<< DOES'OLD'COPY'EXIST of HIDE'OLD'COPY >>                              72257000
<<-------------------------------------->>                              72258000
                                                                        72259000
LOGICAL SUBROUTINE DOES'OLD'COPY'EXIST;                                 72260000
                                                                        72261000
   ! Boolean routine determining whether or not a disc file exists      72262000
   ! If the file exists then the global variables OLD'ADDRESS,          72263000
   ! OLD'LDEV, G'SECURITY, and A'SECURITY are set.                      72264000
                                                                        72265000
BEGIN                                                                   72266000
                                                                        72267000
$IF X1=ON THEN                 <<Debugging code>>                       72268000
   IF DEBUGGING THEN                                                    72269000
      BEGIN                                                             72270000
      SAY "   ENTERING DOES'OLD'COPY'EXIST" ENDSAY;                     72271000
      SEND;                                                             72272000
      END;                                                              72273000
$IF                                                                     72274000
   OLD'LDEV := 0;                                                       72275000
   DOES'OLD'COPY'EXIST := FALSE;                                        72276000
                                                                        72277000
   DISABLE'ARITHMETIC'TRAPS;                                            72278000
                                                                        72279000
   TYPE := 2;   <<Start at file level - go to file level>>              72280000
                                                                        72281000
   DR := DIRECFINDFILE (FILELEVEL, FILE'INDEX'PTR,RES'ACCT, RES'GROUP,  72282000
                        RES'FILE, FILE'NTRY, PVMVTABX );                72283000
                                                                        72284000
   IF <> THEN                                                           72285000
      BEGIN                                                             72286000
      ENABLE'ARITHMETIC'TRAPS;                                          72287000
                                                                        72288000
      IF DRA <> 2 THEN RET (RS'DIR'FIND'OLD)                            72289000
      ELSE IF DRB=ACCTLEVEL AND NOT CREATE'ACCT'FLAG THEN               72290000
         RET (M'NO'ACCT)                                                72291000
      ELSE IF DRB=GROUPLEVEL AND NOT CREATE'GROUP'FLAG THEN             72292000
         RET (M'NO'GROUP)                                               72293000
      ELSE IF DRB=FILELEVEL THEN DOES'OLD'COPY'EXIST := FALSE           72294000
      ELSE RET (RS'DIR'FIND'OLD);                                       72295000
      END                                                               72296000
                                                                        72297000
   ELSE                                                                 72298000
      BEGIN                                                             72299000
      ENABLE'ARITHMETIC'TRAPS;                                          72300000
                                                                        72301000
      DOES'OLD'COPY'EXIST := TRUE;                                      72302000
      OLD'ADDRESS := FILE'NTRY'ADDRESS;                                 72303000
      OLD'LDEV := LUN (OLD'ADDR'1.(00:08), PVMVTABX);                   72304000
      OLD'ADDR'1.(00:08) := 0;                                          72305000
      G'SECURITY := FILE'NTRY'GROUP'SEC;                                72306000
      A'SECURITY := FILE'NTRY'ACCT'SEC;                                 72307000
      END;                                                              72308000
                                                                        72309000
$IF X1=ON THEN                <<Debugging code>>                        72310000
   IF DEBUGGING THEN                                                    72311000
      BEGIN                                                             72312000
      SEND;                                                             72313000
      IF OLD'LDEV = 0 THEN SAY "      OLD COPY DOESN'T EXIST" ENDSAY    72314000
      ELSE                                                              72315000
         BEGIN                                                          72316000
         SAY "      OLD COPY EXISTS" ENDSAY;                            72317000
         SEND;                                                          72318000
         SAY "         OLD'LDEV = " ENDSAY;                             72319000
         SAYNUM (OLD'LDEV);                                             72320000
         SEND;                                                          72321000
         SAY "         OLD'ADDR = %" ENDSAY;                            72322000
         SAYDOCTAL(OLD'ADDRESS);                                        72323000
         END;                                                           72324000
      SEND;                                                             72325000
      END;                                                              72326000
$IF                                                                     72327000
                                                                        72328000
END <<DOES'OLD'COPY'EXIST OF HIDE'OLD'COPY>>;                           72329000
$PAGE "LOCK'OLD'COPY, WRITE'ACCESS'CHECK and ASSERT'NOT'BUSY",&         72330000
$     " OF HIDE'OLD'COPY"                                               72331000
<<---------------------------------------->>                            72332000
<<  LOCK'OLD'FILE of HIDE'OLD'COPY        >>                            72333000
<<---------------------------------------->>                            72334000
                                                                        72335000
SUBROUTINE LOCK'OLD'FILE;                                               72336000
                                                                        72337000
   ! Locks the file by setting the STORERESTORE bits and writing to disc72338000
                                                                        72339000
BEGIN                                                                   72340000
   OLD'FLSTORERESTORE := RESTORE'LOCKv;                                 72341000
   EVAL'RETURN (LABELIO (OLD'FLAB, OLD'LDEV, OLD'ADDRESS, ATTIO'WRITE,  72342000
                         RES'TITLE));                                   72343000
   FILE'LOCKED := TRUE;                                                 72344000
                                                                        72345000
$IF X1=ON THEN                                                          72346000
   IF DEBUGGING THEN                                                    72347000
      BEGIN                                                             72348000
      SAY "   OLD FILE LOCKED" ENDSAY;                                  72349000
      SEND;                                                             72350000
      END;                                                              72351000
$IF                                                                     72352000
                                                                        72353000
END;                                                                    72354000
                                                                        72355000
                                                                        72356000
                                                                        72357000
<<---------------------------------------->>                            72358000
<<  WRITE'ACCESS'CHECK of HIDE'OLD'COPY   >>                            72359000
<<---------------------------------------->>                            72360000
                                                                        72361000
SUBROUTINE WRITE'ACCESS'CHECK;                                          72362000
                                                                        72363000
   ! This routine checks to see if the user has purge access to the     72364000
   ! file.  If the user does not have purge access to the file then     72365000
   ! the file cannot be RESTOREd.                                       72366000
                                                                        72367000
BEGIN                                                                   72368000
   IF OLD'SECURE AND                                                    72369000
      NOT ACCCHECK (FILELEVEL, RES'ACCT', A'SECURITY,                   72370000
                    RES'GROUP', G'SECURITY,                             72371000
                    RES'CREATOR, OLD'FLSECMX    ).(WRITEf) THEN         72372000
         RET (M'CANT'PURGE'DISC'FILE);                                  72373000
                                                                        72374000
$IF X1=ON THEN                                                          72375000
   IF DEBUGGING THEN                                                    72376000
      BEGIN                                                             72377000
      SAY "   WRITE'ACCESS'OK" ENDSAY;                                  72378000
      SEND;                                                             72379000
      END;                                                              72380000
$IF                                                                     72381000
END;                                                                    72382000
                                                                        72383000
                                                                        72384000
                                                                        72385000
<<---------------------------------------->>                            72386000
<<  ASSERT'NOT'BUSY of HIDE'OLD'COPY      >>                            72387000
<<---------------------------------------->>                            72388000
                                                                        72389000
SUBROUTINE ASSERT'NOT'BUSY;                                             72390000
                                                                        72391000
   ! Checks to see if the file is busy. A busy file is one that is      72392000
   ! being STOREd or RESTOREd by another process, a file that is        72393000
   ! loaded, a file that is open for read and/or write access, or       72394000
   ! a file that is being accessed exclusively.                         72395000
                                                                        72396000
BEGIN                                                                   72397000
   IF OLD'FLCLID = COLD'LOAD'ID THEN                                    72398000
      IF OLD'FLSRLX <> 0 OR OLD'FLRW <> 0 THEN                          72399000
         BEGIN                                                          72400000
         IF OLD'FLSTORERESTORE = STORE'LOCKv THEN RET (M'OPEN'FOR'STORE)72401000
         ELSE IF OLD'FLSTORERESTORE = RESTORE'LOCKv THEN                72402000
            RET (M'OPEN'FOR'RESTORE)                                    72403000
         ELSE IF OLD'LOADED THEN                                        72404000
            RET (M'LOADED)                                              72405000
         ELSE IF OLD'READING THEN                                       72406000
            RET (M'OPEN'FOR'READ)                                       72407000
         ELSE IF OLD'WRITING THEN                                       72408000
            RET (M'OPEN'FOR'WRITE)                                      72409000
         ELSE IF OLD'RW THEN                                            72410000
            RET (M'OPEN'FOR'RW)                                         72411000
         ELSE IF OLD'EXCL'ACC THEN                                      72412000
            RET (M'FILE'EXCL'ACC);                                      72413000
         END;                                                           72414000
                                                                        72415000
$IF X1=ON THEN                                                          72416000
   IF DEBUGGING THEN                                                    72417000
      BEGIN                                                             72418000
      SAY "   OLD FILE IS NOT BUSY" ENDSAY;                             72419000
      SEND;                                                             72420000
      END;                                                              72421000
$IF                                                                     72422000
                                                                        72423000
END;                                                                    72424000
$PAGE "GET'OLD'FILE'SIZE of HIDE'OF'COPY"                               72425000
<<---------------------------------------->>                            72426000
<<  GET'OLD'FILE'SIZE of HIDE'OF'COPY     >>                            72427000
<<---------------------------------------->>                            72428000
                                                                        72429000
SUBROUTINE GET'OLD'FILE'SIZE;                                           72430000
                                                                        72431000
   ! Finds the size of the file to be purged, so that the adjustment    72432000
   ! to the group and acct disc space used can be made.                 72433000
                                                                        72434000
BEGIN                                                                   72435000
                                                                        72436000
   I := -1;                                                             72437000
                                                                        72438000
   OLD'SECTORS := 0D;                                                   72439000
                                                                        72440000
   WHILE (I:=I+1) < OLD'NUMEXTS DO                                      72441000
      IF OLD'EXTMAP'D (I) <> 0D THEN                                    72442000
         OLD'SECTORS := OLD'SECTORS + OLD'EXTSIZE'D;                    72443000
                                                                        72444000
   IF OLD'EXTMAP'D (OLD'NUMEXTS) <> 0D THEN                             72445000
      OLD'SECTORS := OLD'SECTORS + OLD'LASTEXTSIZ'D;                    72446000
                                                                        72447000
$IF X1=ON THEN                                                          72448000
   IF DEBUGGING THEN                                                    72449000
      BEGIN                                                             72450000
      SAY "   OLD'SECTORS = " ENDSAY;                                   72451000
      SAYDNUM (OLD'SECTORS);                                            72452000
      SEND;                                                             72453000
      END;                                                              72454000
$IF                                                                     72455000
                                                                        72456000
END;                                                                    72457000
$PAGE "HIDE'OLD'COPY - mainline"                                        72458000
$IF X1=ON THEN                <<Debugging code>>                        72459000
   IF DEBUGGING THEN                                                    72460000
      BEGIN                                                             72461000
      SAY "ENTERING HIDE'OLD'COPY" ENDSAY;                              72462000
      SEND;                                                             72463000
      END;                                                              72464000
$IF                                                                     72465000
                                                                        72466000
   GET'SIRS (TRUE, TRUE);                                               72467000
                                                                        72468000
   OLD'COPY'EXISTS := DOES'OLD'COPY'EXIST;                              72469000
                                                                        72470000
   IF OLD'COPY'EXISTS THEN                                              72471000
      BEGIN                                                             72472000
                                                                        72473000
      IF KEEP'FLAG THEN RET(M'KEEP'OLD'COPY);                           72474000
      EVAL'RETURN (LABELIO (OLD'FLAB, OLD'LDEV, OLD'ADDRESS, ATTIO'READ,72475000
                            RES'TITLE));                                72476000
      ASSERT'NOT'BUSY;                                                  72477000
      LOCK'OLD'FILE;                                                    72478000
      RELEASE'SIRS (TRUE, TRUE);                                        72479000
      WRITE'ACCESS'CHECK;                                               72480000
      FILE'CODE'CHECK;                                                  72481000
      OLD'LOCKWORD'CHECK;                                               72482000
      GET'OLD'FILE'SIZE;                                                72483000
      ADJUST'SECTORS;                                                   72484000
      END;                                                              72485000
                                                                        72486000
END'PROC:                                                               72487000
   RELEASE'SIRS (TRUE, TRUE);                                           72488000
                                                                        72489000
$IF X1=ON THEN                <<Debugging code>>                        72490000
   IF DEBUGGING THEN                                                    72491000
      BEGIN                                                             72492000
      SAY "LEAVING HIDE'OLD'COPY" ENDSAY;                               72493000
      SEND;                                                             72494000
      SEND;                                                             72495000
      END;                                                              72496000
$IF                                                                     72497000
                                                                        72498000
                                                                        72499000
END <<HIDE'OLD'COPY>>;                                                  72500000
$PAGE "WAIT'FOR'ALL'ATTIO"                                              72501000
$CONTROL SEGMENT=RESTORE                                                72502000
<<---------------------------------------->>                            72503000
<<  WAIT'FOR'ALL'ATTIO                    >>                            72504000
<<---------------------------------------->>                            72505000
                                                                        72506000
INTEGER PROCEDURE WAIT'FOR'ALL'ATTIO;                                   72507000
                                                                        72508000
   ! This procedure clears all outstanding io.  The return value is     72509000
   ! the status of any of the ios which is not ATTIO'GOOD.  If there    72510000
   ! is more than one that did not return ATTIO'GOOD then the first     72511000
   ! one is returned.  If all ios return ATTIO'GOOD then the return     72512000
   ! value is ATTIO'GOOD.                                               72513000
                                                                        72514000
BEGIN                                                                   72515000
                                                                        72516000
   DOUBLE                                                               72517000
      IO'RET;                                                           72518000
                                                                        72519000
   INTEGER                                                              72520000
      CBUFF,                                                            72521000
      CURR'STATUS      := ATTIO'GOOD,                                   72522000
      I,                                                                72523000
      IO'RET'1         =  IO'RET,                                       72524000
      IO'RET'2         =  IO'RET + 1;                                   72525000
                                                                        72526000
   DEFINE                                                               72527000
      ATTIO'STATUS     =  IO'RET'1.ATTIO'STATUSf #;                     72528000
                                                                        72529000
   IF NOT USING'ATTIO THEN                                              72530000
      RETURN;                                                           72531000
                                                                        72532000
   CBUFF := CURR'READ'BUFFER;                                           72533000
   I := -1;                                                             72534000
                                                                        72535000
   WHILE (I:=I+1) < NUM'BUFFERS DO                                      72536000
      BEGIN                                                             72537000
                                                                        72538000
      CBUFF := CBUFF + 1;                                               72539000
      IF CBUFF = NUM'BUFFERS THEN                                       72540000
         CBUFF := 0;                                                    72541000
                                                                        72542000
                                                                        72543000
      IF IO'QUEUE'D (CBUFF) <> 0D THEN                                  72544000
         BEGIN                                                          72545000
         IO'RET := WAITFORIO (IO'QUEUE(CBUFF*2));                       72546000
         OUTSTANDING'IOS := OUTSTANDING'IOS - 1;                        72547000
         IF CURR'STATUS = ATTIO'GOOD THEN                               72548000
            CURR'STATUS := ATTIO'STATUS;                                72549000
         IO'QUEUE'D(CBUFF) := 0D;                                       72550000
         END;                                                           72551000
                                                                        72552000
$IF X1=ON THEN                                                          72553000
      IF DEBUGGING THEN                                                 72554000
         BEGIN                                                          72555000
         SAY "IN WAIT'FOR'ALL'ATTIO LOOP - I=" ENDSAY;                  72556000
         SAYNUM(I);                                                     72557000
         SAY ";CBUFF=" ENDSAY;                                          72558000
         SAYNUM(CBUFF);                                                 72559000
         SAY ";STATUS=" ENDSAY;                                         72560000
         SAYNUM(ATTIO'STATUS);                                          72561000
         SEND;                                                          72562000
         END;                                                           72563000
$IF                                                                     72564000
      END;                                                              72565000
                                                                        72566000
      IF IOQ'FSF'D (0) <> 0D THEN                                       72567000
         BEGIN                                                          72568000
         IO'RET := WAITFORIO (IOQ'FSF (0));                             72569000
         IF CURR'STATUS = ATTIO'GOOD THEN                               72570000
            CURR'STATUS := ATTIO'STATUS;                                72571000
         IOQ'FSF'D (0) := 0D;                                           72572000
         END;                                                           72573000
                                                                        72574000
      IF IOQ'FSF'D (1) <> 0D THEN                                       72575000
         BEGIN                                                          72576000
         IO'RET := WAITFORIO (IOQ'FSF (1*2));                           72577000
         IF CURR'STATUS = ATTIO'GOOD THEN                               72578000
            CURR'STATUS := ATTIO'STATUS;                                72579000
         IOQ'FSF'D (1) := 0D;                                           72580000
         END;                                                           72581000
                                                                        72582000
$IF X1=ON THEN                                                          72583000
   IF DEBUGGING THEN                                                    72584000
      BEGIN                                                             72585000
      SAY "ALL ATTIO HAS BEEN COMPLETED-BUFNO=0-CURR'STATUS=" ENDSAY;   72586000
      SAYNUM (CURR'STATUS);                                             72587000
      SEND;                                                             72588000
      END;                                                              72589000
$IF                                                                     72590000
                                                                        72591000
   CURR'WAIT'BUFFER := NUM'BUFFERS - 1;                                 72592000
   CURR'READ'BUFFER := 0;                                               72593000
   WAIT'FOR'ALL'ATTIO := CURR'STATUS;                                   72594000
                                                                        72595000
END;                                                                    72596000
$PAGE "READ'ALL'ATTIO"                                                  72597000
$CONTROL SEGMENT=RESTORE                                                72598000
<<---------------------------------------->>                            72599000
<<  READ'ALL'ATTIO                        >>                            72600000
<<---------------------------------------->>                            72601000
                                                                        72602000
PROCEDURE READ'ALL'ATTIO;                                               72603000
                                                                        72604000
   ! This procedure starts reads for all of the buffers that do not     72605000
   ! have reads pending.  The current wait buffer is also not read      72606000
   ! so that it remains valid.                                          72607000
                                                                        72608000
BEGIN                                                                   72609000
                                                                        72610000
   INTEGER                                                              72611000
      I,                                                                72612000
      NUM'READS;                                                        72613000
                                                                        72614000
   I := -1;                                                             72615000
                                                                        72616000
   NUM'READS := NUM'BUFFERS - OUTSTANDING'IOS - 1;                      72617000
                                                                        72618000
   DISABLE'ARITHMETIC'TRAPS;                                            72619000
                                                                        72620000
$IF X1=ON THEN                                                          72621000
   IF DEBUGGING THEN                                                    72622000
      BEGIN                                                             72623000
      SAY "ENTERING READ'ALL'ATTIO - " ENDSAY;                          72624000
      SAY " #IO = " ENDSAY;                                             72625000
      SAYNUM (OUTSTANDING'IOS);                                         72626000
      SAY " - " ENDSAY;                                                 72627000
      SAY "READ BUF=" ENDSAY;                                           72628000
      SAYNUM (CURR'READ'BUFFER);                                        72629000
      SAY " - WAIT BUF=" ENDSAY;                                        72630000
      SAYNUM (CURR'WAIT'BUFFER);                                        72631000
      SAY " - NUM READS=" ENDSAY;                                       72632000
      SAYNUM (NUM'READS);                                               72633000
      SEND;                                                             72634000
      END;                                                              72635000
$IF                                                                     72636000
                                                                        72637000
   WHILE ((I := I+1) < (NUM'READS)) DO                                  72638000
      BEGIN                                                             72639000
                                                                        72640000
$IF X1=ON THEN                                                          72641000
      IF DEBUGGING THEN                                                 72642000
         BEGIN                                                          72643000
         SAY "   IN READ'ALL'ATTIO LOOP - I=" ENDSAY;                   72644000
         SAYNUM(I);                                                     72645000
         SAY ";CURR'READ'BUFFER=" ENDSAY;                               72646000
         SAYNUM(CURR'READ'BUFFER);                                      72647000
         SAY ";XDS=" ENDSAY;                                            72648000
         SAYNUM(BUFFER'XDS(CURR'READ'BUFFER));                          72649000
         SAY ";OFFSET=" ENDSAY;                                         72650000
         SAYNUM(BUFFER'OFFSET(CURR'READ'BUFFER));                       72651000
         SEND;                                                          72652000
         END;                                                           72653000
$IF                                                                     72654000
                                                                        72655000
      IO'QUEUE'D (CURR'READ'BUFFER) := ATTACHIO (                       72656000
                                  TAPE'LDEV,                            72657000
                                  0,                                    72658000
                                  BUFFER'XDS(CURR'READ'BUFFER),         72659000
                                  BUFFER'OFFSET(CURR'READ'BUFFER),      72660000
                                  ATTIO'READ,                           72661000
                                  TAPE'RECSIZE,                         72662000
                                  0,                                    72663000
                                  0,                                    72664000
                                  0                                     72665000
                                  );                                    72666000
                                                                        72667000
      OUTSTANDING'IOS := OUTSTANDING'IOS + 1;                           72668000
                                                                        72669000
      CURR'READ'BUFFER := CURR'READ'BUFFER + 1;                         72670000
      IF CURR'READ'BUFFER = NUM'BUFFERS THEN                            72671000
         CURR'READ'BUFFER := 0;                                         72672000
                                                                        72673000
      END;                                                              72674000
                                                                        72675000
   ENABLE'ARITHMETIC'TRAPS;                                             72676000
                                                                        72677000
                                                                        72678000
$IF X1=ON THEN                                                          72679000
   IF DEBUGGING THEN                                                    72680000
      BEGIN                                                             72681000
      SAY "READ'ALL'ATTIO DONE" ENDSAY;                                 72682000
      SEND;                                                             72683000
      END;                                                              72684000
$IF                                                                     72685000
                                                                        72686000
END;                                                                    72687000
$PAGE "FIND'CURR'FILENO"                                                72688000
<<---------------------------------------->>                            72689000
<<  FIND'CURR'FILENO                      >>                            72690000
<<---------------------------------------->>                            72691000
                                                                        72692000
DOUBLE PROCEDURE FIND'CURR'FILENO (TITLE, START, ERRNUM);               72693000
   VALUE START;                                                         72694000
   LOGICAL ARRAY TITLE;                                                 72695000
   DOUBLE START;                                                        72696000
   INTEGER ERRNUM;                                                      72697000
                                                                        72698000
   ! This procedure finds the offset into the directory of the file     72699000
   ! with name TITLE.  The search begins at the offset START.  If       72700000
   ! TITLE is not found in the directory, - (START + 1) is returned.    72701000
   !                                                                    72702000
   ! If the distance is greater than MAX'SYNCH'FILES then it is         72703000
   ! considered not found.                                              72704000
                                                                        72705000
BEGIN                                                                   72706000
   LOGICAL POINTER                                                      72707000
      DBUF;                                                             72708000
                                                                        72709000
   LOGICAL ARRAY                                                        72710000
      BUFFER (0:D'BLOCKSIZE-1);                                         72711000
                                                                        72712000
   BYTE ARRAY                                                           72713000
      TITLE'     (*) = TITLE;                                           72714000
                                                                        72715000
   BYTE POINTER                                                         72716000
      DBUF';                                                            72717000
                                                                        72718000
   DOUBLE                                                               72719000
      LAST'D'READ    := -1D,                                            72720000
      RETVAL;                                                           72721000
                                                                        72722000
   LOGICAL                                                              72723000
      STOP  := FALSE;                                                   72724000
                                                                        72725000
   INTEGER                                                              72726000
      DISTANCE := 0;                                                    72727000
                                                                        72728000
   SUBROUTINE RET (RETURN'VAL, ERROR'VAL);                              72729000
      VALUE RETURN'VAL, ERROR'VAL;                                      72730000
      DOUBLE RETURN'VAL;                                                72731000
      INTEGER ERROR'VAL;                                                72732000
   BEGIN                                                                72733000
      RETVAL := RETURN'VAL;                                             72734000
      ERRNUM := ERROR'VAL;                                              72735000
      GOTO END'FIND'CURR'FILENO;                                        72736000
   END;                                                                 72737000
                                                                        72738000
   SUBROUTINE READDIR (FILENUM, TARGET, TCOUNT, RECNUM, LAST'READ,      72739000
                       BLOCKFACTOR, BUFFER);                            72740000
      VALUE FILENUM, TCOUNT, RECNUM, BLOCKFACTOR;                       72741000
      INTEGER FILENUM;                                                  72742000
      LOGICAL TCOUNT, BLOCKFACTOR;                                      72743000
      LOGICAL POINTER TARGET;                                           72744000
      DOUBLE RECNUM, LAST'READ;                                         72745000
      LOGICAL ARRAY BUFFER;                                             72746000
                                                                        72747000
      ! The DIR file is written out in records of BLOCKFACTOR*TCOUNT    72748000
      ! words in length.  This routine deblocks those records.          72749000
                                                                        72750000
   BEGIN                                                                72751000
      IF LAST'READ = -1D OR                                             72752000
         LAST'READ / DOUBLE (BLOCKFACTOR) <>                            72753000
            RECNUM / DOUBLE (BLOCKFACTOR) THEN                          72754000
               BEGIN                                                    72755000
               FREADDIR (FILENUM, BUFFER, BLOCKFACTOR * TCOUNT,         72756000
                         RECNUM / DOUBLE (BLOCKFACTOR));                72757000
               IF = THEN                                                72758000
                  BEGIN                                                 72759000
                  END                                                   72760000
               ELSE IF > THEN                                           72761000
                  RET (-(START+1D), 0)                                  72762000
               ELSE IF < THEN                                           72763000
                  RET (START, RS'FREAD'ON'DIR);                         72764000
                                                                        72765000
               END;                                                     72766000
                                                                        72767000
      @TARGET := @BUFFER ((RECNUM MODD BLOCKFACTOR)*TCOUNT);            72768000
                                                                        72769000
      LAST'READ := RECNUM;                                              72770000
                                                                        72771000
      IF TARGET = 0 THEN                                                72772000
         RET (-(START+1D), 0);                                          72773000
   END;                                                                 72774000
                                                                        72775000
                                                                        72776000
   ERRNUM := 0;                                                         72777000
                                                                        72778000
$IF X1=ON THEN                                                          72779000
   IF DEBUGGING THEN                                                    72780000
      BEGIN                                                             72781000
      SAY "ENTERING FIND'CURR'FILENO - TITLE = " ENDSAY;                72782000
      SAY TITLE', (24) ENDSAY;                                          72783000
      SAY " - CURR'FILE'NO = %"  ENDSAY;                                72784000
      SAYDNUM (START);                                                  72785000
      SEND;                                                             72786000
      END;                                                              72787000
$IF                                                                     72788000
   IF LAST'READ'WAS'EOF THEN        ! last read was not valid file label72789000
      BEGIN                                                             72790000
      IF END'OF'TAPE'SET THEN                                           72791000
         RET (%10000000000D, 0)                                         72792000
      ELSE                                                              72793000
         RET (-(START+1D), 0);                                          72794000
      END;                                                              72795000
                                                                        72796000
   RETVAL := START - 1D;                                                72797000
                                                                        72798000
   DO                                                                   72799000
      BEGIN                                                             72800000
                                                                        72801000
      RETVAL := RETVAL + 1D;                                            72802000
      DISTANCE := DISTANCE + 1;                                         72803000
                                                                        72804000
      READDIR (D'NUM, DBUF, D'RECSIZE, RETVAL, LAST'D'READ,             72805000
               D'BLOCKFACTOR, BUFFER);                                  72806000
                                                                        72807000
      @DBUF' := @DBUF &LSL(1);                                          72808000
                                                                        72809000
$IF X1=ON THEN                                                          72810000
      IF DEBUGGING THEN                                                 72811000
         BEGIN                                                          72812000
         SAY "                   DIR ENTRY - " ENDSAY;                  72813000
         SAY DBUF', (3*FILE'PART'SIZE) ENDSAY;                          72814000
         SEND;                                                          72815000
         END;                                                           72816000
$IF                                                                     72817000
      IF DISTANCE > MAX'SYNCH'FILES THEN                                72818000
         RET (-(START+1D), 0);                                          72819000
      END                                                               72820000
   UNTIL STOP OR DBUF' = TITLE', (3*FILE'PART'SIZE);                    72821000
                                                                        72822000
END'FIND'CURR'FILENO:                                                   72823000
                                                                        72824000
   FIND'CURR'FILENO := RETVAL;                                          72825000
                                                                        72826000
$IF X1=ON THEN                                                          72827000
   IF DEBUGGING THEN                                                    72828000
      BEGIN                                                             72829000
      SAY "      RETURNS %" ENDSAY;                                     72830000
      SAYDNUM (RETVAL);                                                 72831000
      SEND;                                                             72832000
      END;                                                              72833000
$IF                                                                     72834000
END;                                                                    72835000
$PAGE "SKIP'AND'READ'TAPE"                                              72836000
!CONTROL NOLIST               !LIST                                     72837000
<<---------------------------------------->>                            72838000
<<  SKIP'AND'READ'TAPE                    >>                            72839000
<<---------------------------------------->>                            72840000
                                                                        72841000
LOGICAL PROCEDURE SKIP'AND'READ'TAPE (TDBUF, ERROR'LEVEL, GBUF);        72842000
   VALUE ERROR'LEVEL;                                                   72843000
   LOGICAL ARRAY TDBUF;                                                 72844000
   INTEGER ERROR'LEVEL;                                                 72845000
   INTEGER ARRAY GBUF;                                                  72846000
                                                                        72847000
   ! This routine keeps doing File-Skip-Forwards until the file that is 72848000
   ! located in GBUF is found.  If we go past the file in GBUF, that    72849000
   ! file is reported as LOST DURING RESYNCHRONIZATION and another      72850000
   ! record is read from the good file into GBUF and the process begins 72851000
   ! again.  Since SKIP'AND'READ'TAPE is called by READ'TAPE and        72852000
   ! recursively by itself when a tape error occurs, ERROR'LEVEL keeps  72853000
   ! track of the depth of the error recovery.  If that depth reaches   72854000
   ! MAX'ERROR'LEVEL, then RESTORE aborts even if error recovery is in  72855000
   ! effect.  If a reel change is necessary, it is performed.           72856000
                                                                        72857000
BEGIN                                                                   72858000
   BYTE ARRAY                                                           72859000
      GBUF'    (*)         =  GBUF,                                     72860000
      TDBUF'   (*)         =  TDBUF;                                    72861000
                                                                        72862000
   DOUBLE ARRAY                                                         72863000
      GBUF'D   (*)         =  GBUF;                                     72864000
                                                                        72865000
   LOGICAL                                                              72866000
      FOUND                := FALSE,                                    72867000
      NEED'AN'EXTRA'SKIP   := FALSE,                                    72868000
      NEED'TO'DO'FIND      := FALSE,                                    72869000
      USED'ERROR'RECOVERY  := FALSE;                                    72870000
                                                                        72871000
   DOUBLE                                                               72872000
      NUM'SKIPS            := 0D;                                       72873000
                                                                        72874000
   LABEL                                                                72875000
      START'AGAIN,                                                      72876000
      END'PROC;                                                         72877000
                                                                        72878000
<<---------------------------------------->>                            72879000
<<  EVAL'RETURN of SKIP'AND'READ'TAPE     >>                            72880000
<<---------------------------------------->>                            72881000
                                                                        72882000
SUBROUTINE EVAL'RETURN (RETCODE);                                       72883000
   VALUE RETCODE;                                                       72884000
   INTEGER RETCODE;                                                     72885000
BEGIN                                                                   72886000
   IF RETCODE <> 0 THEN                                                 72887000
      BEGIN                                                             72888000
      IF RETCODE > 0 THEN SENDMESSAGE (RETCODE);                        72889000
      GOTO END'PROC;                                                    72890000
      END;                                                              72891000
END;                                                                    72892000
                                                                        72893000
                                                                        72894000
<<---------------------------------------->>                            72895000
<<  FILE'FAIL of SKIP'AND'READ'TAPE       >>                            72896000
<<---------------------------------------->>                            72897000
                                                                        72898000
SUBROUTINE FILE'FAIL (FID, MSGNO);                                      72899000
   VALUE FID, MSGNO;                                                    72900000
   INTEGER FID, MSGNO;                                                  72901000
BEGIN                                                                   72902000
   IF FID <> 0 THEN PRINT'FILE'ERROR (FID);                             72903000
   IF MSGNO <> 0 THEN SENDMESSAGE (MSGNO);                              72904000
   GOTO END'PROC;                                                       72905000
END;                                                                    72906000
$PAGE "RECOVER'ERROR of SKIP'AND'READ'TAPE"                             72907000
<<---------------------------------------->>                            72908000
<<  RECOVER'ERROR of SKIP'AND'READ'TAPE   >>                            72909000
<<---------------------------------------->>                            72910000
                                                                        72911000
SUBROUTINE RECOVER'ERROR (MSGNO);                                       72912000
   VALUE MSGNO;                                                         72913000
   INTEGER MSGNO;                                                       72914000
                                                                        72915000
   ! This routine performs error recovery for  SKIP'AND'READ'TAPE.  If  72916000
   ! a tape error occurs then a message is sent out and RESTORE tells   72917000
   ! you whether or not it will do error recovery.  If it is doing      72918000
   ! error recovery then it just starts all over again, looking for     72919000
   ! the correct file.                                                  72920000
                                                                        72921000
BEGIN                                                                   72922000
   SENDMESSAGE (MSGNO);                                                 72923000
                                                                        72924000
   IF ERROR'LEVEL = MAX'ERROR'LEVEL THEN                                72925000
      BEGIN                                                             72926000
      SENDMESSAGE (RS'ERROR'LEVEL'TOO'DEEP);                            72927000
      SKIP'AND'READ'TAPE := FAILED;                                     72928000
      GOTO END'PROC;                                                    72929000
      END                                                               72930000
   ELSE IF ON'ERR = ONERR'QUIT THEN                                     72931000
      BEGIN                                                             72932000
      SENDMESSAGE (RS'ONERR'QUIT);                                      72933000
      SKIP'AND'READ'TAPE := FAILED;                                     72934000
      GOTO END'PROC;                                                    72935000
      END                                                               72936000
   ELSE IF ON'ERR = ONERR'SKIPFILE THEN                                 72937000
      BEGIN                                                             72938000
      SENDMESSAGE (RS'ONERR'SKIPFILE);                                  72939000
RECOVER'SKIPFILE:                                                       72940000
      USED'ERROR'RECOVERY := TRUE;                                      72941000
      SKIP'AND'READ'TAPE := GOOD'SKIPFILE;                              72942000
      GOTO START'AGAIN;                                                 72943000
      END                                                               72944000
   ELSE IF ON'ERR = ONERR'SKIPRECORD THEN                               72945000
      BEGIN                                                             72946000
      SENDMESSAGE (RS'ONERR'SKIPRECORD);                                72947000
      GOTO RECOVER'SKIPFILE;                                            72948000
      END;                                                              72949000
END;                                                                    72950000
$PAGE "SKIP'UNLABELED"                                                  72951000
<<---------------------------------------->>                            72952000
<<  SKIP'UNLABELED of SKIP'AND'READ'TAPE  >>                            72953000
<<---------------------------------------->>                            72954000
                                                                        72955000
SUBROUTINE SKIP'UNLABELED;                                              72956000
BEGIN                                                                   72957000
   FOUND := FALSE;                                                      72958000
                                                                        72959000
   IF END'OF'TAPE'SET THEN                                              72960000
      BEGIN                                                             72961000
      LAST'READ'WAS'EOF := TRUE;                                        72962000
      RETURN;                                                           72963000
      END;                                                              72964000
                                                                        72965000
   DO                                                                   72966000
      BEGIN                                                             72967000
                                                                        72968000
      NUM'SKIPS := GBUF'D (G'FILENUM'INX'D) - CURR'FILENO;              72969000
      IF NEED'AN'EXTRA'SKIP THEN NUM'SKIPS := NUM'SKIPS + 1D;           72970000
                                                                        72971000
      IF USING'ATTIO THEN                                               72972000
         BEGIN                                                          72973000
         FOUND := PRE'SCAN'FOR'MATCH (TDBUF, GBUF, READ'TAPE'LEN,       72974000
                                      ERROR'CODE, NUM'SKIPS);           72975000
         IF ERROR'CODE = -1 THEN                                        72976000
            EVAL'RETURN (-1)                                            72977000
                                                                        72978000
         ELSE IF ERROR'CODE <> 0 THEN                                   72979000
            RECOVER'ERROR (RS'IO'READ'UNLAB);                           72980000
                                                                        72981000
         IF NUM'SKIPS > 0D THEN                                         72982000
            BEGIN                                                       72983000
            START'A'SKIP;                                               72984000
            START'A'READ (TAPE'RECSIZE);                                72985000
            END;                                                        72986000
         END;                                                           72987000
                                                                        72988000
      WHILE (NUM'SKIPS := NUM'SKIPS - 1D) >= 0D DO                      72989000
         BEGIN                                                          72990000
                                                                        72991000
$IF X1=ON THEN                                                          72992000
         IF DEBUGGING THEN                                              72993000
            BEGIN                                                       72994000
            SAY "IN SKIP'UNLABELED-PERFORMING SKIP-NUM'SKIPS =" ENDSAY; 72995000
            SAYDNUM (NUM'SKIPS);                                        72996000
            SEND;                                                       72997000
            END;                                                        72998000
$IF                                                                     72999000
         IF USING'ATTIO AND NUM'SKIPS > 0D THEN                         73000000
            BEGIN                                                       73001000
            START'A'SKIP;                                               73002000
            START'A'READ (TAPE'RECSIZE);                                73003000
            END;                                                        73004000
                                                                        73005000
         ISSUE'SKIP (FALSE);                                            73006000
         IF ERROR'CODE <> 0 THEN                                        73007000
            RECOVER'ERROR (RS'IO'SKIP'UNLAB);                           73008000
                                                                        73009000
         ISSUE'READ (TDBUF, TAPE'RECSIZE, FALSE);                       73010000
                                                                        73011000
         MOVE'TO'TDBUF;                                                 73012000
                                                                        73013000
         IF READ'TAPE'EOF THEN                                          73014000
            RECOVER'ERROR (RS'2'EOFS)                                   73015000
                                                                        73016000
         ELSE IF ERROR'CODE <> 0 THEN                                   73017000
            RECOVER'ERROR (RS'IO'READ'UNLAB)                            73018000
                                                                        73019000
         ELSE IF READ'TAPE'LEN = TAPE'LABEL'SIZE THEN                   73020000
            BEGIN                                                       73021000
            CHECK'TAPE'LABEL (TDBUF);                                   73022000
            IF LAST'REEL THEN END'OF'TAPE'SET := TRUE                   73023000
            ELSE                                                        73024000
               EVAL'RETURN (                                            73025000
                  GET'NEXT'VOLUME (GBUF'D (G'FILENUM'INX'D), NUM'SKIPS) 73026000
                           );                                           73027000
                                                                        73028000
            IF NUM'SKIPS = 0D THEN FOUND := TRUE                        73029000
            ELSE                                                        73030000
               BEGIN                                                    73031000
               START'A'SKIP;                                            73032000
               START'A'READ (TAPE'RECSIZE);                             73033000
               END;                                                     73034000
                                                                        73035000
            END                                                         73036000
                                                                        73037000
         ELSE IF TDBUF' = GBUF' (G'TITLE'INX'), (3*FILE'PART'SIZE) THEN 73038000
            BEGIN                                                       73039000
            FOUND := TRUE;                                              73040000
            IF USING'ATTIO AND NUM'SKIPS <> 0D THEN                     73041000
               BEGIN                                                    73042000
               ISSUE'SKIP (FALSE);              ! WAIT FOR SKIP         73043000
               IF ERROR'CODE <> 0 THEN RECOVER'ERROR (RS'BACKING'UP);   73044000
                                                                        73045000
               ISSUE'READ (TDBUF, TAPE'RECSIZE, FALSE);  ! WAIT FOR READ73046000
               IF ERROR'CODE <> 0 THEN RECOVER'ERROR (RS'BACKING'UP);   73047000
                                                                        73048000
               ISSUE'CTRL (ATTIO'BSR);          ! REVERSE READ          73049000
               IF ERROR'CODE <> 0 THEN RECOVER'ERROR (RS'BACKING'UP);   73050000
                                                                        73051000
               ISSUE'CTRL (ATTIO'BSF);          ! REVERSE SKIP          73052000
               IF ERROR'CODE <> 0 THEN RECOVER'ERROR (RS'BACKING'UP);   73053000
                                                                        73054000
               ISSUE'SKIP (TRUE);               ! PASS THE TAPE MARK    73055000
               IF ERROR'CODE <> 0 THEN RECOVER'ERROR (RS'BACKING'UP);   73056000
                                                                        73057000
               START'A'READ (TAPE'RECSIZE);     ! START A NEW READ      73058000
               IF ERROR'CODE <> 0 THEN RECOVER'ERROR (RS'BACKING'UP);   73059000
                                                                        73060000
               ISSUE'READ (TDBUF, TAPE'RECSIZE, FALSE);  ! SHOULD MATCH 73061000
               IF ERROR'CODE <> 0 THEN RECOVER'ERROR (RS'BACKING'UP);   73062000
                                                                        73063000
               IF TDBUF' = GBUF' (G'FILE'INX'), (3*FILE'PART'SIZE) THEN 73064000
                  RECOVER'ERROR (RS'BACKING'UP);                        73065000
               END;                                                     73066000
            NUM'SKIPS := 0D;                                            73067000
            END                                                         73068000
                                                                        73069000
         END;                                                           73070000
                                                                        73071000
      IF NOT FOUND THEN                                                 73072000
         BEGIN                                                          73073000
                                                                        73074000
         CURR'FILENO := FIND'CURR'FILENO (TDBUF, CURR'FILENO,           73075000
                                          PARMS'TEMPI'1 );              73076000
                                                                        73077000
         IF CURR'FILENO < 0D THEN                                       73078000
            BEGIN                                                       73079000
            CURR'FILENO := -CURR'FILENO - 1D;                           73080000
            NEED'AN'EXTRA'SKIP := TRUE;                                 73081000
            END                                                         73082000
         ELSE                                                           73083000
            BEGIN                                                       73084000
            NEED'AN'EXTRA'SKIP := FALSE;                                73085000
            IF GBUF'D (G'FILENUM'INX'D) = CURR'FILENO THEN              73086000
               FOUND := TRUE;                                           73087000
            END;                                                        73088000
                                                                        73089000
         EVAL'RETURN (PARMS'TEMPI'1);                                   73090000
                                                                        73091000
         WHILE NOT FOUND AND (GBUF'D (G'FILENUM'INX'D) < CURR'FILENO) DO73092000
            BEGIN                                                       73093000
                                                                        73094000
            FAILED'FILE'COUNT := FAILED'FILE'COUNT + 1D;                73095000
                                                                        73096000
            SENDMESSAGE (M'SYNCHRONIZING);                              73097000
                                                                        73098000
            READ'GOOD'FILE;                                             73099000
            IF > THEN                                                   73100000
               BEGIN                                                    73101000
               CURR'FILENO := -1D;                                      73102000
               FOUND := TRUE;                                           73103000
               END;                                                     73104000
                                                                        73105000
            IF DISPLAY'3'TO'STANDARD (                                  73106000
                     GBUF'(G'FILE'INX'),                                73107000
                     GBUF'(G'GROUP'INX'),                               73108000
                     GBUF'(G'ACCT'INX'),                                73109000
                     CURR'TITLE',                                       73110000
                     ERROR'CODE  )                                      73111000
                  = FAILED THEN                                         73112000
               FILE'FAIL (0, SR'D'2'S'FAILED);     <<D'3'to'S failed>>  73113000
                                                                        73114000
            IF (GBUF'D (G'FILENUM'INX'D) - CURR'FILENO) = 0D AND        73115000
               NOT NEED'AN'EXTRA'SKIP THEN                              73116000
                  FOUND := TRUE;                                        73117000
            END;                                                        73118000
         END;                                                           73119000
      END                                                               73120000
   UNTIL FOUND;                                                         73121000
                                                                        73122000
!  IF USING'ATTIO THEN READ'ALL'ATTIO;                                  73123000
                                                                        73124000
END;                                                                    73125000
$PAGE "SKIP'AND'READ'TAPE mainline"                                     73126000
                                                                        73127000
$IF X1=ON THEN                                                          73128000
   IF DEBUGGING THEN                                                    73129000
      BEGIN                                                             73130000
      SAY "ENTERING SKIP'AND'READ'TAPE - CURR'FILENO=" ENDSAY;          73131000
      SAYDNUM (CURR'FILENO);                                            73132000
      SAY "-GBUF FILENO=" ENDSAY;                                       73133000
      SAYDNUM (GBUF'D(G'FILENUM'INX'D));                                73134000
      SEND;                                                             73135000
      END;                                                              73136000
$IF                                                                     73137000
                                                                        73138000
   SKIP'AND'READ'TAPE := GOOD;                                          73139000
   USED'ERROR'RECOVERY := FALSE;                                        73140000
                                                                        73141000
   ERROR'LEVEL := ERROR'LEVEL - 1;                                      73142000
START'AGAIN:                                                            73143000
   ERROR'LEVEL := ERROR'LEVEL + 1;                                      73144000
                                                                        73145000
   IF USING'ATTIO THEN SKIP'UNLABELED !HELP                             73146000
   ELSE IF LABELED THEN SKIP'UNLABELED                                  73147000
   ELSE SKIP'UNLABELED;                                                 73148000
                                                                        73149000
                                                                        73150000
                                                                        73151000
$IF X1=ON THEN                                                          73152000
   IF DEBUGGING THEN                                                    73153000
      BEGIN                                                             73154000
      SAY "DONE WITH SKIP'AND'READ'TAPE " ENDSAY;                       73155000
      IF USED'ERROR'RECOVERY THEN SAY "**USED ERROR RECOVERY**" ENDSAY; 73156000
      IF LAST'READ'WAS'EOF THEN SAY "**EOF FOUND**" ENDSAY;             73157000
      IF END'OF'TAPE'SET THEN SAY "**END OF TAPE SET**" ENDSAY;         73158000
      SEND;                                                             73159000
      IF NOT LAST'READ'WAS'EOF THEN                                     73160000
         BEGIN                                                          73161000
         SAY "FIRST 40 CHARACTERS = '" ENDSAY;                          73162000
         IF USING'ATTIO THEN                                            73163000
            MOVE'DATA'IN (BUFFER'XDS (CURR'WAIT'BUFFER),                73164000
                          BUFFER'OFFSET (CURR'WAIT'BUFFER),             73165000
                          TDBUF, 20);                                   73166000
         SAY TDBUF', (40) ENDSAY;                                       73167000
         SAY1 ("'");                                                    73168000
         SEND;                                                          73169000
         END;                                                           73170000
      END;                                                              73171000
$IF                                                                     73172000
                                                                        73173000
END'PROC:                                                               73174000
                                                                        73175000
END;                                                                    73176000
$PAGE "READ'TAPE"                                                       73177000
<<---------------------------------------->>                            73178000
<<  READ'TAPE                             >>                            73179000
<<---------------------------------------->>                            73180000
                                                                        73181000
LOGICAL PROCEDURE READ'TAPE (TDBUF, GBUF);                              73182000
   INTEGER ARRAY TDBUF,GBUF;                                            73183000
                                                                        73184000
   ! This procedure does a logical read from the tape.  The difference  73185000
   ! between this procedure and ISSUE'READ is that ISSUE'READ only does 73186000
   ! the read.  ISSUE'READ just returns error codes, eof flags and data.73187000
   ! READ'TAPE inteprets this information and does reel switching, and  73188000
   ! error recovery.                                                    73189000
   !                                                                    73190000
   ! Whenever READ'TAPE finds a tape mark (on an unlabeled tape), the   73191000
   ! next record has to be checked to insure that this is a true end    73192000
   ! of file marker and not just an end of reel marker (with            73193000
   ! continuation on the next reel.                                     73194000
   !                                                                    73195000
   ! The length of the read is returned in READ'TAPE'LEN.  If the last  73196000
   ! read was an EOF then LAST'READ'WAS'EOF is TRUE.  Data is placed    73197000
   ! in either TDBUF or into the buffer pointed to by CURR'WAIT'BUFFER. 73198000
   ! If LAST'READ'WAS'EOF and the next record was already read then     73199000
   ! READ'WAS'ALREADY'DONE is set to TRUE.                              73200000
                                                                        73201000
BEGIN                                                                   73202000
                                                                        73203000
   BYTE ARRAY TDBUF' (*) = TDBUF;                                       73204000
                                                                        73205000
   LOGICAL USED'ERROR'RECOVERY := FALSE;                                73206000
   INTEGER ERROR'LEVEL         := 0;                                    73207000
                                                                        73208000
<<---------------------------------------->>                            73209000
<<  FAIL of READ'TAPE                     >>                            73210000
<<---------------------------------------->>                            73211000
                                                                        73212000
SUBROUTINE FAIL;                                                        73213000
BEGIN                                                                   73214000
   READ'TAPE := FAILED;                                                 73215000
   GOTO END'PROC;                                                       73216000
END;                                                                    73217000
$PAGE "RECOVER'ERROR of READ'TAPE"                                      73218000
<<---------------------------------------->>                            73219000
<<  RECOVER'ERROR of READ'TAPE            >>                            73220000
<<---------------------------------------->>                            73221000
                                                                        73222000
SUBROUTINE RECOVER'ERROR(MSGNO);                                        73223000
   VALUE MSGNO;                                                         73224000
   INTEGER MSGNO;                                                       73225000
BEGIN                                                                   73226000
   SENDMESSAGE (MSGNO);                                                 73227000
                                                                        73228000
   IF ON'ERR = ONERR'QUIT THEN                                          73229000
      BEGIN                                                             73230000
      SENDMESSAGE (RS'ONERR'QUIT);                                      73231000
      READ'TAPE := FAILED;                                              73232000
      GOTO END'PROC;                                                    73233000
      END                                                               73234000
                                                                        73235000
   ELSE IF ON'ERR = ONERR'SKIPFILE THEN                                 73236000
      BEGIN                                                             73237000
                                                                        73238000
      SENDMESSAGE (RS'ONERR'SKIPFILE);                                  73239000
                                                                        73240000
RECOVER'SKIPFILE:                                                       73241000
                                                                        73242000
      ERROR'LEVEL := ERROR'LEVEL + 1;                                   73243000
      USED'ERROR'RECOVERY := TRUE;                                      73244000
      READ'TAPE := GOOD'SKIPFILE;                                       73245000
                                                                        73246000
      PARMS'TEMPI'1 := LOOK'FOR'EOF (GBUF, FALSE);                      73247000
      IF PARMS'TEMPI'1 = -1 THEN                                        73248000
         FAIL                                                           73249000
      ELSE IF PARMS'TEMPI'1 <> ATTIO'EOF THEN                           73250000
         ISSUE'SKIP (TRUE);                                             73251000
                                                                        73252000
      EOF'READ := TRUE;                                                 73253000
                                                                        73254000
      IF ERROR'CODE <> 0 THEN                                           73255000
         IF ERROR'LEVEL <= MAX'ERROR'LEVEL THEN                         73256000
            GOTO RECOVER'SKIPFILE                                       73257000
         ELSE                                                           73258000
            BEGIN                                                       73259000
            SENDMESSAGE (RS'ERROR'LEVEL'TOO'DEEP);                      73260000
            READ'TAPE := FAILED;                                        73261000
            GOTO END'PROC;                                              73262000
            END;                                                        73263000
                                                                        73264000
!     READ'TAPE := SKIP'AND'READ'TAPE (TDBUF, 1, GBUF);  !FIX           73265000
      END                                                               73266000
                                                                        73267000
   ELSE IF ON'ERR = ONERR'SKIPRECORD THEN                               73268000
      BEGIN                                                             73269000
      SENDMESSAGE (RS'ONERR'SKIPRECORD);                                73270000
      GOTO RECOVER'SKIPFILE;                                            73271000
      END;                                                              73272000
END;                                                                    73273000
$PAGE "READ'LABELED'TAPE of READ'TAPE"                                  73274000
<<---------------------------------------->>                            73275000
<<  READ'LABELED'TAPE of READ'TAPE        >>                            73276000
<<---------------------------------------->>                            73277000
                                                                        73278000
SUBROUTINE READ'LABELED'TAPE;                                           73279000
BEGIN                                                                   73280000
   ISSUE'READ (TDBUF, TAPE'RECSIZE, FALSE);                             73281000
                                                                        73282000
   IF ERROR'CODE <> 0 THEN                                              73283000
      RECOVER'ERROR (RS'IO'READ'LAB)                                    73284000
                                                                        73285000
   ELSE IF READ'TAPE'EOF THEN                                           73286000
      BEGIN                                                             73287000
      LAST'READ'WAS'EOF := TRUE;                                        73288000
                                                                        73289000
NEW'TAPE:                                                               73290000
                                                                        73291000
      ERROR'CODE := NEXTTAPEFILE (T'NUM);                               73292000
                                                                        73293000
      IF <> THEN                                                        73294000
         BEGIN                                                          73295000
                                                                        73296000
         IF ERROR'CODE = FS'LAB'END'OF'VOLUME'SET THEN                  73297000
            END'OF'TAPE'SET := TRUE                                     73298000
         ELSE IF ERROR'CODE = FS'DEV'UNAVAIL THEN                       73299000
            RECOVER'ERROR (RS'OPERATOR'REJECT)                          73300000
         ELSE                                                           73301000
            RECOVER'ERROR (RS'NEXTTAPEFILE);                            73302000
                                                                        73303000
         END                                                            73304000
                                                                        73305000
      ELSE IF LRELSW (T'NUM) THEN                                       73306000
         GOTO NEW'TAPE;                                                 73307000
      END                                                               73308000
                                                                        73309000
   ELSE                                                                 73310000
      LAST'READ'WAS'EOF := FALSE;                                       73311000
                                                                        73312000
END;                                                                    73313000
$PAGE "READ'UNLABELED'TAPE of READ'TAPE"                                73314000
<<---------------------------------------->>                            73315000
<<  READ'UNLABELED'TAPE of READ'TAPE      >>                            73316000
<<---------------------------------------->>                            73317000
                                                                        73318000
SUBROUTINE READ'UNLABELED'TAPE;                                         73319000
BEGIN                                                                   73320000
   IF END'OF'TAPE'SET THEN                                              73321000
      BEGIN                                                             73322000
      LAST'READ'WAS'EOF := TRUE;                                        73323000
      RETURN;                                                           73324000
      END;                                                              73325000
                                                                        73326000
   LAST'READ'WAS'EOF := FALSE;                                          73327000
                                                                        73328000
   IF READ'WAS'ALREADY'DONE THEN                                        73329000
      BEGIN                                                             73330000
      READ'WAS'ALREADY'DONE := FALSE;                                   73331000
      RETURN;                                                           73332000
      END;                                                              73333000
                                                                        73334000
   ISSUE'READ (TDBUF, TAPE'RECSIZE, FALSE);                             73335000
   IF ERROR'CODE <> 0 THEN RECOVER'ERROR (RS'IO'READ'UNLAB)             73336000
   ELSE IF READ'TAPE'LEN = TAPE'LABEL'SIZE THEN GOTO T'LABEL'READ       73337000
   ELSE IF READ'TAPE'EOF THEN                                           73338000
      BEGIN                                                             73339000
      IF USING'ATTIO THEN START'A'READ (TAPE'RECSIZE);                  73340000
                                                                        73341000
      LAST'READ'WAS'EOF := TRUE;                                        73342000
                                                                        73343000
      ISSUE'READ (TDBUF, TAPE'RECSIZE, FALSE);                          73344000
                                                                        73345000
      IF READ'TAPE'EOF THEN RECOVER'ERROR (RS'2'EOFS)                   73346000
      ELSE IF ERROR'CODE<>0 THEN RECOVER'ERROR (RS'IO'READ'UNLAB)       73347000
      ELSE IF READ'TAPE'LEN = TAPE'LABEL'SIZE THEN                      73348000
         BEGIN                                                          73349000
                                                                        73350000
T'LABEL'READ:                                                           73351000
                                                                        73352000
         CHECK'TAPE'LABEL (TDBUF);                                      73353000
         IF LAST'REEL THEN                                              73354000
            BEGIN                                                       73355000
            LAST'READ'WAS'EOF := TRUE;                                  73356000
            END'OF'TAPE'SET := TRUE;                                    73357000
            END                                                         73358000
         ELSE                                                           73359000
            BEGIN                                                       73360000
            LAST'READ'WAS'EOF := TL'XFIELD;                             73361000
            IF GET'NEXT'VOLUME (0D, PARMS'TEMPD'1) <> 0 THEN FAIL;      73362000
            IF LAST'READ'WAS'EOF THEN                                   73363000
               START'A'READ (TAPE'RECSIZE)                              73364000
            ELSE                                                        73365000
               READ'ALL'ATTIO;                                          73366000
            READ'WAS'ALREADY'DONE := FALSE;                             73367000
            ISSUE'READ (TDBUF, TAPE'RECSIZE, FALSE);                    73368000
            IF READ'TAPE'EOF THEN RECOVER'ERROR (RS'2'EOFS)             73369000
            ELSE IF ERROR'CODE<>0 THEN RECOVER'ERROR (RS'IO'READ'UNLAB) 73370000
            ELSE READ'WAS'ALREADY'DONE := LAST'READ'WAS'EOF;            73371000
            END;                                                        73372000
         END                                                            73373000
      ELSE                                                              73374000
         BEGIN                                                          73375000
         READ'WAS'ALREADY'DONE := TRUE;                                 73376000
         START'A'READ (TAPE'RECSIZE);                                   73377000
         END;                                                           73378000
      END                                                               73379000
   ELSE                                                                 73380000
      START'A'READ (TAPE'RECSIZE);                                      73381000
END;                                                                    73382000
$PAGE "READ'TAPE mainline"                                              73383000
   READ'TAPE := GOOD;                                                   73384000
                                                                        73385000
   IF USING'ATTIO THEN READ'UNLABELED'TAPE !HELP! READ'ATTIO'TAPE       73386000
   ELSE IF LABELED THEN READ'LABELED'TAPE                               73387000
   ELSE READ'UNLABELED'TAPE;                                            73388000
                                                                        73389000
   IF LAST'READ'WAS'EOF AND NOT USED'ERROR'RECOVERY THEN                73390000
      CURR'FILENO := CURR'FILENO + 1D;                                  73391000
                                                                        73392000
   IF USED'ERROR'RECOVERY THEN                                          73393000
      BEGIN                                                             73394000
      LAST'READ'WAS'EOF := TRUE;                                        73395000
!     READ'WAS'ALREADY'DONE := TRUE;     !FIX                           73396000
      END;                                                              73397000
                                                                        73398000
$IF X1=ON THEN                                                          73399000
   IF DEBUGGING THEN                                                    73400000
      BEGIN                                                             73401000
      SAY "DONE WITH READ'TAPE " ENDSAY;                                73402000
      IF USED'ERROR'RECOVERY THEN SAY "**USED ERROR RECOVERY**" ENDSAY; 73403000
      IF LAST'READ'WAS'EOF THEN SAY "**EOF FOUND**" ENDSAY;             73404000
      IF END'OF'TAPE'SET THEN SAY "**END OF TAPE SET**" ENDSAY;         73405000
      SEND;                                                             73406000
      IF NOT LAST'READ'WAS'EOF THEN                                     73407000
         BEGIN                                                          73408000
         SAY "FIRST 40 CHARACTERS = '" ENDSAY;                          73409000
         IF USING'ATTIO THEN                                            73410000
            MOVE'DATA'IN (BUFFER'XDS (CURR'WAIT'BUFFER),                73411000
                          BUFFER'OFFSET (CURR'WAIT'BUFFER),             73412000
                          TDBUF, 20);                                   73413000
         SAY TDBUF', (40) ENDSAY;                                       73414000
         SAY1 ("'");                                                    73415000
         SEND;                                                          73416000
         END;                                                           73417000
      END;                                                              73418000
$IF                                                                     73419000
                                                                        73420000
END'PROC:                                                               73421000
                                                                        73422000
END;                                                                    73423000
$PAGE "CHECK'DIREC"                                                     73424000
$PAGE "CHECK'USER"                                                      73425000
$CONTROL SEGMENT=RESTORE                                                73426000
<<---------------------------------------->>                            73427000
<<  CHECK'USER                           >>                             73428000
<<---------------------------------------->>                            73429000
                                                                        73430000
LOGICAL PROCEDURE CHECK'USER(ACCTNAME,USERNAME,ERRCODE);                73431000
   BYTE ARRAY                                                           73432000
      ACCTNAME,                                   ! ACCOUNT NAME        73433000
      USERNAME;                                   ! USER NAME           73434000
   INTEGER ERRCODE;                               ! ERROR CODE          73435000
                                                                        73436000
   ! This procedure can be used to determine whether or not an          73437000
   ! user is in the directory.  If the entry                            73438000
   ! exists then TRUE is returned.  If the entry doesn't exist          73439000
   ! then FALSE is returned and the reason is placed into ERRCODE.      73440000
   !                                                                    73441000
   ! If the entry does not exist and the CREATE parameter was specified 73442000
   ! then this procedure will try to create the directory entry with    73443000
   ! the command NEWUSER.  All default values are                       73444000
   ! used.                                                              73445000
                                                                        73446000
BEGIN                                                                   73447000
                                                                        73448000
   INTEGER                                                              73449000
      COM'ERROR,                                                        73450000
      COM'PARM,                                                         73451000
      TYPE      := 0;                             ! LEVEL FOR DIRECFIND 73452000
                                                                        73453000
   LOGICAL                                                              73454000
      CONTINUE  := FALSE,                                               73455000
      RET = CHECK'USER;         <<Debugging code>>                      73456000
                                                                        73457000
   LOGICAL ARRAY                                                        73458000
      DUMMY'NTRY(0:20),                                                 73459000
      DUMMY'L(0:3),                               ! DUMMY STRING        73460000
      ACCTNAME'L(*) = ACCTNAME,                   ! ACCOUNT NAME        73461000
      USERNAME'L(*) = USERNAME;                   ! USER NAME           73462000
                                                                        73463000
   LOGICAL ARRAY NTRY'USER  (0:9) = PB :=                               73464000
      "NEWUSER   ", "        ", %006415;                                73465000
                                                                        73466000
   DOUBLE DR; INTEGER DRA = DR+ 1, DRB = DR + 0; ! DIRECFIND RETURN     73467000
                                                                        73468000
$IF X1=ON THEN                <<Debugging code>>                        73469000
   IF DEBUGGING THEN                                                    73470000
      BEGIN                                                             73471000
      SAY "ENTERING CHECK USER" ENDSAY;                                 73472000
      SEND;                                                             73473000
      END;                                                              73474000
$IF                                                                     73475000
                                                                        73476000
   CHECK'USER := FAILED;                          ! INITIALIZE RETURN   73477000
                                                                        73478000
   TYPE := 0;                                                           73479000
   TYPE.(10:3) := USERLEVEL;                      ! SEARCH FOR USER     73480000
   TYPE.(13:3) := 0;                              ! START AT ROOT       73481000
                                                                        73482000
   LINKAGE := DOUBLE (USER'INDEX'PTR);                                  73483000
                                                                        73484000
   DO                                                                   73485000
      BEGIN                                                             73486000
      CONTINUE := FALSE;                                                73487000
      TOS := 0D;                               ! SPACE FOR DIRECFIND    73488000
                                                                        73489000
      DISABLE'ARITHMETIC'TRAPS;                                         73490000
                                                                        73491000
      DR := DIRECFIND (TYPE, LINKAGE, ACCTNAME'L, USERNAME'L,           73492000
                       DUMMY'L, DUMMY'NTRY);                            73493000
                                                                        73494000
      IF <> THEN                               ! ERROR                  73495000
         IF DRA <> 2 THEN ERRCODE := -1        !    NON-LEVEL ERROR     73496000
         ELSE                                  !    NOT IN DIRECTORY    73497000
            BEGIN                                                       73498000
            ENABLE'ARITHMETIC'TRAPS;                                    73499000
                                                                        73500000
            IF ((DRB = USERLEVEL) LAND CREATE'USER'FLAG) THEN           73501000
               BEGIN                                                    73502000
               MOVE DUMMY'NTRY := NTRY'USER,  (10);                     73503000
               MOVE DUMMY'NTRY(5) := USERNAME'L, (4);                   73504000
                                                                        73505000
               COMMAND (DUMMY'NTRY,COM'ERROR,COM'PARM);                 73506000
               IF COM'ERROR<>0 THEN ERRCODE := NOCREATE                 73507000
               ELSE                                                     73508000
                  BEGIN                                                 73509000
                  PARMS'TEMPI'1 := DRB;                                 73510000
                  SENDMESSAGE (M'CREATED'DIR'ENTRY);                    73511000
                  ERRCODE := 0;                                         73512000
                  CONTINUE := TRUE;                                     73513000
                  END;                                                  73514000
               END                                                      73515000
            ELSE ERRCODE := DRB;                                        73516000
            END                                                         73517000
                                                                        73518000
      ELSE                                           ! GOOD             73519000
         BEGIN                                                          73520000
         ERRCODE:=0;                                                    73521000
         CHECK'USER := GOOD;                                            73522000
         END;                                                           73523000
                                                                        73524000
      ENABLE'ARITHMETIC'TRAPS;                                          73525000
                                                                        73526000
      END                                                               73527000
   UNTIL NOT CONTINUE;                                                  73528000
                                                                        73529000
   PARMS'TEMPI'1 := USERLEVEL;                                          73530000
   PARMS'TEMPI'2 := (ERRCODE = USERLEVEL);                              73531000
                                                                        73532000
$IF X1=ON THEN                <<Debugging code>>                        73533000
   IF DEBUGGING THEN                                                    73534000
      BEGIN                                                             73535000
      SAY "LEAVING CHECK DIREC - RETURNING " ENDSAY;                    73536000
      IF RET THEN SAY "TRUE" ENDSAY                                     73537000
      ELSE SAY "FALSE" ENDSAY;                                          73538000
      SAY ";  ERRCODE = " ENDSAY;                                       73539000
      SAYNUM (ERRCODE);                                                 73540000
      SEND;                                                             73541000
      END;                                                              73542000
$IF                                                                     73543000
                                                                        73544000
                                                                        73545000
END <<CHECK'USER>>;                                                     73546000
$PAGE "WRITE'THE'FILE"                                                  73547000
$CONTROL SEGMENT=RESTORE                                                73548000
<<---------------------------------------->>                            73549000
<<  WRITE'THE'FILE                        >>                            73550000
<<---------------------------------------->>                            73551000
                                                                        73552000
INTEGER PROCEDURE WRITE'THE'FILE (TDBUF, GBUF);                         73553000
   INTEGER ARRAY TDBUF, GBUF;                                           73554000
                                                                        73555000
   ! This procedure writes the file to disc.  If more data is necessary 73556000
   ! READ'TAPE is called.                                               73557000
                                                                        73558000
BEGIN                                                                   73559000
   DOUBLE ARRAY                                                         73560000
      DISJ'EXT'LEN (0:31),                                              73561000
      DISJ'EXT'ADDR (0:31);                                             73562000
                                                                        73563000
   DOUBLE                                                               73564000
      LOCAL'IOB,                                                        73565000
      SECTOR'ADDRESS,                                                   73566000
      SECTORS,                                                          73567000
      SECTORS'TO'WRITE,                                                 73568000
      SUB'IOB;                                                          73569000
                                                                        73570000
   INTEGER                                                              73571000
      ATTIO'STATUS         = LOCAL'IOB,                                 73572000
      DISC'LDEV,                                                        73573000
      EXT,                                                              73574000
      NUM'DISJ'EXTS,                                                    73575000
      SECTOR'ADDR'1        = SECTOR'ADDRESS,                            73576000
      SECTOR'ADDR'2        = SECTOR'ADDRESS + 1,                        73577000
      SECTORS'LEFT'IN'BUF,                                              73578000
      SECTORS'THIS'WRITE,                                               73579000
      TAPE'BUFF'OFFSET;                                                 73580000
                                                                        73581000
   LOGICAL                                                              73582000
      READ'TAPE'RET;                                                    73583000
                                                                        73584000
   DEFINE                                                               73585000
      CHANGE'FROM'SECTORS = &LSL (7) #,                                 73586000
      CHANGE'TO'SECTORS   = &LSR (7) #;                                 73587000
$PAGE "RET, DIMIN, and MIN of WRITE'THE'FILE"                           73588000
<<----------------------------->>                                       73589000
<< RET of WRITE'THE'FILE       >>                                       73590000
<<----------------------------->>                                       73591000
   SUBROUTINE RET(A);                                                   73592000
      VALUE A;                                                          73593000
      INTEGER A;                                                        73594000
   BEGIN                                                                73595000
      WRITE'THE'FILE := A;                                              73596000
      GOTO END'WRITE'THE'FILE;                                          73597000
   END;                                                                 73598000
<<----------------------------->>                                       73599000
<< DIMIN of WRITE'THE'FILE     >>                                       73600000
<<----------------------------->>                                       73601000
                                                                        73602000
INTEGER SUBROUTINE DIMIN (A,B);                                         73603000
   VALUE A,B;                                                           73604000
   DOUBLE A;                          ! THE TWO VALUES                  73605000
   LOGICAL B;                                                           73606000
                                                                        73607000
   ! Returns the minimum of the two passed values                       73608000
                                                                        73609000
BEGIN                                                                   73610000
   IF A < DOUBLE (B) THEN                                               73611000
      DIMIN := INTEGER (A)                                              73612000
   ELSE                                                                 73613000
      DIMIN := B;                                                       73614000
END <<DIMIN>>;                                                          73615000
                                                                        73616000
                                                                        73617000
                                                                        73618000
<<----------------------------->>                                       73619000
<< MIN of WRITE'THE'FILE       >>                                       73620000
<<----------------------------->>                                       73621000
                                                                        73622000
INTEGER SUBROUTINE MIN(A,B);                                            73623000
   VALUE A,B;                                                           73624000
   INTEGER A,B;                         ! the two values  (R/O)         73625000
                                                                        73626000
   ! Returns the minimum of the two values                              73627000
                                                                        73628000
BEGIN                                                                   73629000
   MIN := IF A < B THEN A ELSE B;                                       73630000
END <<MIN>>;                                                            73631000
$PAGE "WRITE'DISC of WRITE'THE'FILE"                                    73632000
<<----------------------------->>                                       73633000
<< WRITE'DISC of WRITE'THE'FILE>>                                       73634000
<<----------------------------->>                                       73635000
INTEGER SUBROUTINE WRITE'DISC (DST, BUFFER, SECTS, IOB);                73636000
         VALUE   DST, BUFFER, SECTS;  <<NAME IOB;>>                     73637000
         INTEGER DST, BUFFER, SECTS;                                    73638000
         DOUBLE  IOB;                                                   73639000
                                                                        73640000
         <<This routine reads the specified number of                   73641000
           words/bytes from disk to the designated buffer.              73642000
           (If LEN >= 0, is in units of words; if < 0, is               73643000
           in units of bytes.)                                          73644000
           If DST = 0, then BUFFER is a DB relative stack               73645000
           address; if DST > 0 then BUFFER is the offset into           73646000
           the data segment.>>                                          73647000
                                                                        73648000
   BEGIN                                                                73649000
                                                                        73650000
                                                                        73651000
                                                                        73652000
$IF X1=ON THEN                <<Debugging code>>                        73653000
   IF DEBUGGING THEN                                                    73654000
      BEGIN                                                             73655000
      SAY "WRITE'DISC (" ENDSAY;                                        73656000
      SAYNUM (DISC'LDEV);                                               73657000
      SAY1 ("%");                                                       73658000
      SAYDOCTAL (SECTOR'ADDRESS);                                       73659000
      SAY " -> " ENDSAY;                                                73660000
      SAYNUM (DST);                                                     73661000
      SAY " @ %" ENDSAY;                                                73662000
      SAYOCTAL (BUFFER);                                                73663000
      SAY " for " ENDSAY;                                               73664000
      SAYNUM (SECTS);                                                   73665000
      SEND;                                                             73666000
      END;                                                              73667000
$IF                           <<Debugging code>>                        73668000
                                                                        73669000
         <<read from disk...for explanation of ATTACHIO                 73670000
           parameters, see I/O system IMS...>>                          73671000
                                                                        73672000
   DISABLE'ARITHMETIC'TRAPS;                                            73673000
                                                                        73674000
   LOCAL'IOB:=ATTACHIO (                                                73675000
                  DISC'LDEV,                                            73676000
                  0,             <<QMISC>>                              73677000
                  DST,           << 0 = stack, >0 = dst>>               73678000
                  BUFFER,        <<offset into stack/dst of data>>      73679000
                  ATTIO'WRITE,   << 0 = read, 1 = write>>               73680000
                  SECTS CHANGE'FROM'SECTORS,  <<LENGTH IN WORDS>>       73681000
                  SECTOR'ADDR'1, << top half of disc address>>          73682000
                  SECTOR'ADDR'2, << bottom half of disc address>>       73683000
                  1);            << request=blocked...wait til done>>   73684000
                                                                        73685000
   IOB:=LOCAL'IOB;                                                      73686000
                                                                        73687000
   IF ATTIO'STATUS.ATTIO'STATUSf = ATTIO'GOOD THEN                      73688000
      WRITE'DISC := 0                                                   73689000
   ELSE                                                                 73690000
      WRITE'DISC := M'DISK'WRITE'FAILED;                                73691000
                                                                        73692000
                                                                        73693000
$IF X1=ON THEN                <<Debugging code>>                        73694000
   IF DEBUGGING THEN                                                    73695000
      BEGIN                                                             73696000
      SAY "   WRITE'DISC --> " ENDSAY;                                  73697000
      SAY1 ("%");                                                       73698000
      SAYOCTAL (ATTIO'STATUS);                                          73699000
      SAY " (status=" ENDSAY;                                           73700000
      SAYNUM (ATTIO'STATUS.ATTIO'STATUSf);                              73701000
      SAY1 (")");                                                       73702000
      SEND;                                                             73703000
      END;                                                              73704000
$IF                           <<Debugging code>>                        73705000
                                                                        73706000
   <<ENABLE'ARITHMETIC'TRAPS;  ... not done because the                 73707000
     procedure exit will restore them to the caller's                   73708000
     old state.>>                                                       73709000
                                                                        73710000
   END <<WRITE'DISC>>;                                                  73711000
$PAGE "XEQ'TAPE'READ of WRITE'THE'FILE"                                 73712000
<<---------------------------------------->>                            73713000
<<  XEQ'READ'TAPE of WRITE'THE'FILE       >>                            73714000
<<---------------------------------------->>                            73715000
                                                                        73716000
SUBROUTINE XEQ'READ'TAPE;                                               73717000
                                                                        73718000
   ! Interface to READ'TAPE                                             73719000
                                                                        73720000
BEGIN                                                                   73721000
   READ'TAPE'RET := READ'TAPE (TDBUF, GBUF);                            73722000
   IF READ'TAPE'RET = FAILED THEN                                       73723000
      BEGIN                                                             73724000
      KILL'RESTORE := TRUE;                                             73725000
      RET (-1);                                                         73726000
      END                                                               73727000
   ELSE IF READ'TAPE'RET = GOOD'SKIPFILE THEN                           73728000
      BEGIN                                                             73729000
      SENDMESSAGE (M'CONTAINED'TAPE'ERROR);                             73730000
      RET (-1);                                                         73731000
      END;                                                              73732000
                                                                        73733000
   IF LAST'READ'WAS'EOF THEN                                            73734000
      BEGIN                                                             73735000
      EOF'READ := TRUE;                                                 73736000
      RET (M'NOT'ALL'SECTORS'WRITTEN);                                  73737000
      END;                                                              73738000
                                                                        73739000
   IF READ'TAPE'LEN MOD SECTORSIZE <> 0 THEN                            73740000
      RET (RS'T'BAD'RECSIZE);                                           73741000
END;                                                                    73742000
$PAGE "XEQ'DISK'WRITE of WRITE'THE'FILE"                                73743000
<<---------------------------------------->>                            73744000
<<  XEQ'WRITE'DISC of WRITE'THE'FILE      >>                            73745000
<<---------------------------------------->>                            73746000
                                                                        73747000
SUBROUTINE XEQ'WRITE'DISC (SECTS);                                      73748000
   VALUE SECTS;                                                         73749000
   INTEGER SECTS;                                                       73750000
                                                                        73751000
   ! Interface to WRITE'DISC                                            73752000
                                                                        73753000
BEGIN                                                                   73754000
   IF USING'ATTIO THEN                                                  73755000
      WRITE'DISC (                                                      73756000
                  BUFFER'XDS (CURR'WAIT'BUFFER),                        73757000
                  BUFFER'OFFSET (CURR'WAIT'BUFFER) +                    73758000
                      (TAPE'BUFF'OFFSET CHANGE'FROM'SECTORS),           73759000
                  SECTS,                                                73760000
                  SUB'IOB)                                              73761000
   ELSE                                                                 73762000
      WRITE'DISC (                                                      73763000
                  0,                                                    73764000
                  @TDBUF (TAPE'BUFF'OFFSET CHANGE'FROM'SECTORS),        73765000
                  SECTS,                                                73766000
                  SUB'IOB);                                             73767000
END;                                                                    73768000
$PAGE "WRITE'EXTENT of WRITE'THE'FILE"                                  73769000
<<---------------------------------------->>                            73770000
<<  WRITE'EXTENT of WRITE'THE'FILE        >>                            73771000
<<---------------------------------------->>                            73772000
                                                                        73773000
SUBROUTINE WRITE'EXTENT (EXTENT'NUM);                                   73774000
   VALUE EXTENT'NUM;                                                    73775000
   INTEGER EXTENT'NUM;                                                  73776000
                                                                        73777000
   ! Writes out a single disjoint extent to disc.  Calls are made to    73778000
   ! XEQ'READ'TAPE and XEQ'WRITE'DISC                                   73779000
                                                                        73780000
BEGIN                                                                   73781000
   SECTORS'TO'WRITE := DISJ'EXT'LEN (EXTENT'NUM);                       73782000
   SECTOR'ADDRESS := DISJ'EXT'ADDR (EXTENT'NUM);                        73783000
   DISC'LDEV := LUN (SECTOR'ADDR'1.(00:08), PVMVTABX);                  73784000
   SECTOR'ADDR'1 . (0:8) := 0;                                          73785000
                                                                        73786000
   IF EXTENT'NUM = 0 THEN                                               73787000
      BEGIN                                                             73788000
      SECTORS'TO'WRITE := SECTORS'TO'WRITE - 1D;                        73789000
      SECTOR'ADDRESS := SECTOR'ADDRESS + 1D;                            73790000
      END;                                                              73791000
                                                                        73792000
$IF X1=ON THEN                                                          73793000
   IF DEBUGGING THEN                                                    73794000
      BEGIN                                                             73795000
      SAY "      EXTENT = " ENDSAY;                                     73796000
      SAYNUM (EXTENT'NUM);                                              73797000
      SAY "; DISC'LDEV = " ENDSAY;                                      73798000
      SAYNUM (DISC'LDEV);                                               73799000
      SEND;                                                             73800000
      END;                                                              73801000
$IF                                                                     73802000
                                                                        73803000
   WHILE (SECTORS'TO'WRITE > 0D) DO                                     73804000
      BEGIN                                                             73805000
      IF SECTORS'LEFT'IN'BUF = 0 THEN                                   73806000
         BEGIN                                                          73807000
         XEQ'READ'TAPE;                                                 73808000
         SECTORS'LEFT'IN'BUF := READ'TAPE'LEN CHANGE'TO'SECTORS;        73809000
         TAPE'BUFF'OFFSET := 0;                                         73810000
         END;                                                           73811000
                                                                        73812000
      SECTORS'THIS'WRITE := DIMIN (SECTORS'TO'WRITE,                    73813000
                                   SECTORS'LEFT'IN'BUF );               73814000
                                                                        73815000
      XEQ'WRITE'DISC (SECTORS'THIS'WRITE);                              73816000
                                                                        73817000
$IF X1=ON THEN                                                          73818000
      IF DEBUGGING THEN                                                 73819000
         BEGIN                                                          73820000
         SAY "         SECTORS'TO'WRITE = " ENDSAY;                     73821000
         SAYDNUM (SECTORS'TO'WRITE);                                    73822000
         SAY "; SECTORS'LEFT'IN'BUF = " ENDSAY;                         73823000
         SAYNUM (SECTORS'LEFT'IN'BUF);                                  73824000
         SEND;                                                          73825000
         SAY "         SECTOR'ADDRESS = %" ENDSAY;                      73826000
         SAYDOCTAL (SECTOR'ADDRESS);                                    73827000
         SAY "; TAPE'BUFF'OFFSET = %" ENDSAY;                           73828000
         SAYOCTAL (TAPE'BUFF'OFFSET);                                   73829000
         SEND;                                                          73830000
         SAY "         SECTORS'THIS'WRITE = " ENDSAY;                   73831000
         SAYNUM (SECTORS'THIS'WRITE);                                   73832000
         SEND;                                                          73833000
         END;                                                           73834000
$IF                                                                     73835000
      SECTOR'ADDRESS := SECTOR'ADDRESS + DOUBLE (SECTORS'THIS'WRITE);   73836000
      SECTORS'LEFT'IN'BUF := SECTORS'LEFT'IN'BUF - SECTORS'THIS'WRITE;  73837000
      TAPE'BUFF'OFFSET := TAPE'BUFF'OFFSET + SECTORS'THIS'WRITE;        73838000
      SECTORS'TO'WRITE := SECTORS'TO'WRITE - DOUBLE (SECTORS'THIS'WRITE)73839000
      END;                                                              73840000
END;                                                                    73841000
$PAGE "SCRUNCH'EXTENTS"                                                 73842000
<<---------------------------------------->>                            73843000
<<  SCRUNCH'EXTENTS of WRITE'THE'FILE     >>                            73844000
<<---------------------------------------->>                            73845000
                                                                        73846000
SUBROUTINE SCRUNCH'EXTENTS;                                             73847000
                                                                        73848000
   ! This procedure creates an extent map of contiguous extents that    73849000
   ! are going to be used by WRITE'THE'FILE.  After joining contiguous  73850000
   ! extents, the disjoint extents are trimmed down to just the number  73851000
   ! of sectors that are in the file.                                   73852000
                                                                        73853000
BEGIN                                                                   73854000
   JOIN'CONTIGUOUS'EXTENTS (NUM'DISJ'EXTS, DISJ'EXT'ADDR,               73855000
                            DISJ'EXT'LEN, FLEXTMAP'D, FLNUMEXTS+1,      73856000
                            FLEXTSIZE'D, FLLASTEXTSIZE'D);              73857000
                                                                        73858000
   SECTORS := 0D;                                                       73859000
   EXT := -1;                                                           73860000
                                                                        73861000
   ! Trim down the file.                                                73862000
                                                                        73863000
   WHILE (EXT := EXT+1) <= NUM'DISJ'EXTS DO                             73864000
      BEGIN                                                             73865000
      SECTORS := SECTORS + DISJ'EXT'LEN (EXT);                          73866000
      IF SECTORS >= FILE'SECTORS THEN                                   73867000
         BEGIN                                                          73868000
         NUM'DISJ'EXTS := EXT;                                          73869000
         DISJ'EXT'LEN (EXT) := DISJ'EXT'LEN (EXT) -                     73870000
                                  (SECTORS - FILE'SECTORS);             73871000
         END;                                                           73872000
      END;                                                              73873000
                                                                        73874000
$IF X1=ON THEN                                                          73875000
   IF DEBUGGING THEN                                                    73876000
      BEGIN                                                             73877000
      SAY "AFTER SCRUNCHING EXTENTS" ENDSAY;                            73878000
      SEND;                                                             73879000
      EXT := -1;                                                        73880000
      WHILE (EXT:=EXT+1) <= NUM'DISJ'EXTS DO                            73881000
         BEGIN                                                          73882000
         SAY "   DISJOINT EXTENT #" ENDSAY;                             73883000
         SAYNUM (EXT);                                                  73884000
         SAY " AT ADDRESS %" ENDSAY;                                    73885000
         SAYDOCTAL (DISJ'EXT'ADDR(EXT));                                73886000
         SAY " FOR " ENDSAY;                                            73887000
         SAYDNUM (DISJ'EXT'LEN(EXT));                                   73888000
         SEND;                                                          73889000
         END;                                                           73890000
      END;                                                              73891000
$IF                                                                     73892000
END;                                                                    73893000
$PAGE "WRITE'THE'FILE mainline"                                         73894000
   SCRUNCH'EXTENTS;                                                     73895000
                                                                        73896000
   TAPE'BUFF'OFFSET := 1;                                               73897000
   SECTORS'LEFT'IN'BUF := (READ'TAPE'LEN CHANGE'TO'SECTORS) - 1;        73898000
                                                                        73899000
   EXT := 0;                                                            73900000
                                                                        73901000
   DO                                                                   73902000
      BEGIN                                                             73903000
      WRITE'EXTENT (EXT);                                               73904000
      EXT := EXT + 1;                                                   73905000
      END                                                               73906000
   UNTIL (EXT > NUM'DISJ'EXTS);                                         73907000
                                                                        73908000
   READ'TAPE'RET := READ'TAPE (TDBUF, GBUF);                            73909000
   IF READ'TAPE'RET = FAILED THEN                                       73910000
      BEGIN                                                             73911000
      KILL'RESTORE := TRUE;                                             73912000
      RET(-1);                                                          73913000
      END;                                                              73914000
                                                                        73915000
   IF NOT LAST'READ'WAS'EOF THEN RET(M'MISSING'EOF)                     73916000
   ELSE EOF'READ := TRUE;                                               73917000
                                                                        73918000
END'WRITE'THE'FILE:                                                     73919000
                                                                        73920000
END;                                                                    73921000
$PAGE "[RESTORE]  FRESTORE --- RESTORE files from tape to disk"         73922000
$CONTROL SEGMENT=IRESTORE                                               73923000
<<*****************************************************************>>   73924000
<<---------------------------------------->>                            73925000
<<  FRESTORE                              >>                            73926000
<<---------------------------------------->>                            73927000
                                                                        73928000
LOGICAL PROCEDURE FRESTORE (TDBUF);                                     73929000
   INTEGER ARRAY TDBUF;                                                 73930000
   OPTION PRIVILEGED, UNCALLABLE;                                       73931000
                                                                        73932000
   ! This is the main procedure for restoring all the files             73933000
   ! that are to be restored.  The two major parts of this              73934000
   ! procedure are finding the file to be restored and then             73935000
   ! restoring it.  The first part is done by the subroutines           73936000
   ! internal to this procedure.  The second part is done by            73937000
   ! a call to RESTORE'A'FILE.                                          73938000
                                                                        73939000
   <<-------------------------------------------------                  73940000
     Note: the following PARMS standard-form titles                     73941000
     are used in this routine:                                          73942000
                                                                        73943000
        CURR'TITLE' ... this is the std-form of the                     73944000
                        file title just read from the                   73945000
                        GOOD file.                                      73946000
     ----------------------------------------------->>                  73947000
                                                                        73948000
BEGIN                                                                   73949000
         <<Declarations for file label and tape header...>>             73950000
                                                                        73951000
                                                                        73952000
   DOUBLE ARRAY                                                         73953000
      GBUF'D      (0:G'RECSIZE/2);                                      73954000
                                                                        73955000
   INTEGER ARRAY                                                        73956000
      GBUF        (*) = GBUF'D (0),                                     73957000
      NEW'FLAB    (0:FILE'LABEL'SIZE),   <<1 word extra>>               73958000
      SCRATCH     (0:D'RECSIZE);                                        73959000
                                                                        73960000
   INTEGER                                                              73961000
      BUF'INX,                                                          73962000
      CUR'INX,                                                          73963000
      CUR'XDS,                                                          73964000
      I           := 0,                                                 73965000
      LEN         := 0,       <<length of last FREAD from tape>>        73966000
      JITDST      := 0,       <<DST of JIT>>                            73967000
      NUM'IO      := 0,       <<NUMBER OF IOQ'S PER XDS>>               73968000
      REQ'TYPE    := 0,       <<Requisition type for DISMOUNT>>         73969000
      STATE       := 0,       <<state this routine is in>>              73970000
      SUB'CODE,                                                         73971000
      X           := 0,       <<used by CHECKSUM>>                      73972000
      XDS'SIZE;                                                         73973000
                                                                        73974000
   BYTE ARRAY                                                           73975000
      GBUF'    (*) = GBUF,                                              73976000
      SCRATCH' (*) = SCRATCH;                                           73977000
                                                                        73978000
   BYTE POINTER                                                         73979000
      TDBUF';                                                           73980000
                                                                        73981000
   LOGICAL                                                              73982000
      BREAK'SENSED;                                                     73983000
                                                                        73984000
   LABEL                                                                73985000
      END'FRESTORE;                                                     73986000
                                                                        73987000
   EQUATE                                                               73988000
         <<states...>>                                                  73989000
                                                                        73990000
      INITIALIZING'state    = 0;                                        73991000
                                                                        73992000
   DEFINE                                                               73993000
      NONSYSVS    = R (GLINKAGE).(PVF) = PV #;                          73994000
$PAGE "[RESTORE]  FRESTORE --- error handling subroutines"              73995000
<<---------------------------------------->>                            73996000
<<  RELEASE'BUFFERS of FRESTORE           >>                            73997000
<<---------------------------------------->>                            73998000
                                                                        73999000
                                                                        74000000
SUBROUTINE RELEASE'BUFFERS;                                             74001000
                                                                        74002000
   <<this routine releases any XDS buffers obtained by                  74003000
     the ALLOCATE'BUFFERS subroutine.  This may entail                  74004000
     unfreezing and unlocking prior to releasing.     >>                74005000
                                                                        74006000
BEGIN                                                                   74007000
                                                                        74008000
   CUR'INX:=-1;                                                         74009000
                                                                        74010000
   WHILE (CUR'INX:=CUR'INX+1) < NUM'XDS     DO                          74011000
      BEGIN                                                             74012000
                                                                        74013000
$IF X1=ON THEN                                                          74014000
      IF DEBUGGING THEN                                                 74015000
         BEGIN                                                          74016000
         SAY "CURRENT BUFFER = " ENDSAY;                                74017000
         SAYNUM (CUR'INX);                                              74018000
         SAY " ; XDS #" ENDSAY;                                         74019000
         SAYNUM (XDS'NUM(CUR'INX));                                     74020000
         SEND;                                                          74021000
         END;                                                           74022000
$IF                                                                     74023000
                                                                        74024000
            <<NOTE: the order here is important!!!>>                    74025000
                                                                        74026000
      IF XDS'STATUS(CUR'INX) = bufstat'FROZEN THEN                      74027000
         BEGIN                                                          74028000
         UNFREEZE (XDS'NUM(CUR'INX), 1, 0);                             74029000
         XDS'STATUS(CUR'INX):=bufstat'LOCKED;                           74030000
$IF X1=ON THEN                                                          74031000
         IF DEBUGGING THEN                                              74032000
            BEGIN                                                       74033000
            SAY "   BUFFER UNFROZEN" ENDSAY;                            74034000
            SEND;                                                       74035000
            END;                                                        74036000
$IF                                                                     74037000
         END;                                                           74038000
                                                                        74039000
      IF XDS'STATUS(CUR'INX) = bufstat'LOCKED THEN                      74040000
         BEGIN                                                          74041000
         UNLOCKSEG (XDS'NUM(CUR'INX), 1, 0);                            74042000
         XDS'STATUS(CUR'INX):=bufstat'ALLOCATED;                        74043000
$IF X1=ON THEN                                                          74044000
         IF DEBUGGING THEN                                              74045000
            BEGIN                                                       74046000
            SAY "   BUFFER UNLOCKED" ENDSAY;                            74047000
            SEND;                                                       74048000
            END;                                                        74049000
$IF                                                                     74050000
         END;                                                           74051000
                                                                        74052000
      IF XDS'STATUS(CUR'INX) = bufstat'ALLOCATED then                   74053000
         BEGIN                                                          74054000
         RELDATASEG (XDS'NUM(CUR'INX));                                 74055000
         XDS'STATUS(CUR'INX):=bufstat'EMPTY;                            74056000
$IF X1=ON THEN                                                          74057000
         IF DEBUGGING THEN                                              74058000
            BEGIN                                                       74059000
            SAY "   BUFFER RELEASED" ENDSAY;                            74060000
            SEND;                                                       74061000
            END;                                                        74062000
$IF                                                                     74063000
         END;                                                           74064000
                                                                        74065000
      END;                                                              74066000
                                                                        74067000
END <<RELEASE'BUFFERS SUB>>;                                            74068000
$PAGE "[RESTORE]  FRESTORE --- utility subroutines"                     74069000
<<---------------------------------------->>                            74070000
<<  ALLOCATE'BUFFERS of FRESTORE          >>                            74071000
<<---------------------------------------->>                            74072000
                                                                        74073000
LOGICAL SUBROUTINE ALLOCATE'BUFFERS;                                    74074000
                                                                        74075000
   <<this routine allocates NUM'XDS     extra data segments.            74076000
     If it fail in this, it returns FAILED and releases                 74077000
     any buffers it got.                                                74078000
                                                                        74079000
     It tries to get NUM'XDS     data segment buffers,                  74080000
     each of which is large enough to hold MAX'IO areas                 74081000
     of TAPE'RECSIZE words in length.  If this fails,                   74082000
     it starts decrementing NUM'IO (initially set to MAX'IO)            74083000
     until it gets that many or until NUM'IO < 1.  If it                74084000
     fails to allocate the buffers, a FAILED is returned                74085000
     and all buffers it did get (if any) are released.                  74086000
     If it succeeds, all buffers are locked & frozen into               74087000
     memory and a GOOD is returned.                                     74088000
                                                                        74089000
     Note: we must investigate whether or not these buffers             74090000
     really need to be locked & frozen...ATTACHIO may be                74091000
     sufficiently smart in MPE-IV to temporarily lock them              74092000
     in memory while in use.  If so, we should probably                 74093000
     remove the locking/freezing code unless we decide                  74094000
     (after performance analysis) that we know better than              74095000
     MPE-IV's memory manager.                                           74096000
                                                                        74097000
     Note: ATTACHIO is not sufficiently smart to lock them              74098000
     in memory, so we have to.                                          74099000
                                                             >>         74100000
                                                                        74101000
BEGIN                                                                   74102000
                                                                        74103000
   ALLOCATE'BUFFERS:=FAILED;        <<assumption>>                      74104000
                                                                        74105000
   I:=NUM'XDS    *MAX'IO;                                               74106000
   FILL (XDS'STATUS, NUM'XDS    , bufstat'EMPTY);                       74107000
   FILL (BUFFER'XDS,    I          , 0);                                74108000
   FILL (IO'QUEUE,      I*2,         0);                                74109000
   FILL (IO'LEN,        I,           0);                                74110000
   IOQ'FSF'D := 0D;                                                     74111000
                                                                        74112000
         <<see how big XDS'SIZE should be...>>                          74113000
         <<warning: since MAX'XDS'SIZE is near 32767,                   74114000
           be careful not to change this code and cause                 74115000
           an integer overflow!                        >>               74116000
                                                                        74117000
   NUM'IO:=(MAX'XDS'SIZE - XDS'OVERHEAD)/TAPE'RECSIZE;                  74118000
   IF NUM'IO > MAX'IO THEN                                              74119000
      NUM'IO:=MAX'IO;                                                   74120000
   XDS'SIZE:=NUM'IO*TAPE'RECSIZE + XDS'OVERHEAD;                        74121000
                                                                        74122000
   CUR'INX:=-1;                                                         74123000
   BUF'INX := 0;                                                        74124000
                                                                        74125000
   WHILE (CUR'INX:=CUR'INX+1) < NUM'XDS     DO                          74126000
      BEGIN                                                             74127000
                                                                        74128000
$IF X1=ON THEN                <<Debugging code>>                        74129000
      IF DEBUGGING THEN                                                 74130000
         BEGIN                                                          74131000
         SAY "Allocate buffer # " ENDSAY;                               74132000
         SAYNUM (CUR'INX);                                              74133000
         SAY " of " ENDSAY;                                             74134000
         SAYNUM (XDS'SIZE);                                             74135000
         SAY " words,  NUM'IO = " ENDSAY;                               74136000
         SAYNUM (NUM'IO);                                               74137000
         SEND;                                                          74138000
         END;                                                           74139000
$IF                           <<Debugging code>>                        74140000
                                                                        74141000
         <<allocate a buffer of size XDS'SIZE words...>>                74142000
                                                                        74143000
      CUR'XDS:=GETDATASEG (XDS'SIZE, 0);                                74144000
                                                                        74145000
      IF < THEN                                                         74146000
         BEGIN          <<error grabbing an XDS>>                       74147000
                                                                        74148000
$IF X1=ON THEN                <<Debugging code>>                        74149000
         IF DEBUGGING THEN                                              74150000
            BEGIN                                                       74151000
            SAY "   failed...too large, XDS'SIZE was " ENDSAY;          74152000
            SAYNUM (XDS'SIZE);                                          74153000
            SEND;                                                       74154000
            END;                                                        74155000
$IF                           <<Debugging code>>                        74156000
                                                                        74157000
               <<this error means that the system does                  74158000
                 not want to give us a data segment as                  74159000
                 large as we asked for...so shrink the                  74160000
                 asking size down...                  >>                74161000
                                                                        74162000
         NUM'IO:=NUM'IO-1;                                              74163000
         XDS'SIZE:=NUM'IO*TAPE'RECSIZE + XDS'OVERHEAD;                  74164000
                                                                        74165000
               <<we should have no buffers at this point,               74166000
                 but we release them anyway...>>                        74167000
                                                                        74168000
         RELEASE'BUFFERS;                                               74169000
                                                                        74170000
               <<see if NUM'IO is now too small...>>                    74171000
                                                                        74172000
         IF NUM'IO < 1 THEN                                             74173000
            BEGIN                                                       74174000
            SENDMESSAGE (SR'BUFFER'ALLOCATE'FAIL);                      74175000
            RETURN;     <<exit from routine>>                           74176000
            END;                                                        74177000
                                                                        74178000
               <<"restart" loop by setting CUR'INX to -1...>>           74179000
                                                                        74180000
         CUR'INX:=-1;                                                   74181000
         END                                                            74182000
      ELSE IF CUR'XDS = 0 THEN                                          74183000
         BEGIN          <<unable to get XDS>>                           74184000
                                                                        74185000
$IF X1=ON THEN                <<Debugging code>>                        74186000
         IF DEBUGGING THEN                                              74187000
            BEGIN                                                       74188000
            SAY "   unable to get XDS for some reason" ENDSAY;          74189000
            SEND;                                                       74190000
            END;                                                        74191000
$IF                           <<Debugging code>>                        74192000
         RELEASE'BUFFERS;                                               74193000
         SENDMESSAGE (SR'BUFFER'ALLOCATE'FAIL);                         74194000
         RETURN;        <<exit from routine>>                           74195000
         END                                                            74196000
      ELSE                                                              74197000
         BEGIN          <<got the XDS!>>                                74198000
                                                                        74199000
$IF X1=ON THEN                <<Debugging code>>                        74200000
         IF DEBUGGING THEN                                              74201000
            BEGIN                                                       74202000
            SAY "   got XDS, # = " ENDSAY;                              74203000
            SAYNUM (CUR'XDS);                                           74204000
            SEND;                                                       74205000
            END;                                                        74206000
$IF                           <<Debugging code>>                        74207000
         XDS'STATUS(CUR'INX):=bufstat'ALLOCATED;                        74208000
         XDS'NUM (CUR'INX) := CUR'XDS;                                  74209000
         I := -TAPE'RECSIZE;                                            74210000
         WHILE (I := I+TAPE'RECSIZE) < (XDS'SIZE - XDS'OVERHEAD) DO     74211000
            BEGIN                                                       74212000
            BUFFER'XDS(BUF'INX) := CUR'XDS;                             74213000
            BUFFER'OFFSET(BUF'INX) := I;                                74214000
            BUF'INX := BUF'INX+1;                                       74215000
            END;                                                        74216000
         END;                                                           74217000
      END;                                                              74218000
                                                                        74219000
$IF X1=ON THEN                <<Debugging code>>                        74220000
   IF DEBUGGING THEN                                                    74221000
      BEGIN                                                             74222000
      SAY "XDS Buffers allocated" ENDSAY;                               74223000
      SEND;                                                             74224000
      END;                                                              74225000
$IF                           <<Debugging code>>                        74226000
                                                                        74227000
         <<all NUM'XDS     XDS are allocated.>>                         74228000
         <<now lock and freeze them...>>                                74229000
                                                                        74230000
   CUR'INX:=-1;                                                         74231000
   WHILE (CUR'INX:=CUR'INX+1) < NUM'XDS     DO                          74232000
      BEGIN                                                             74233000
                                                                        74234000
$IF X1=ON THEN                <<Debugging code>>                        74235000
      IF DEBUGGING THEN                                                 74236000
         BEGIN                                                          74237000
         SAY "   lock&freeze buffer # " ENDSAY;                         74238000
         SAYNUM (CUR'INX);                                              74239000
         SEND;                                                          74240000
         END;                                                           74241000
$IF                           <<Debugging code>>                        74242000
                                                                        74243000
      LOCKSEG (XDS'NUM(CUR'INX), 1, 0);                                 74244000
      IF < THEN                                                         74245000
         BEGIN             <<error locking buffer>>                     74246000
         RELEASE'BUFFERS;                                               74247000
         SENDMESSAGE (SR'BUFFER'LOCK'FAIL);                             74248000
         RETURN;           <<exit from routine>>                        74249000
         END;                                                           74250000
      XDS'STATUS(CUR'INX):=bufstat'LOCKED;                              74251000
                                                                        74252000
      FREEZE (XDS'NUM(CUR'INX), 1, 0);                                  74253000
      IF < THEN                                                         74254000
         BEGIN             <<error freezing buffer>>                    74255000
         RELEASE'BUFFERS;                                               74256000
         SENDMESSAGE (SR'BUFFER'FREEZE'FAIL);                           74257000
         RETURN;           <<exit from routine>>                        74258000
         END;                                                           74259000
      XDS'STATUS(CUR'INX):=bufstat'FROZEN;                              74260000
                                                                        74261000
      END;                                                              74262000
                                                                        74263000
   ALLOCATE'BUFFERS:=GOOD;                                              74264000
                                                                        74265000
   NUM'BUFFERS := BUF'INX;                                              74266000
   CURR'READ'BUFFER  := 0;                                              74267000
   CURR'WAIT'BUFFER  := NUM'BUFFERS - 1;                                74268000
   CUR'INX:=0;                                                          74269000
   CUR'XDS:=BUFFER'XDS(0);                                              74270000
                                                                        74271000
                                                                        74272000
$IF X1=ON THEN                <<Debugging code>>                        74273000
   IF DEBUGGING THEN                                                    74274000
      BEGIN                                                             74275000
      SAY "   # of sectors per XDS = " ENDSAY;                          74276000
      SEND;                                                             74277000
      END;                                                              74278000
$IF                           <<Debugging code>>                        74279000
                                                                        74280000
END <<ALLOCATE'BUFFERS SUB>>;                                           74281000
$PAGE "[RESTORE]  FRESTORE --- Error handling subroutines"              74282000
<<---------------------------------------->>                            74283000
<<  CLEANUP of FRESTORE                   >>                            74284000
<<---------------------------------------->>                            74285000
                                                                        74286000
SUBROUTINE CLEANUP;                                                     74287000
                                                                        74288000
      <<This routine does STATE-determined cleanup.>>                   74289000
                                                                        74290000
BEGIN                                                                   74291000
   IF USING'ATTIO THEN                                                  74292000
      BEGIN                                                             74293000
      WAIT'FOR'ALL'ATTIO;                                               74294000
      RELEASE'BUFFERS;                                                  74295000
      END;                                                              74296000
                                                                        74297000
   RES'ACCT' := " ";                                                    74298000
   LOCK'DIRECTORY;                                                      74299000
                                                                        74300000
   IF SM'TOG THEN CHANGE'JIT'ACCT(JITDST,LOGON'ACCT);                   74301000
                                                                        74302000
   IF MOUNTED'VS THEN                                                   74303000
      DISMOUNT'VOLUME'SET (LAST'GROUP', LAST'ACCT', PV'INFO);           74304000
                                                                        74305000
END <<CLEANUP SUB>>;                                                    74306000
$PAGE                                                                   74307000
<<---------------------------------------->>                            74308000
<<  FAIL of FRESTORE                      >>                            74309000
<<---------------------------------------->>                            74310000
                                                                        74311000
SUBROUTINE FAIL (ERRNUM);                                               74312000
         VALUE   ERRNUM;                                                74313000
         INTEGER ERRNUM;                                                74314000
BEGIN                                                                   74315000
                                                                        74316000
   FRESTORE:=FAILED;                                                    74317000
                                                                        74318000
   IF ERRNUM <> 0 THEN                                                  74319000
      SENDMESSAGE (ERRNUM);                                             74320000
                                                                        74321000
        <<clear up remaining files - Tag them as >>                     74322000
        <<   NOT RESTORED: PREVIOUS CATASTROPHIC ERROR >>               74323000
                                                                        74324000
   FREAD (G'NUM, GBUF, G'RECSIZE);                                      74325000
                                                                        74326000
   BREAK'SENSED := FALSE;                                               74327000
                                                                        74328000
   WHILE = DO                                                           74329000
      BEGIN                                                             74330000
      IF REQUESTSERVICE THEN                                            74331000
         BREAK'SENSED := TRUE;                                          74332000
                                                                        74333000
      IF NOT BREAK'SENSED THEN                                          74334000
         DISPLAY'3'TO'STANDARD (                                        74335000
            GBUF' (G'FILE'INX'),                                        74336000
            GBUF' (G'GROUP'INX'),                                       74337000
            GBUF' (G'ACCT'INX'),                                        74338000
            CURR'TITLE',                                                74339000
            ERROR'CODE  );                                              74340000
                                                                        74341000
      FAILED'FILE'COUNT := FAILED'FILE'COUNT + 1D;                      74342000
                                                                        74343000
      IF NOT BREAK'SENSED THEN SENDMESSAGE (M'PREV'CATASTROPHIC);       74344000
      FREAD (G'NUM, GBUF, G'RECSIZE);                                   74345000
      END;                                                              74346000
                                                                        74347000
   GO END'FRESTORE;                                                     74348000
                                                                        74349000
END <<FAIL SUB>>;                                                       74350000
                                                                        74351000
<<---------------------------------------->>                            74352000
<<  FILE'FAIL of FRESTORE                 >>                            74353000
<<---------------------------------------->>                            74354000
                                                                        74355000
SUBROUTINE FILE'FAIL (FID, ERRNUM);                                     74356000
         VALUE        FID, ERRNUM;                                      74357000
         INTEGER      FID, ERRNUM;                                      74358000
BEGIN                                                                   74359000
                                                                        74360000
   IF FID <> NO'FILE THEN                                               74361000
      PRINT'FILE'ERROR (FID);                                           74362000
                                                                        74363000
   FAIL (ERRNUM);                                                       74364000
                                                                        74365000
   END <<FILE'FAIL SUB>>;                                               74366000
$PAGE "SYNCHRONIZE'GOOD'FILE'WITH'TAPE"                                 74367000
<<---------------------------------->>                                  74368000
<< SYNCHRONIZE'GOOD'FILE'WITH'TAPE  >>                                  74369000
<<---------------------------------->>                                  74370000
                                                                        74371000
LOGICAL SUBROUTINE SYNCHRONIZE'GOOD'FILE'WITH'TAPE;                     74372000
                                                                        74373000
   ! This procedure is used to synchronize the good file with the       74374000
   ! tape.  When this procedure is called the last read from the        74375000
   ! tape was a tapemark.  The first thing that this procedure does     74376000
   ! is to read the tape to get a valid file label into the tape        74377000
   ! buffer.  Then using the DIREC file and the procedure               74378000
   ! FIND'CURR'FILENO to find which file on the tape that file          74379000
   ! label corresponds with.  A record is read from the GOOD            74380000
   ! file.  If this file occurred earlier in the tape set then the      74381000
   ! file was lost during synchronization and a corresponding message   74382000
   ! will be displayed on SYSLIST and another record will be read from  74383000
   ! the GOOD file.  Records are read from the GOOD file until a        74384000
   ! file is found that is later in the tapeset than our current        74385000
   ! position in the tapeset.                                           74386000
                                                                        74387000
                                                                        74388000
BEGIN                                                                   74389000
$IF X1=ON THEN                                                          74390000
   IF DEBUGGING THEN                                                    74391000
      BEGIN                                                             74392000
      SAY "ENTERING SYNCHRONIZE'GOOD'FILE - CURR'FILENO=" ENDSAY;       74393000
      SAYDNUM(CURR'FILENO);                                             74394000
      SEND;                                                             74395000
      END;                                                              74396000
$IF                                                                     74397000
   READ'GOOD'FILE;                                                      74398000
   IF > THEN                                                            74399000
      BEGIN                                                             74400000
      SYNCHRONIZE'GOOD'FILE'WITH'TAPE := FAILED;                        74401000
      RETURN;                                                           74402000
      END;                                                              74403000
                                                                        74404000
   IF DISPLAY'3'TO'STANDARD (                                           74405000
            GBUF'(G'FILE'INX'),                                         74406000
            GBUF'(G'GROUP'INX'),                                        74407000
            GBUF'(G'ACCT'INX'),                                         74408000
            CURR'TITLE',                                                74409000
            ERROR'CODE  )                                               74410000
         = FAILED THEN                                                  74411000
      FAIL (SR'D'2'S'FAILED);     <<D'3'to'S failed>>                   74412000
                                                                        74413000
   DO                                                                   74414000
      IF READ'TAPE (TDBUF, GBUF) = FAILED THEN FAIL (0)                 74415000
   UNTIL END'OF'TAPE'SET OR NOT LAST'READ'WAS'EOF;                      74416000
                                                                        74417000
   MOVE'FROM'TAPE'BUFF'TO'FLAB;                                         74418000
   MOVE TDBUF := FLAB, (3*FILE'PART'WORDS);                             74419000
                                                                        74420000
   SYNCHRONIZE'GOOD'FILE'WITH'TAPE := GOOD;                             74421000
                                                                        74422000
   CURR'FILENO := FIND'CURR'FILENO (TDBUF, CURR'FILENO, ERROR'CODE);    74423000
   IF CURR'FILENO < 0D THEN CURR'FILENO  := - (CURR'FILENO) - 1D;       74424000
                                                                        74425000
   IF ERROR'CODE <> 0 THEN FILE'FAIL (D'NUM, RS'D'FILE'ERROR);          74426000
                                                                        74427000
$IF X1=ON THEN                                                          74428000
   IF DEBUGGING THEN                                                    74429000
      BEGIN                                                             74430000
         SAY "   CURR'FILENO IS NOW " ENDSAY;                           74431000
         SAYDNUM(CURR'FILENO);                                          74432000
         SAY " - GBUF FILENO IS " ENDSAY;                               74433000
         SAYDNUM(GBUF'D(G'FILENUM'INX'D));                              74434000
         SEND;                                                          74435000
      END;                                                              74436000
$IF                                                                     74437000
                                                                        74438000
   WHILE GBUF'D(G'FILENUM'INX'D) < CURR'FILENO DO                       74439000
      BEGIN                                                             74440000
                                                                        74441000
      FAILED'FILE'COUNT := FAILED'FILE'COUNT + 1D;                      74442000
                                                                        74443000
      SENDMESSAGE (M'SYNCHRONIZING);                                    74444000
                                                                        74445000
      READ'GOOD'FILE;                                                   74446000
      IF > THEN                                                         74447000
         BEGIN                                                          74448000
         SYNCHRONIZE'GOOD'FILE'WITH'TAPE := FAILED;                     74449000
         RETURN;                                                        74450000
         END;                                                           74451000
                                                                        74452000
      IF DISPLAY'3'TO'STANDARD (                                        74453000
               GBUF'(G'FILE'INX'),                                      74454000
               GBUF'(G'GROUP'INX'),                                     74455000
               GBUF'(G'ACCT'INX'),                                      74456000
               CURR'TITLE',                                             74457000
               ERROR'CODE  )                                            74458000
            = FAILED THEN                                               74459000
         FAIL (SR'D'2'S'FAILED);     <<D'3'to'S failed>>                74460000
                                                                        74461000
      END;                                                              74462000
                                                                        74463000
$IF X1=ON THEN                                                          74464000
   IF DEBUGGING THEN                                                    74465000
      BEGIN                                                             74466000
      SAY "TAPE'SYNCHRONIZED" ENDSAY;                                   74467000
      SEND;                                                             74468000
      END;                                                              74469000
$IF                                                                     74470000
END <<SYNCHRONIZE'GOOD'FILE'WITH'TAPE>>;                                74471000
!CONTROL NOLIST               !LIST                                     74472000
$PAGE                                                                   74473000
<<---------------------------------------->>                            74474000
<<  GET'GOOD'RECORD of FRESTORE           >>                            74475000
<<---------------------------------------->>                            74476000
                                                                        74477000
LOGICAL SUBROUTINE GET'GOOD'RECORD;                                     74478000
                                                                        74479000
   ! This procedure gets the next valid record in the GOOD file.  Most  74480000
   ! of the work is done by SYNCHRONIZE'GOOD'FILE'WITH'TAPE.  After     74481000
   ! a valid record is found, the file title is converted to standard   74482000
   ! form and placed into CURR'TITLE'                                   74483000
                                                                        74484000
BEGIN                                                                   74485000
                                                                        74486000
$IF X1=ON THEN                <<Debugging code>>                        74487000
   IF DEBUGGING THEN                                                    74488000
      BEGIN                                                             74489000
      SAY "   GET'GOOD'RECORD" ENDSAY;                                  74490000
      SEND;                                                             74491000
      END;                                                              74492000
$IF                           <<Debugging code>>                        74493000
                                                                        74494000
                                                                        74495000
   IF SYNCHRONIZE'GOOD'FILE'WITH'TAPE = FAILED THEN                     74496000
      BEGIN                                                             74497000
      GET'GOOD'RECORD := FAILED;                                        74498000
      RETURN;                                                           74499000
      END;                                                              74500000
                                                                        74501000
$IF X1=ON THEN                <<Debugging code>>                        74502000
   IF DEBUGGING THEN                                                    74503000
      BEGIN                                                             74504000
      SAY "      read: " ENDSAY;                                        74505000
      SAY GBUF'(G'TITLE'INX'),(24) ENDSAY;                              74506000
      SEND;                                                             74507000
      END;                                                              74508000
$IF                           <<Debugging code>>                        74509000
                                                                        74510000
   IF DISPLAY'3'TO'STANDARD (                                           74511000
            GBUF'(G'FILE'INX'),                                         74512000
            GBUF'(G'GROUP'INX'),                                        74513000
            GBUF'(G'ACCT'INX'),                                         74514000
            CURR'TITLE',                                                74515000
            ERROR'CODE  )                                               74516000
         = FAILED THEN                                                  74517000
      FAIL (SR'D'2'S'FAILED);     <<D'3'to'S failed>>                   74518000
                                                                        74519000
$IF X1=ON THEN                <<Debugging code>>                        74520000
   IF DEBUGGING THEN                                                    74521000
      BEGIN                                                             74522000
      SAY "GET'GOOD'RECORD --> " ENDSAY;                                74523000
      SAY'STANDARD (CURR'TITLE');                                       74524000
      SEND;                                                             74525000
      END;                                                              74526000
$IF                           <<Debugging code>>                        74527000
                                                                        74528000
   GET'GOOD'RECORD:=GOOD;                                               74529000
                                                                        74530000
END <<GET'GOOD'RECORD SUB>>;                                            74531000
$PAGE                                                                   74532000
<<---------------------------------------->>                            74533000
<<  INITIALIZE'FRESTORE of FRESTORE       >>                            74534000
<<---------------------------------------->>                            74535000
                                                                        74536000
SUBROUTINE INITIALIZE'FRESTORE;                                         74537000
                                                                        74538000
   ! This procedure does the initialization for FRESTORE                74539000
                                                                        74540000
BEGIN                                                                   74541000
                                                                        74542000
$IF X1=ON THEN                <<Debugging code>>                        74543000
   IF DEBUGGING THEN                                                    74544000
      BEGIN                                                             74545000
      SAY "START OF FRESTORE" ENDSAY;                                   74546000
      SEND;                                                             74547000
      END;                                                              74548000
$IF                           <<Debugging code>>                        74549000
                                                                        74550000
   FRESTORE:=FAILED;                                                    74551000
                                                                        74552000
   STATE:=INITIALIZING'state;                                           74553000
                                                                        74554000
   NEW'FLAB(128):="  ";                <<FOR GETDEVINFO>>               74555000
                                                                        74556000
   REWIND'GOOD'FILE;                                                    74557000
                                                                        74558000
   @TDBUF':=@TDBUF & LSL(1);       <<byte address of TDBUF>>            74559000
                                                                        74560000
   JITDST:=GET'JITDST;             <<get the DST of the JIT>>           74561000
                                                                        74562000
   CURR'FILENO       := 0D;                                             74563000
                                                                        74564000
   FAILED'FILE'COUNT := 0D;                                             74565000
   GOOD'FILE'COUNT   := 0D;                                             74566000
                                                                        74567000
   MOVE LAST'ACCT'   := RES'ACCT',  (FILE'PART'SIZE);                   74568000
   MOVE LAST'GROUP'  := RES'GROUP', (FILE'PART'SIZE);                   74569000
                                                                        74570000
   LAST'READ'WAS'EOF := FALSE;                                          74571000
                                                                        74572000
   NUM'BUFFERS := 0;                                                    74573000
                                                                        74574000
   IF SHOW'FLAG THEN               << Print out the SHOW heading >>     74575000
      BEGIN                                                             74576000
      SENDMESSAGE (M'BLANK'LINE);                                       74577000
      SENDMESSAGE (M'HEADING);                                          74578000
      SENDMESSAGE (M'BLANK'LINE);                                       74579000
      END;                                                              74580000
                                                                        74581000
                                                                        74582000
$IF X1=ON THEN                <<Debugging code>>                        74583000
   IF DEBUGGING THEN                                                    74584000
      BEGIN                                                             74585000
      SAY " end initializing FRESTORE" ENDSAY;                          74586000
      SEND;                                                             74587000
      END;                                                              74588000
$IF                           <<Debugging code>>                        74589000
                                                                        74590000
END <<INITIALIZE'FRESTORE SUB>>;                                        74591000
$PAGE                                                                   74592000
<<---------------------------------------->>                            74593000
<<  LOCATE'GOOD'TAPE'FILE of FRESTORE     >>                            74594000
<<---------------------------------------->>                            74595000
                                                                        74596000
SUBROUTINE LOCATE'GOOD'TAPE'FILE;                                       74597000
                                                                        74598000
      <<This routine scans forward on the tape looking                  74599000
        for the file specified by the record just read                  74600000
        from the GOOD file.  If the file is                             74601000
        not found on the tape, we judge the tape to be                  74602000
        in error and terminate with an error message,                   74603000
        otherwise the tape is left positioned at the                    74604000
        second record of the file and TDBUF has the contents            74605000
        of the first record in it.>>                                    74606000
                                                                        74607000
BEGIN                                                                   74608000
                                                                        74609000
$IF X1=ON THEN                <<Debugging code>>                        74610000
   IF DEBUGGING THEN                                                    74611000
      BEGIN                                                             74612000
      SAY "LOCATE'GOOD'TAPE'FILE started" ENDSAY;                       74613000
      SEND;                                                             74614000
      END;                                                              74615000
$IF                           <<Debugging code>>                        74616000
                                                                        74617000
                                                                        74618000
   CHECK'BREAK;         <<wont return if break sensed>>                 74619000
                                                                        74620000
   WHILE (GBUF'(G'TITLE'INX') <> TDBUF', (3 * FILE'PART'SIZE)) DO       74621000
      BEGIN                            <<we found it!>>                 74622000
                                                                        74623000
      IF SKIP'AND'READ'TAPE (TDBUF, 0, GBUF) = FAILED THEN              74624000
         FAIL (0);                                                      74625000
                                                                        74626000
      MOVE'FROM'TAPE'BUFF'TO'FLAB;                                      74627000
      MOVE TDBUF := FLAB, (3*FILE'PART'WORDS);                          74628000
      CHECK'BREAK;                                                      74629000
                                                                        74630000
      END;                                                              74631000
                                                                        74632000
   CURR'FILENO := GBUF'D (G'FILENUM'INX'D);                             74633000
                                                                        74634000
END <<LOCATE'GOOD'TAPE'FILE SUB>>;                                      74635000
$PAGE "[RESTORE]  FRESTORE --- Outer Block"                             74636000
<<************************************************************>>        74637000
<<                OUTER BLOCK OF FRESTORE                     >>        74638000
<<************************************************************>>        74639000
                                                                        74640000
   INITIALIZE'FRESTORE;                                                 74641000
   IF USING'ATTIO THEN        ! Initialize tape buffers, start tape     74642000
      BEGIN                                                             74643000
      IF ALLOCATE'BUFFERS = FAILED THEN                                 74644000
         FAIL (RS'UNABLE'TO'ALLOCATE'BUFFERS);                          74645000
      START'A'READ (TAPE'RECSIZE);                                      74646000
      END;                                                              74647000
                                                                        74648000
   WHILE GET'GOOD'RECORD = GOOD DO                                      74649000
      BEGIN                                                             74650000
                                                                        74651000
      EOF'READ := FALSE;                                                74652000
                                                                        74653000
      LOCATE'GOOD'TAPE'FILE;                                            74654000
                                                                        74655000
      IF RESTORE'A'FILE (TDBUF, GBUF, JITDST)=FAILED                    74656000
         THEN  FAIL(0);                                                 74657000
                                                                        74658000
      ! Make sure that we are at a tapemark                             74659000
                                                                        74660000
      IF NOT USING'ATTIO AND NOT EOF'READ THEN                          74661000
         ISSUE'SKIP (FALSE)                                             74662000
      ELSE IF USING'ATTIO AND NOT EOF'READ THEN                         74663000
         BEGIN                                                          74664000
         PARMS'TEMPI'1 := LOOK'FOR'EOF (GBUF, TRUE);                    74665000
         IF PARMS'TEMPI'1 = -1 THEN                                     74666000
            FAIL (RS'LOOK'FOR'EOF)                                      74667000
         ELSE IF PARMS'TEMPI'1 <> ATTIO'EOF THEN                        74668000
            BEGIN                                                       74669000
            START'A'SKIP;                                               74670000
            START'A'READ (TAPE'RECSIZE);                                74671000
            ISSUE'SKIP (FALSE);                                         74672000
            END                                                         74673000
         ELSE IF OUTSTANDING'IOS = 0 THEN                               74674000
            START'A'READ (TAPE'RECSIZE);                                74675000
         END;                                                           74676000
                                                                        74677000
      END;                                                              74678000
                                                                        74679000
   FRESTORE:=GOOD;                                                      74680000
                                                                        74681000
END'FRESTORE:                                                           74682000
                                                                        74683000
   CLEANUP;                                                             74684000
                                                                        74685000
                                                                        74686000
   END <<FRESTORE PROC>>;                                               74687000
$PAGE "[RESTORE]  RESTORE'A'FILE --- RESTOREs a single file"            74688000
$CONTROL SEGMENT=RESTORE                                                74689000
<<---------------------------------------->>                            74690000
<<  RESTORE'A'FILE                        >>                            74691000
<<---------------------------------------->>                            74692000
                                                                        74693000
LOGICAL PROCEDURE RESTORE'A'FILE (TDBUF, GBUF,                          74694000
                                  JITDST                          );    74695000
   VALUE JITDST;                                                        74696000
   INTEGER ARRAY TDBUF, GBUF;                                           74697000
   INTEGER JITDST;                                                      74698000
   OPTION PRIVILEGED, UNCALLABLE;                                       74699000
                                                                        74700000
   ! This procedure restores a file.                                    74701000
                                                                        74702000
BEGIN                                                                   74703000
                                                                        74704000
   DEFINE                                                               74705000
      A'ANY'SEC          = %005251                    #,                74706000
      G'ANY'SEC          = %04102041020D              #;                74707000
                                                                        74708000
   DOUBLE POINTER                                                       74709000
      FL'EXTMAPD    := @FLEXTMAP'D,               ! EXT MAP ARRAY (DBL) 74710000
      OLD'EXTMAP'D  := @OLD'EXTMAPD;              ! OLD EXT MAP         74711000
                                                                        74712000
   INTEGER ARRAY                                                        74713000
      SCAN'PARMS (0:1);                                                 74714000
                                                                        74715000
   BYTE ARRAY                                                           74716000
      LOCKWORD'QUEST   (0:72),                   ! LOCKWORD QUESTION    74716100
      TITLE'           (0:26);                   ! FILE TITLE           74717000
                                                                        74718000
   DOUBLE ARRAY                                                         74719000
      EXTENT'SIZES  (0:MAX'NUM'EXTENTS-1),       ! SIZE OF EXTENTS      74720000
      OLD'DISJ'ADDR (0:MAX'NUM'EXTENTS-1),       ! ADDRESSES OF DISJ EXT74721000
      OLD'DISJ'LEN  (0:MAX'NUM'EXTENTS-1),       ! LENGTHS OF DISJ EXT  74722000
      SCAN'PARMS'D (*) = SCAN'PARMS;                                    74723000
                                                                        74724000
                                                                        74725000
   DOUBLE                                                               74726000
      DR,                                        ! RETURN FROM DIR FUNCS74727000
      FADDR,                                     ! FILE ADDRESS HOLDER  74728000
      RELEASE'ADDR;                              ! RELEASE ADDRESS      74729000
                                                                        74730000
   INTEGER                                                              74731000
      FADDR'1              = FADDR,                                     74732000
      I,                                         ! COUNTER              74733000
      LEN,                                       ! LENGTH OF LOCKWORD'QU74733100
      OLD'DISJ'EXTS,                             ! NUM OF DISJ EXTS     74734000
      RELEASE'LDEV,                              ! RELEASE LDEV         74735000
      REQ'TYPE,                                  ! REQUISITION TYPE FOR 74736000
                                                 !    MOUNT/DISMOUNT    74737000
      SUB'CODE,                                  ! ERROR CODE           74738000
      TITLE'LEN,                                 ! LENGTH OF TITLE      74739000
      TYPE                 := 0;                 ! TYPE for DIRECSCAN   74740000
                                                                        74741000
   BYTE                                                                 74742000
      RELEASE'ADDR'B1    = RELEASE'ADDR;         ! RELEASE LDEV         74743000
                                                                        74744000
   LOGICAL                                                              74745000
      DIRECTORY'SWITCHED            := FALSE,                           74746000
      DISC'SPACE'ALLOCATED          := FALSE,                           74747000
      FILE'INSERTED'INTO'DIRECTORY  := FALSE,                           74748000
      OLD'FILE'HIDDEN               := FALSE;                           74749000
                                                                        74750000
   LABEL                                                                74751000
      END'RESTORE'A'FILE;                                               74752000
$PAGE "CLEANUP of RESTORE'A'FILE"                                       74753000
<<---------------------------------------->>                            74754000
<<  CLEANUP of RESTORE'A'FILE             >>                            74755000
<<---------------------------------------->>                            74756000
                                                                        74757000
SUBROUTINE CLEANUP;                                                     74758000
                                                                        74759000
   ! This procedure does cleanup based on various flags.                74760000
                                                                        74761000
BEGIN                                                                   74762000
   GET'SIRS (TRUE, TRUE);                                               74763000
   DISABLE'ARITHMETIC'TRAPS;                                            74764000
                                                                        74765000
   IF OLD'COPY'EXISTS THEN                                              74766000
      BEGIN                                                             74767000
                                                                        74768000
      IF DIRECTORY'SWITCHED THEN          ! Switch it back              74769000
         BEGIN                                                          74770000
         SCAN'PARMS'D := OLD'ADDRESS;                                   74771000
         SCAN'PARMS . (08:08) := OLD'VTAB;                              74772000
         TYPE := 2;   << Start at file level - go to file level>>       74773000
         DR := DIRECSCAN (TYPE, FILE'INDEX'PTR, RES'ACCT,               74774000
                          RES'GROUP, RES'FILE, ADJUST'FPTR, SCAN'PARMS, 74775000
                          PVMVTABX);                                    74776000
         IF <> THEN SENDMESSAGE (DIRECTORY'ERROR (DR));                 74777000
         END;                                                           74778000
                                                                        74779000
      IF OLD'FILE'HIDDEN THEN             ! Unlock the file and make    74780000
         BEGIN                            ! disc space adjustments      74781000
         DR := DIRECADJUST (OLD'SECTORS - FILE'MAX'SECTORS,             74782000
            PARMS'TEMPI'1, RES'ACCT, RES'GROUP, PVMVTABX);              74783000
         IF <> THEN SENDMESSAGE (DIRECTORY'ERROR (DR));                 74784000
         OLD'FLSTORERESTORE := NO'LOCKv;                                74785000
         LABELIO (OLD'FLAB, OLD'LDEV, OLD'ADDRESS, ATTIO'WRITE,         74786000
                  RES'TITLE);                                           74787000
         END;                                                           74788000
                                                                        74789000
      END                                                               74790000
                                                                        74791000
   ELSE                                                                 74792000
      BEGIN                                                             74793000
      IF FILE'INSERTED'INTO'DIRECTORY THEN  ! Purge it                  74794000
         BEGIN                                                          74795000
         DR := DIRECPURGEFILE (FILE'SECTORS, PARMS'TEMPI'1,             74796000
            RES'ACCT, RES'GROUP, RES'FILE, PVMVTABX);                   74797000
                                                                        74798000
         IF <> THEN SENDMESSAGE (DIRECTORY'ERROR (DR));                 74799000
         END;                                                           74800000
      END;                                                              74801000
                                                                        74802000
   IF DISC'SPACE'ALLOCATED THEN             ! Deallocate it             74803000
      DISKDEALLOC (FLEXTSIZE'L, FLLASTEXTSIZE,                          74804000
                   FLNUMEXTS+1, FLEXTMAP'D);                            74805000
                                                                        74806000
   ENABLE'ARITHMETIC'TRAPS;                                             74807000
   RELEASE'SIRS (TRUE, TRUE);                                           74808000
                                                                        74809000
END <<CLEANUP OF RESTORE'A'FILE>>;                                      74810000
$PAGE "FAIL of RESTORE'A'FILE"                                          74811000
<<---------------------------------------->>                            74812000
<<  FAIL of RESTORE'A'FILE                >>                            74813000
<<---------------------------------------->>                            74814000
                                                                        74815000
SUBROUTINE FAIL (ERRNUM);                                               74816000
         VALUE   ERRNUM;                                                74817000
         INTEGER ERRNUM;                                                74818000
BEGIN                                                                   74819000
                                                                        74820000
   IF ERRNUM > 0 THEN                                                   74821000
      SENDMESSAGE (ERRNUM);                                             74822000
                                                                        74823000
        <<do state-determined cleanup...>>                              74824000
                                                                        74825000
   CLEANUP;                           <<clean up everything>>           74826000
                                                                        74827000
   FAILED'FILE'COUNT := FAILED'FILE'COUNT + 1D;                         74828000
                                                                        74829000
   IF KILL'RESTORE THEN RESTORE'A'FILE := FAILED                        74830000
   ELSE RESTORE'A'FILE := GOOD;                                         74831000
                                                                        74832000
   GO END'RESTORE'A'FILE;                                               74833000
END <<FAIL OF RESTORE'A'FILE>>;                                         74834000
$PAGE "EVAL'RETURN of RESTORE'A'FILE"                                   74835000
<<---------------------------------------->>                            74836000
<<  EVAL'RETURN of RESTORE'A'FILE         >>                            74837000
<<---------------------------------------->>                            74838000
                                                                        74839000
SUBROUTINE EVAL'RETURN(RETVAL);                                         74840000
   VALUE RETVAL;                                                        74841000
   INTEGER RETVAL;                                                      74842000
BEGIN                                                                   74843000
   IF RETVAL <> 0 THEN FAIL(RETVAL);                                    74844000
END <<EVAL'RETURN OF RESTORE'A'FILE>>;                                  74845000
$PAGE "FILE'FAIL of RESTORE'A'FILE"                                     74846000
<<---------------------------------------->>                            74847000
<<  FILE'FAIL of RESTORE'A'FILE           >>                            74848000
<<---------------------------------------->>                            74849000
                                                                        74850000
SUBROUTINE FILE'FAIL (FID, ERRNUM);                                     74851000
         VALUE        FID, ERRNUM;                                      74852000
         INTEGER      FID, ERRNUM;                                      74853000
BEGIN                                                                   74854000
                                                                        74855000
   IF FID <> NO'FILE THEN                                               74856000
      PRINT'FILE'ERROR (FID);                                           74857000
                                                                        74858000
   FAIL (ERRNUM);                                                       74859000
                                                                        74860000
END <<FILE'FAIL OF RESTORE'A'FILE>>;                                    74861000
$PAGE "ASSERT'LOCKWORD of RESTORE'A'FILE"                               74862000
<<---------------------------------------->>                            74863000
<<  ASSERT'LOCKWORD of RESTORE'A'FILE     >>                            74864000
<<---------------------------------------->>                            74865000
                                                                        74866000
SUBROUTINE ASSERT'LOCKWORD;                                             74867000
                                                                        74868000
   ! This routine checks the lockword and makes sure that it matches or 74869000
   ! the user has SM, OP, or AM capabilities.                           74870000
                                                                        74871000
BEGIN                                                                   74872000
   IF SM'TOG OR CAP'AM THEN                                             74873000
   ELSE IF FLLOCKWORD' <> LOOK'LOCK',(FILE'PART'SIZE) THEN              74874000
      IF LOOK'LOCK' = BLANKS'8   THEN                                   74875000
         BEGIN                                                          74876000
         SENDMESSAGE (RS'MESS'TAPE'LOCK,,,LOCKWORD'QUEST);              74877000
         SCAN LOCKWORD'QUEST UNTIL 0,1;                                 74877010
                                                                        74877011
         LEN := TOS - @LOCKWORD'QUEST;                                  74877020
         LOCKWORD'QUEST (LEN) := " ";                                   74877030
                                                                        74877031
         MOVE LOCKWORD'QUEST (LEN+1) := TITLE', (TITLE'LEN);            74877040
         LOCKWORD'QUEST (LEN+1+TITLE'LEN) := "?";                       74877050
                                                                        74877051
         LEN := LEN + 1 + TITLE'LEN + 1;                                74877060
                                                                        74877061
         IF FREPLY (LOCKWORD'QUEST, LEN) = FALSE THEN                   74877070
            FAIL (M'TAPE'BAD'LOCKWORD)                                  74877080
         ELSE IF LOCKWORD'QUEST <> FLLOCKWORD', (FILE'PART'SIZE) THEN   74877090
            FAIL (M'TAPE'BAD'LOCKWORD);                                 74877100
                                                                        74878000
         END                                                            74882000
      ELSE FAIL(M'TAPE'BAD'LOCKWORD);                                   74883000
END <<ASSERT'LOCKWORD OF RESTORE'A'FILE>>;                              74884000
$PAGE "ASSERT'READ'ACCESS of RESTORE'A'FILE"                            74885000
<<---------------------------------------->>                            74886000
<<  ASSERT'READ'ACCESS of RESTORE'A'FILE  >>                            74887000
<<---------------------------------------->>                            74888000
                                                                        74889000
SUBROUTINE ASSERT'READ'ACCESS;                                          74890000
                                                                        74891000
   ! This routine makes sure that the user has read access to the       74892000
   ! tape file.  The user needs either the STORE RELEASE bit to be      74893000
   ! TRUE or read access to the file.                                   74894000
                                                                        74895000
BEGIN                                                                   74896000
   IF NOT FL'SR'RELEASE AND                                             74897000
      NOT ACCCHECK (FILELEVEL, FLACCTNAME', A'ANY'SEC, FLGRPNAME',      74898000
                    G'ANY'SEC, FLUSERID', FLSECMX) . (READf) THEN       74899000
         FAIL (M'CANT'READ'TAPE'FILE);                                  74900000
                                                                        74901000
END <<ASSERT'READ'ACCESS OF RESTORE'A'FILE>>;                           74902000
$PAGE "ASSERT'FILECODES'OK of RESTORE'A'FILE"                           74903000
<<---------------------------------------->>                            74904000
<<  ASSERT'FILECODES'OK of RESTORE'A'FILE >>                            74905000
<<---------------------------------------->>                            74906000
                                                                        74907000
SUBROUTINE ASSERT'FILECODES'OK;                                         74908000
                                                                        74909000
   ! This routine checks to make sure that the file code of the         74910000
   ! file to RESTOREd is OK.  The filecode must fall between            74911000
   ! FILECODE'LOW and FILECODE'HIGH.  If the filecode is negative       74912000
   ! then the user must have SM or OP or PM capabilities or the         74913000
   ! global flag IGNORE'PRIV'CHECK'FLAG must be TRUE.                   74914000
                                                                        74915000
BEGIN                                                                   74916000
   IF (FILECODE'LOW > FLFILECODE) OR (FILECODE'HIGH < FLFILECODE) THEN  74917000
      FAIL(M'FILECODE'NOT'IN'RANGE);                                    74918000
                                                                        74919000
   IF (FLFILECODE < 0) AND NOT(SM'TOG) AND NOT(CAP'PM) AND              74920000
      NOT(IGNORE'PRIV'CHECK'FLAG) THEN                                  74921000
         FAIL(M'NEGATIVE'FILECODE);                                     74922000
                                                                        74923000
                                                                        74924000
$IF X1=ON THEN                <<Debugging code>>                        74925000
   IF DEBUGGING THEN                                                    74926000
      BEGIN                                                             74927000
      SAY "FILECODES OK" ENDSAY;                                        74928000
      SEND;                                                             74929000
      END;                                                              74930000
$IF                                                                     74931000
                                                                        74932000
END <<ASSERT'FILECODES'OK OF RESTORE'A'FILE>>;                          74933000
$PAGE "DERIVE'RES'CREATOR of RESTORE'A'FILE"                            74934000
<<---------------------------------------->>                            74935000
<<  DERIVE'RES'CREATOR of RESTORE'A'FILE  >>                            74936000
<<---------------------------------------->>                            74937000
                                                                        74938000
SUBROUTINE DERIVE'RES'CREATOR;                                          74939000
BEGIN                                                                   74940000
   IF CHECK'USER (RES'ACCT',RES'CREATOR',SUB'CODE) = FAILED   THEN      74941000
      IF RES'ACCT' = LOGON'ACCT',(FILE'PART'SIZE) THEN                  74942000
         BEGIN                                                          74943000
            MOVE RES'CREATOR' := LOGON'USER',(FILE'PART'SIZE);          74944000
            SENDMESSAGE (M'W'CREATOR'CHANGED);                          74945000
         END << RES'ACCT = LOGON'ACCT >>                                74946000
      ELSE                                                              74947000
         BEGIN                                                          74948000
         MOVE RES'CREATOR' := "RESTORE ";                               74949000
         SENDMESSAGE (M'W'CREATOR'CHANGED);                             74950000
         END; << ELSE - RES'ACCT = LOGON'ACCT >>                        74951000
                                                                        74952000
                                                                        74953000
$IF X1=ON THEN                <<Debugging code>>                        74954000
   IF DEBUGGING THEN                                                    74955000
      BEGIN                                                             74956000
      SAY "RES'CREATOR IS " ENDSAY;                                     74957000
      SAY RES'CREATOR',(FILE'PART'SIZE) ENDSAY;                         74958000
      SEND;                                                             74959000
      END;                                                              74960000
$IF                                                                     74961000
                                                                        74962000
END <<DERIVE'RES'CREATOR OF RESTORE'A'FILE>>;                           74963000
$PAGE "ASSERT'USER'EXISTENCE of RESTORE'A'FILE"                         74964000
<<------------------------------------------>>                          74965000
<<  ASSERT'USER'EXISTENCE of RESTORE'A'FILE >>                          74966000
<<------------------------------------------>>                          74967000
                                                                        74968000
SUBROUTINE ASSERT'USER'EXISTENCE;                                       74969000
BEGIN                                                                   74970000
   IF DONT'CHK'USER THEN RETURN;                                        74971000
   IF LAST'ACCT' = RES'ACCT', (FILE'PART'SIZE) LAND                     74972000
      LAST'USER' = RES'CREATOR', (FILE'PART'SIZE) THEN                  74973000
         MOVE RES'CREATOR' := LAST'RES'USER', (FILE'PART'SIZE)          74974000
   ELSE                                                                 74975000
      BEGIN                                                             74976000
      MOVE LAST'USER' := RES'CREATOR', (FILE'PART'SIZE);                74977000
                                                                        74978000
      IF (NOT SEEN'CREATOR) AND (NOT CREATE'USER'FLAG) THEN             74979000
         DERIVE'RES'CREATOR                                             74980000
      ELSE IF CHECK'USER (RES'ACCT',RES'CREATOR',SUB'CODE) = FAILED     74981000
         THEN                                                           74982000
            IF SUB'CODE = 2 THEN FAIL(M'NO'ACCT)                        74983000
            ELSE IF SUB'CODE = 3 THEN FAIL(M'NO'CREATOR)                74984000
            ELSE FAIL(M'ERROR'USER'VALIDATION);                         74985000
                                                                        74986000
      MOVE LAST'RES'USER' := RES'CREATOR', (FILE'PART'SIZE);            74987000
      END;                                                              74988000
                                                                        74989000
$IF X1=ON THEN                <<Debugging code>>                        74990000
   IF DEBUGGING THEN                                                    74991000
      BEGIN                                                             74992000
      SAY "CREATOR EXISTS" ENDSAY;                                      74993000
      SEND;                                                             74994000
      END;                                                              74995000
$IF                                                                     74996000
                                                                        74997000
END <<ASSERT'USER'EXISTENCE OF RESTORE'A'FILE>>;                        74998000
$PAGE "GET'SIZES of RESTORE'A'FILE"                                     74999000
<<---------------------------------------->>                            75000000
<<  GET'SIZES of RESTORE'A'FILE           >>                            75001000
<<---------------------------------------->>                            75002000
                                                                        75003000
SUBROUTINE GET'SIZES;                                                   75004000
BEGIN                                                                   75005000
   FILE'SECTORS := FIND'FILE'SIZE (FILE'SIZE'MINv, EXTENT'SIZES);       75006000
   FILE'MAX'SECTORS := FIND'FILE'SIZE (FILE'SIZE'MAXv, EXTENT'SIZES);   75007000
END <<GET'SIZES OF RESTORE'A'FILE>>;                                    75008000
$PAGE "ADJUST'FLAB of RESTORE'A'FILE"                                   75009000
<<---------------------------------------->>                            75010000
<<  ADJUST'FLAB of RESTORE'A'FILE         >>                            75011000
<<---------------------------------------->>                            75012000
                                                                        75013000
SUBROUTINE ADJUST'FLAB;                                                 75014000
                                                                        75015000
BEGIN                                                                   75016000
                                                                        75017000
$IF X1=ON THEN                <<Debugging code>>                        75018000
   IF DEBUGGING THEN                                                    75019000
      BEGIN                                                             75020000
      SAY "ENTERING ADJUST'FLAB" ENDSAY;                                75021000
      SEND;                                                             75022000
      END;                                                              75023000
$IF                                                                     75024000
                                                                        75025000
   MOVE FLLOCNAME' := RES'FILE', (FILE'PART'SIZE);                      75026000
   MOVE FLGRPNAME' := RES'GROUP',(FILE'PART'SIZE);                      75027000
   MOVE FLACCTNAME' := RES'ACCT',(FILE'PART'SIZE);                      75028000
   MOVE FLUSERID'   := RES'CREATOR', (FILE'PART'SIZE);                  75029000
                                                                        75030000
   FL'SR'RELEASE := 0;                                                  75031000
                                                                        75032000
   IF NOT OLDDATE'FLAG THEN                                             75033000
      BEGIN                                                             75034000
      FLLASTACC := TODAYS'DATE;                                         75035000
      FLLASTMOD := TODAYS'DATE;                                         75036000
      END;                                                              75037000
                                                                        75038000
   FLPVINFO := 0;                                                       75039000
   FLFCBVECT := 0D;                                                     75040000
                                                                        75041000
   IF OLD'COPY'EXISTS THEN FLSRLX := %(2)0000                           75042000
   ELSE FLSRLX := %(2)1100;                                             75043000
                                                                        75044000
   FLDEVTYPE := LDEVTOTYPE (FILE'LDEV);                                 75045000
   FLDEVSUBTYPE := LDEVTOSUBTYPE (FILE'LDEV);                           75046000
                                                                        75047000
   FLRW := 0;                                                           75048000
                                                                        75049000
   FLCLID := COLD'LOAD'ID;                                              75050000
                                                                        75051000
   LDEVTOVTAB (FLEXTMAP'D, FLEXTMAP'D, FLNUMEXTS+1, PVMVTABX<>0);       75052000
                                                                        75053000
   FLALLOCTIME := CLOCK;                                                75054000
   FLALLOCDATE'L := CALENDAR;                                           75055000
                                                                        75056000
   << FLDEVNAME HAS ALREADY BEEN CHANGED >> !HELP                       75057000
                                                                        75058000
$IF X1=ON THEN                <<Debugging code>>                        75059000
   IF DEBUGGING THEN                                                    75060000
      BEGIN                                                             75061000
      SAY "LEAVING ADJUST'FLAB" ENDSAY;                                 75062000
      SEND;                                                             75063000
      END;                                                              75064000
$IF                                                                     75065000
                                                                        75066000
                                                                        75067000
END <<ADJUST'FLAB OF RESTORE'A'FILE>>;                                  75068000
$PAGE "FINISHUP of RESTORE'A'FILE"                                      75069000
<<---------------------------------------->>                            75070000
<<  FINISHUP of RESTORE'A'FILE            >>                            75071000
<<---------------------------------------->>                            75072000
                                                                        75073000
SUBROUTINE FINISHUP;                                                    75074000
BEGIN                                                                   75075000
   IF NOT OLD'COPY'EXISTS THEN                                          75076000
      BEGIN                                                             75077000
      FLSTORERESTORE := 0;                                              75078000
      EVAL'RETURN (LABELIO (FLAB, FILE'LDEV, FILE'ADDRESS, ATTIO'WRITE, 75079000
                            RES'TITLE));                                75080000
      END;                                                              75081000
   GOOD'FILE'COUNT := GOOD'FILE'COUNT + 1D;                             75082000
   IF SHOW'FLAG THEN SENDMESSAGE (M'RESTORED);                          75083000
   IF SHOW'SECURITY'FLAG THEN                                           75084000
      SENDMESSAGE (M'SECURITY);                                         75085000
END <<FINISHUP OF RESTORE'A'FILE>>;                                     75086000
$PAGE "GET'TARGETS of RESTORE'A'FILE"                                   75087000
<<---------------------------------------->>                            75088000
<<  GET'TARGETS of RESTORE'A'FILE         >>                            75089000
<<---------------------------------------->>                            75090000
                                                                        75091000
SUBROUTINE GET'TARGETS;                                                 75092000
BEGIN                                                                   75093000
   MOVE RES'FILE' := FLLOCNAME', (FILE'PART'SIZE);                      75094000
                                                                        75095000
   IF LOCAL'FLAG OR SEEN'ACCT THEN                                      75096000
   ELSE MOVE RES'ACCT' := FLACCTNAME', (FILE'PART'SIZE);                75097000
                                                                        75098000
   IF LOCAL'FLAG OR SEEN'GROUP THEN                                     75099000
   ELSE MOVE RES'GROUP' := FLGRPNAME', (FILE'PART'SIZE);                75100000
                                                                        75101000
   IF BLANK'CREATOR THEN                                                75102000
      MOVE RES'CREATOR' := FLUSERID', (FILE'PART'SIZE)                  75103000
   ELSE IF SEEN'CREATOR THEN                                            75104000
      ! ALREADY IN RES'CREATOR'                                         75105000
   ELSE IF SEEN'LOCAL THEN                                              75106000
      BEGIN                                                             75107000
      MOVE RES'CREATOR' := LOGON'USER', (FILE'PART'SIZE);               75108000
      DONT'CHK'USER := TRUE;                                            75109000
      END                                                               75110000
   ELSE                                                                 75111000
      MOVE RES'CREATOR' := FLUSERID', (FILE'PART'SIZE);                 75112000
                                                                        75113000
$IF X1=ON THEN                <<Debugging code>>                        75114000
   IF DEBUGGING THEN                                                    75115000
      BEGIN                                                             75116000
      SAY "GET'TARGETS DONE" ENDSAY;                                    75117000
      SEND;                                                             75118000
      SAY "   RES'ACCT'    = " ENDSAY;                                  75119000
      SAY RES'ACCT',(FILE'PART'SIZE) ENDSAY;                            75120000
      SEND;                                                             75121000
      SAY "   RES'GROUP'   = " ENDSAY;                                  75122000
      SAY RES'GROUP',(FILE'PART'SIZE) ENDSAY;                           75123000
      SEND;                                                             75124000
      SAY "   RES'CREATOR' = " ENDSAY;                                  75125000
      SAY RES'CREATOR',(FILE'PART'SIZE) ENDSAY;                         75126000
      SEND;                                                             75127000
      END;                                                              75128000
$IF                                                                     75129000
                                                                        75130000
END <<GET'TARGETS OF RESTORE'A'FILE>>;                                  75131000
$PAGE "SWITCH'TO'NEW'FILE of RESTORE'A'FILE"                            75132000
<<---------------------------------------->>                            75133000
<<  SWITCH'TO'NEW'FILE of RESTORE'A'FILE  >>                            75134000
<<---------------------------------------->>                            75135000
                                                                        75136000
SUBROUTINE SWITCH'TO'NEW'FILE;                                          75137000
BEGIN                                                                   75138000
                                                                        75139000
   IF OLD'COPY'EXISTS THEN                                              75140000
      BEGIN                                                             75141000
      SCAN'PARMS'D := FILE'ADDRESS;                                     75142000
      SCAN'PARMS.(00:08) := FILE'VTAB;                                  75143000
                                                                        75144000
      TYPE := 2;    <<Start at file Level - goto file level>>           75145000
                                                                        75146000
      DISABLE'ARITHMETIC'TRAPS;                                         75147000
                                                                        75148000
      DR := DIRECSCAN (TYPE, FILE'INDEX'PTR, RES'ACCT, RES'GROUP,       75149000
                       RES'FILE, ADJUST'FPTR, SCAN'PARMS, PVMVTABX);    75150000
                                                                        75151000
      ENABLE'ARITHMETIC'TRAPS;                                          75152000
                                                                        75153000
      IF <> THEN FAIL (DIRECTORY'ERROR (DR));                           75154000
                                                                        75155000
      DIRECTORY'SWITCHED := TRUE;                                       75156000
                                                                        75157000
$IF X1=ON THEN                                                          75158000
      IF DEBUGGING THEN                                                 75159000
         BEGIN                                                          75160000
         SAY "   SWITCHED TO NEW FILE AT %" ENDSAY;                     75161000
         SAYDOCTAL (SCAN'PARMS'D);                                      75162000
         SEND;                                                          75163000
         END;                                                           75164000
$IF                                                                     75165000
      END;                                                              75166000
END <<SWITCH'TO'NEW'FILE OF RESTORE'A'FILE>>;                           75167000
$PAGE "INSERT'NEW'FILE of RESTORE'A'FILE"                               75168000
<<---------------------------------------->>                            75169000
<<  INSERT'NEW'FILE                       >>                            75170000
<<---------------------------------------->>                            75171000
                                                                        75172000
SUBROUTINE INSERT'NEW'FILE;                                             75173000
BEGIN                                                                   75174000
                                                                        75175000
   IF NOT OLD'COPY'EXISTS THEN                                          75176000
      BEGIN                                                             75177000
                                                                        75178000
      FADDR := FILE'ADDRESS;                                            75179000
      FADDR'1 . (00:08) := FILE'VTAB;                                   75180000
                                                                        75181000
      GET'SIRS (TRUE, TRUE);                                            75182000
      DISABLE'ARITHMETIC'TRAPS;                                         75183000
                                                                        75184000
      DR := DIRECINSERTFILE (FILE'SECTORS, PARMS'TEMPI'1, RES'ACCT,     75185000
                             RES'GROUP, RES'FILE, FADDR, PVMVTABX);     75186000
                                                                        75187000
      IF <> THEN                                                        75188000
         FAIL (DIRECTORY'ERROR (DR));                                   75189000
                                                                        75190000
      ENABLE'ARITHMETIC'TRAPS;                                          75191000
      RELEASE'SIRS (TRUE, TRUE);                                        75192000
                                                                        75193000
      FILE'INSERTED'INTO'DIRECTORY := TRUE;                             75194000
$IF X1=ON THEN                                                          75195000
      IF DEBUGGING THEN                                                 75196000
         BEGIN                                                          75197000
         SAY "NEW FILE INSERTED INTO DIRECTORY" ENDSAY;                 75198000
         SEND;                                                          75199000
         END;                                                           75200000
$IF                                                                     75201000
      END;                                                              75202000
END;                                                                    75203000
$PAGE "PURGE'OLD'FILE of RESTORE'A'FILE"                                75204000
<<---------------------------------------->>                            75205000
<<  PURGE'OLD'FILE of RESTORE'A'FILE      >>                            75206000
<<---------------------------------------->>                            75207000
                                                                        75208000
SUBROUTINE PURGE'OLD'FILE;                                              75209000
BEGIN                                                                   75210000
                                                                        75211000
   IF OLD'COPY'EXISTS THEN                                              75212000
      BEGIN                                                             75213000
                                                                        75214000
      JOIN'CONTIGUOUS'EXTENTS (OLD'DISJ'EXTS, OLD'DISJ'ADDR,            75215000
                               OLD'DISJ'LEN,  OLD'EXTMAP'D,             75216000
                               OLD'NUMEXTS+1, OLD'EXTSIZE'D,            75217000
                               OLD'LASTEXTSIZ'D);                       75218000
                                                                        75219000
      DISABLE'ARITHMETIC'TRAPS;                                         75220000
                                                                        75221000
      I := -1;                                                          75222000
      WHILE (I:=I+1) <= OLD'DISJ'EXTS DO                                75223000
         IF OLD'DISJ'ADDR (I) <> 0D THEN                                75224000
            BEGIN                                                       75225000
            RELEASE'ADDR := OLD'DISJ'ADDR (I);                          75226000
            RELEASE'LDEV := LOGICAL (RELEASE'ADDR'B1);                  75227000
            RELEASE'ADDR'B1 := 0;                                       75228000
            RETURN'DISC'SPACE (RELEASE'LDEV, RELEASE'ADDR,              75229000
                               OLD'DISJ'LEN (I));                       75230000
            END;                                                        75231000
                                                                        75232000
      ENABLE'ARITHMETIC'TRAPS;                                          75233000
                                                                        75234000
      END;                                                              75235000
                                                                        75236000
END <<PURGE'OLD'FILE OF RESTORE'A'FILE>>;                               75237000
$PAGE "INIT'RESTORE'A'FILE of RESTORE'A'FILE"                           75238000
<<---------------------------------------->>                            75239000
<<  INIT'RESTORE'A'FILE of RESTORE'A'FILE >>                            75240000
<<---------------------------------------->>                            75241000
                                                                        75242000
SUBROUTINE INIT'RESTORE'A'FILE;                                         75243000
BEGIN                                                                   75244000
   TAPE'REEL := TL'REELNUM;                                             75245000
   FILE'WAS'OPENED := FALSE;                                            75246000
   KILL'RESTORE := FALSE;                                               75247000
   READ'WAS'ALREADY'DONE := FALSE;                                      75248000
   RESTORE'A'FILE := GOOD;                                              75249000
END <<INIT'RESTORE'A'FILE OF RESTORE'A'FILE>>;                          75250000
$PAGE "UNBUMP'DISC'USECOUNT of RESTORE'A'FILE"                          75251000
<<----------------------------------------->>                           75252000
<<  UNBUMP'DISC'USECOUNT of RESTORE'A'FILE >>                           75253000
<<----------------------------------------->>                           75254000
                                                                        75255000
SUBROUTINE UNBUMP'DISC'USECOUNT;                                        75256000
BEGIN                                                                   75257000
   DISKDEALLOC (FLEXTSIZE'L, FLLASTEXTSIZE, -(FLNUMEXTS+1), FLEXTMAP'D);75258000
                                                                        75259000
$IF X1=ON THEN                                                          75260000
   IF DEBUGGING THEN                                                    75261000
      BEGIN                                                             75262000
      SAY "DISC USECOUNT HAS BEEN UNBUMPED" ENDSAY ;                    75263000
      SEND;                                                             75264000
      END;                                                              75265000
$IF                                                                     75266000
END;                                                                    75267000
$PAGE "RESTORE'A'FILE mainline"                                         75268000
$IF X1=ON THEN                <<Debugging code>>                        75269000
   IF DEBUGGING THEN                                                    75270000
      BEGIN                                                             75271000
      SAY "ENTERING RESTORE'A'FILE" ENDSAY;                             75272000
      SEND;                                                             75273000
      END;                                                              75274000
$IF                                                                     75275000
                                                                        75276000
   INIT'RESTORE'A'FILE;                                                 75277000
                                                                        75278000
   GET'TARGETS;                                                         75278100
                                                                        75278200
   DISPLAY'3'TO'DISPLAY (TITLE', TITLE'LEN, FLLOCNAME',                 75279000
                         RES'GROUP', RES'ACCT'          );              75280000
                                                                        75281000
   IF SM'TOG THEN CHANGE'JIT'ACCT (JITDST, RES'ACCT);                   75283000
   ASSERT'FILECODES'OK;                                                 75284000
   ASSERT'READ'ACCESS;                                                  75285000
   ASSERT'LOCKWORD;                                                     75286000
                                                                        75287000
   GET'SIZES;                                                           75288000
                                                                        75289000
   EVAL'RETURN (LOCK'DIRECTORY);                                        75290000
   ASSERT'USER'EXISTENCE;                                               75291000
                                                                        75292000
   EVAL'RETURN  ( HIDE'OLD'COPY );                                      75293000
   OLD'FILE'HIDDEN := TRUE;                                             75294000
                                                                        75295000
   IF NOT PICK'A'DEVICE (EXTENT'SIZES) THEN FAIL (M'OUT'OF'DISC'SPACE); 75296000
   DISC'SPACE'ALLOCATED := TRUE;                                        75297000
                                                                        75298000
   ADJUST'FLAB;                                                         75299000
                                                                        75300000
   EVAL'RETURN (LABELIO (FLAB, FILE'LDEV, FILE'ADDRESS, ATTIO'WRITE,    75301000
                         RES'TITLE));                                   75302000
                                                                        75303000
   INSERT'NEW'FILE;                                                     75304000
                                                                        75305000
   IF USING'ATTIO THEN READ'ALL'ATTIO;                                  75306000
                                                                        75307000
   EVAL'RETURN ( WRITE'THE'FILE (TDBUF, GBUF) );                        75308000
                                                                        75309000
   PURGE'OLD'FILE;                                                      75310000
   SWITCH'TO'NEW'FILE;                                                  75311000
   UNBUMP'DISC'USECOUNT;                                                75312000
   FINISHUP;                  !HELP                                     75313000
                                                                        75314000
                                                                        75315000
                                                                        75316000
$IF X1=ON THEN                <<Debugging code>>                        75317000
   IF DEBUGGING THEN                                                    75318000
      BEGIN                                                             75319000
      SAY "***************************************************" ENDSAY; 75320000
      SEND;                                                             75321000
      SAY "***************************************************" ENDSAY; 75322000
      SEND;                                                             75323000
      SAY "RESTORE'A'FILE SUCCESSFUL" ENDSAY;                           75324000
      SEND;                                                             75325000
      SEND;                                                             75326000
      SEND;                                                             75327000
      END;                                                              75328000
$IF                                                                     75329000
                                                                        75330000
END'RESTORE'A'FILE:                                                     75331000
                                                                        75332000
                                                                        75333000
$IF X1=ON THEN                <<Debugging code>>                        75334000
   IF DEBUGGING THEN                                                    75335000
      BEGIN                                                             75336000
      SAY "***************************************************" ENDSAY; 75337000
      SEND;                                                             75338000
      SAY "***************************************************" ENDSAY; 75339000
      SEND;                                                             75340000
      SAY "LEAVING RESTORE'A'FILE" ENDSAY;                              75341000
      SEND;                                                             75342000
      SEND;                                                             75343000
      SEND;                                                             75344000
      END;                                                              75345000
$IF                                                                     75346000
                                                                        75347000
   END <<RESTORE'A'FILE>>;                                              75348000
$PAGE ";SENDMESSAGE=  SENDMESSAGE --- OUTPUT ROUTINE"                   80000000
$CONTROL SEGMENT=SENDMESSAGE                                            80002000
<<***************************************************************>>     80004000
LOGICAL PROCEDURE SENDMESSAGE (MSGNO, SEND'NO'CRLF,            <<LB.RS>>80006000
                               TELL'TO'OP, STRING);            <<LB.RS>>80006100
         VALUE MSGNO, SEND'NO'CRLF, TELL'TO'OP;                         80008000
         INTEGER MSGNO;                                                 80010000
         LOGICAL SEND'NO'CRLF, TELL'TO'OP;                              80012000
         BYTE ARRAY STRING;                                             80012100
         OPTION VARIABLE, UNCALLABLE;                                   80014000
                                                                        80016000
      <<---------------------------------------------------->>          80018000
      << This procedure is the master message generator     >>          80020000
      << for STORE/RESTORE.  Two kinds of parameters are    >>          80022000
      << passed to MSGNO: things that look like M'... and   >>          80024000
      << things that look like SR'... or RS'...             >>          80026000
      <<                                                    >>          80028000
      << Messages of the form SR'... or RS'... are simple   >>          80030000
      << messages and are merely system catalog message     >>          80032000
      << numbers from the SR'MESSAGE'SET set.               >>          80034000
      << These messages are generated and sent to the       >>          80036000
      << output files (SYSLIST and/or OFFLINE), and then    >>          80038000
      << the routine returns to the caller.                 >>          80040000
      <<                                                    >>          80042000
      << For ease of testing, we check to see if we have    >>          80044000
      << opened a catalog file (rather than depending on    >>          80046000
      << CATALOG.PUB.SYS).  If we have, the variable        >>          80048000
      << STORE'CATALOG is non-zero; and we will use it      >>          80050000
      << to generate messages.  If STORE'CATALOG is zero,   >>          80052000
      << the system catalog is accessed (via FORMSG and     >>          80054000
      << GENMSG) for all messages.                          >>          80056000
      <<                                                    >>          80058000
      << Messages of the form M'... are special messages.   >>          80060000
      << Each M'... message is converted into a list of     >>          80062000
      << smaller "parts" (by FIND'MSG'TEMPLATE), which      >>          80064000
      << are then "executed" (or "invoked" or "interpreted")>>          80066000
      << by INTERPRET'TEMPLATE.  This mechanism allows us   >>          80068000
      << to easily construct messages whose formatting goes >>          80070000
      << beyond what the MPE message system gives us.       >>          80072000
      << Each M'... declared in the outer block should      >>          80074000
      << have a matching occurance in the MSG'CONTROL array >>          80076000
      << declared in this procedure.  This array consists   >>          80078000
      << of varying size entries of the form:               >>          80080000
      <<      msg#, #parts, part1, part2, ..., partn        >>          80082000
      << The last entry in the array has a msg# of 0 and    >>          80084000
      << one part which is P'UNKNOWN.                       >>          80086000
      <<                                                    >>          80088000
      << To add a new kind of "part", add the appropriate   >>          80090000
      << equate below (in alphabetic order, please), and    >>          80092000
      << add it to the CASE statement in INTERPRET'TEMPLATE.>>          80094000
      <<                                                    >>          80096000
      << To add a new M'... message, declare it in the      >>          80098000
      << outer block with the others (if you maintain alpha->>          80100000
      << betic order (which is nice), ALL modules refering  >>          80102000
      << to M'... numbers AFTER your new one will have to   >>          80104000
      << be recompiled!), and add an entry for it in the    >>          80106000
      << MSG'CONTROL array (in alphabetic order always).    >>          80108000
      <<                                                    >>          80110000
      << Note that all M'... message numbers MUST be less   >>          80112000
      << than "FIRST'REAL'MSG" which is the message number  >>          80114000
      << of the first SR'... or RS'... message.  This allows>>          80116000
      << easy differentiation between the two kinds of      >>          80118000
      << messages.                                          >>          80120000
      <<                                                    >>          80122000
      << Any time we look up the template for a M'... and   >>          80124000
      << cannot find it, it defaults to:  1, P'UNKNOWN.     >>          80126000
      <<                                                    >>          80128000
      << A couple of MSGNOs are handled specially:          >>          80130000
      <<    SR'BREAK'SENSED, M'STORED, and M'RESTORED       >>          80132000
      <<                                                    >>          80134000
      << SR'BREAK'SENSED is printed iff the flag            >>          80136000
      << BREAK'MSG'SEEN is false.  The flag is then set     >>          80138000
      << to true.  (This particular error filters back thru >>          80140000
      << many levels and, without this kludge, would appear >>          80142000
      << to the user more than once!)                       >>          80144000
      <<                                                    >>          80146000
      << M'STORED and M'RESTORED are ignored if SHOW'FLAG   >>          80148000
      << is not set.  This is done here rather than in      >>          80150000
      << the caller (FSTORE and FRESTORE) to minimize their >>          80152000
      << knowledge of output formatting and control.        >>          80154000
      <<                                                    >>          80154010
      << If SEND'NO'CRLF is passed and it is TRUE then      >>          80154020
      << SENDMESSAGE will not add a carriage return-line    >> <<LB.RS>>80154030
      << feed to the message.                               >> <<LB.RS>>80154040
      <<                                                    >> <<LB.RS>>80154050
      << If TELL'TO'OP is passed and it is TRUE then        >> <<LB.RS>>80154060
      << SENDMESSAGE will send the output to the operator's >> <<LB.RS>>80154070
      << console instead of to SYSLIST.                     >> <<LB.RS>>80154080
      <<                                                    >> <<LB.RS>>80154090
      << If STRING is passed then SENDMESSAGE will place    >> <<LB.RS>>80154100
      << the message in STRING instead of printing it to    >> <<LB.RS>>80154110
      << SYSLIST.                                           >> <<LB.RS>>80154120
      <<---------------------------------------------------->>          80156000
                                                                        80158000
   BEGIN                                                                80160000
                                                                        80162000
                                                                        80164000
   DOUBLE                                                               80166000
      D;                                                                80168000
                                                                        80170000
   INTEGER ARRAY                                                        80172000
      TEMPLATE    (0:15);     <<at most 16 parts in a template!>>       80174000
                                                                        80176000
   INTEGER                                                              80178000
      CONTROL'CODE,                                                     80180000
      DUMMY,                                                            80182000
      FID         := 0,       <<used to handle wide/narrow stuff>>      80184000
      I           := 0,       <<scratch integer>>                       80186000
      INX         := 0,       <<index: MSG'CONTROL & TEMPLATE>>         80188000
      LEN         := 0,                                                 80190000
      LOC'LEV,                                                          80192000
      LOOPS       := 0,       <<will be either 1 or 2>>                 80194000
      MSG'PARTS   := 0,       <<number of parts in a template.>>        80196000
      PTYPE       := 0,       <<type of a template part>>               80198000
      RECSIZE     := 0,       <<used for wide/narrow stuff>>            80200000
      SYSLISTNUM  := 0;                                                 80202000
                                                                        80202100
   INTEGER                                                              80202200
      PAT'CHAR        := 0,                                             80202300
      PAT'INX         := 1,                                             80202400
      PAT'LEN         := 0,                                             80202500
      PAT'PARTS       := 0,                                             80202600
      PAT'TOTAL'LEN   := 0,                                             80202610
      PAT'WORD        := 0;                                             80202700
                                                                        80204000
   LOGICAL ARRAY                                                        80206000
      SCRATCH     (0:66),                                               80208000
      TEXT1       (0:66),                                               80210000
      TEXT2       (0:66);                                               80212000
                                                                        80214000
   DOUBLE ARRAY                                                         80216000
      SCRATCH'D   (*) = SCRATCH (0);                                    80218000
                                                                        80220000
   LOGICAL                                                              80222000
      L1,                                                               80224000
      L2,                                                               80226000
      L3,                                                               80228000
      PMASK  = Q-4,           <<PARAMETER MASK>>                        80230000
      PUT'IN'STRING := TRUE,  <<USE STRING INSTEAD OF SYSLIST>><<LB.RS>>80231000
      SIZE'FLAGS;             <<used to control output width>>          80232000
                                                                        80234000
   BYTE ARRAY                                                           80236000
      SCRATCH'    (*) = SCRATCH (0),                                    80238000
      TEXT1'      (*) = TEXT1 (0),                                      80240000
      TEXT2'      (*) = TEXT2 (0);                                      80242000
                                                                        80244000
   BYTE POINTER                                                         80246000
      P,                                                                80248000
      PTEXT,                                                            80250000
      SAVE'PTEXT;                                                       80252000
                                                                        80254000
$PAGE                                                                   80256000
   EQUATE                                                               80258000
         <<These equates are alphabetically ordered and monotonically   80260000
           increasing...>>                                              80262000
                                                                        80264000
      P'BAD'FILESIZE= 0         + 1, <<filesize was invalid>>           80266000
      P'CHANGED'CREATOR  = P'BAD'FILESIZE+1, <<Creator was changed>>    80268000
      P'DATE      = P'CHANGED'CREATOR+1, <<appends the date/time>>      80270000
      P'DATE'RANGE= P'DATE       + 1,<<ADATE...MDATE not in range>>     80272000
      P'DATELINE  = P'DATE'RANGE + 1,<<DATELINE intrinsic text>>        80274000
      P'DIREC     = P'DATELINE   + 1,<<ACCT,CREATOR,GROUP parms goofup>>80276000
      P'DISK'ERR  = P'DIREC      + 1,<<disk io error>>                  80278000
      P'DOUBLE'1  = P'DISK'ERR   + 1,                                   80280000
      P'DOUBLE'2  = P'DOUBLE'1   + 1,                                   80282000
      P'ERRNUM    = P'DOUBLE'2   + 1, <<ERROR NUMBER>>         <<LB.RS>>80283000
      P'FCHECK    = P'ERRNUM     + 1, <<File intrinsic ret>>   <<LB.RS>>80284000
      P'FILECODE'RANGE=P'FCHECK  + 1,<<FILECODE not in range>>          80286000
      P'FLAB'ADDRESS=P'FILECODE'RANGE+1,                                80288000
      P'FLAB'CHECKSUM=P'FLAB'ADDRESS+1,                                 80290000
      P'FLAB'READ = P'FLAB'CHECKSUM+1,                                  80292000
      P'FLAB'TITLE= P'FLAB'READ  + 1,                                   80294000
      P'FLAB'WRITE= P'FLAB'TITLE + 1,                                   80296000
      P'HEADING   = P'FLAB'WRITE + 1,    <<heading line>>               80298000
      P'INDENT9   = P'HEADING    + 1,    << "         " >>              80300000
      P'INFO      = P'INDENT9   + 1, <<ldn%addrss reel code size typ>>  80302000
      P'LEVEL     = P'INFO      + 1, <<GROUP grpname IN ACCT acctname>> 80304000
                                     <<USER  usrname IN ACCT acctname>> 80306000
                                     <<ACCT acctname>>                  80308000
      P'LINE2     = P'LEVEL     + 1, <<switch to TEXT2' buffer>>        80310000
      P'MNUM      = P'LINE2     + 1, <<append message number>> <<06156>>80311000
      P'NOT'TITLE = P'MNUM      + 1, <<STANDARD'NOT'TITLE >>   <<06312>>80312000
      P'NOT'PURGED= P'NOT'TITLE + 1, <<NOT PURGED>>                     80313000
      P'NSR       = P'NOT'PURGED+ 1, <<P'TITLE, NOT STORED/RESTORED>>   80314000
      P'NUM       = P'NSR       + 1, <<Write out parms'tempi'1>>        80316000
      P'OPEN'FAIL = P'NUM       + 1, <<OPEN'FILE failed>>               80318000
      P'PATTERN   = P'OPEN'FAIL + 1, <<pattern>>                        80319000
      P'RESTORE'P = P'PATTERN   + 1, <<preview of RESTORE>>             80320000
      P'SECURITY  = P'RESTORE'P + 1, <<Security information>>           80322000
      P'SUMMARY   = P'SECURITY  + 1, <<STORE/RESTORE summary count>>    80324000
      P'TEXT      = P'SUMMARY   + 1, <<txt count in words, then txt>>   80326000
      P'TITLE     = P'TEXT      + 1, <<text: byte address and length>>  80328000
      P'UNKNOWN   = P'TITLE     + 1, <<unknown PTYPE>>                  80330000
                                                                        80332000
         <<highest legal value of P'...>>                               80334000
                                                                        80336000
      P'MAX'P'    = P'UNKNOWN;                                          80338000
$PAGE                                                                   80340000
                                                                        80342000
         <<These equates ARE used to access the message CATALOG...      80344000
           and are used only within SENDMESSAGE!                        80346000
           They are in the same order as within the message catalog...  80348000
           They must not be less than 1000!>>                           80350000
                                                                        80352000
   EQUATE                                                               80354000
      MSG'READ'ACCESS'FAILURE    = 1001,                                80356000
      MSG'ACCESS'10'FAILURE      = 1002,                                80358000
      MSG'ACCT                   = 1003,                                80360000
      MSG'ADATE                  = 1004,                                80362000
      MSG'CDATE                  = 1005,                                80364000
      MSG'CREATOR                = 1006,                                80366000
      MSG'DEFECTIVE'FILE'LABEL   = 1007,                                80368000
      MSG'DIRECSCAN'ERROR        = 1008,                                80370000
      MSG'DIRECTORY'ERROR        = 1009,                                80372000
      MSG'FILE                   = 1010,                                80374000
      MSG'FILE'BUSY              = 1011,                                80376000
      MSG'FILECODE'NEGATIVE      = 1012,                                80378000
      MSG'FILECODE               = 1013,                                80380000
      MSG'FILE'IO'BUSY           = 1014,                                80382000
      MSG'FILE'READ'BUSY         = 1015,                                80384000
      MSG'FILE'WRITE'BUSY        = 1016,                                80386000
      MSG'GROUP                  = 1017,                                80388000
      MSG'BAD'IRESTORE'TITLE     = 1018,                                80390000
      MSG'TAPE'VERSION           = 1019,                                80392000
      MSG'INUSE'RESTORE          = 1020,                                80394000
      MSG'INUSE'STORE            = 1021,                                80396000
      MSG'LABEL'READ'FAIL        = 1022,                                80398000
      MSG'LABEL'WRITE'FAIL       = 1023,                                80400000
      MSG'LOCKWORD'MISMATCH      = 1024,                                80402000
      MSG'MDATE                  = 1025,                                80404000
      MSG'NOT'IN'DIRECTORY       = 1026,                                80406000
      MSG'NOT'RESTORED           = 1027,                                80408000
      MSG'NOT'STORED             = 1028,                                80410000
      MSG'NOUNLOCK'WRITE'FAILED  = 1029,                                80412000
      MSG'PROGRAM'RUNNING        = 1030,                                80414000
      MSG'PV'MOUNT'FAIL          = 1031,                                80416000
      MSG'DISC'LOCK              = 1032,                                80418000
      MSG'WILL'RESTORE           = 1033,                                80420000
      MSG'INUSE'WRITE            = 1034,                                80422000
      MSG'NOT'IN'RANGE           = 1035,                                80424000
      MSG'FILES'ON'TAPE          = 1036,                                80426000
      MSG'RELEASED               = 1037,                                80428000
      MSG'NO'RESTORE'FILES       = 1038,                                80430000
      MSG'NO'STORE'FILES         = 1039,                                80432000
      MSG'DISK'READ'ERR          = 1040,                                80434000
      MSG'DISK'WRITE'ERR         = 1041,                                80436000
      MSG'ADDRESS                = 1042,                                80438000
      MSG'SECTORS                = 1044,                                80440000
      MSG'ERROR                  = 1045,                                80442000
      MSG'CURR'TITLE             = 1046,                                80444000
      MSG'LAST'TITLE             = 1047,                                80446000
      MSG'FAILED'TO'RESTORE      = 1048,                                80448000
      MSG'FAILED'TO'STORE        = 1049,                                80450000
      MSG'STORE'IO'ERROR         = 1050,                                80452000
      MSG'FILES'RESTORED         = 1051,                                80454000
      MSG'FILES'STORED           = 1052,                                80456000
      MSG'FILES'NOT'RESTORED     = 1053,                                80458000
      MSG'FILES'NOT'STORED       = 1054,                                80460000
      MSG'FAILED'RESTORE'FILES   = 1055,                                80462000
      MSG'FAILED'STORED'FILES    = 1056,                                80464000
      MSG'RESTORE'IO'ERROR       = 1057,                                80466000
      MSG'HEADING1               = 1058,                                80468000
      MSG'HEADING2               = 1059,                                80470000
      MSG'DATEHEADING            = 1060,                                80472000
      MSG'OPEN'FAIL              = 1061,                                80474000
      MSG'NOT'ON'TAPE            = 1062,                                80476000
      MSG'CANT'ACCESS'THIS'FILE  = 1063,                                80478000
      MSG'CANT'RESTORE'THIS'FILE = 1064,                                80480000
      MSG'EXPECTED               = 1065,                                80482000
      MSG'FOUND                  = 1066,                                80484000
      MSG'FLAB'ADDRESS'MISMATCH  = 1067,                                80486000
      MSG'LABEL'ADDRESS          = 1068,                                80488000
      MSG'FIRST'EXTENT           = 1069,                                80490000
      MSG'FLAB'CHECKSUM          = 1070,                                80492000
      MSG'CHECKSUM'COMPUTED      = 1071,                                80494000
      MSG'CHECKSUM'FOUND         = 1072,                                80496000
      MSG'FLAB'TITLE             = 1073,                                80498000
      MSG'PV'DISMOUNT'FAIL       = 1074,                                80500000
      MSG'NOT'ALL'SECTORS'WRITTEN= 1075,                                80502000
      MSG'ERROR'VALIDATING       = 1076,                                80504000
      MSG'ACCROSS'ACCOUNTS       = 1077,                                80506000
      MSG'NO'SAVE'ACCESS         = 1078,                                80508000
      MSG'DISC'LOCKWORD          = 1079,                                80510000
      MSG'TAPE'LOCKWORD          = 1080,                                80512000
      MSG'CANT'PURGE             = 1081,                                80514000
      MSG'CANT'READ              = 1082,                                80516000
      MSG'ACCESS'VIOLATION       = 1083,                                80518000
      MSG'CREATOR'CHANGED        = 1084,                                80520000
      MSG'TO                     = 1085,                                80522000
      MSG'VOLUME'SET             = 1087,                                80524000
      MSG'MOUNT'FAILED           = 1088,                                80526000
      MSG'MISSING'EOF            = 1089,                                80528000
      MSG'READING'TRLBL          = 1090,                                80530000
      MSG'FCHECK'RETURNS         = 1091,                                80532000
      MSG'BAD'SIZE               = 1092,                                80534000
      MSG'USER'SPECIFIED         = 1093,                                80536000
      MSG'LOGON'ACCT'ASSUMED     = 1094,                                80538000
      MSG'VALIDATION'FAILED      = 1095,                                80540000
      MSG'GETTING'NEXT'VOL       = 1096,                                80542000
      MSG'EOF'LABELED            = 1097,                                80544000
      MSG'NO'FILES'RESTORED      = 1098,                                80546000
      MSG'FAILED'TO'PURGE        = 1099,                                80548000
      MSG'WRITING'EOF            = 1100,                                80550000
      MSG'SAVING'RESTORED'FILE   = 1101,                                80552000
      MSG'KEEP                   = 1102,                                80554000
      MSG'ACCT'GROUP             = 1103,                                80556000
      MSG'ACCT'USER              = 1104,                                80558000
      MSG'PROBLEM'VERIFYING      = 1105,                                80560000
      MSG'ACCT'EXISTS            = 1106,                                80562000
      MSG'USER                   = 1107,                                80564000
      MSG'LOADED                 = 1108,                                80566000
      MSG'SYNCHRONIZING          = 1109,                                80568000
      MSG'CREATED'DIR'ENTRY      = 1110,                                80570000
      MSG'NO'CREATE              = 1111,                                80572000
      MSG'IN                     = 1112,                                80574000
      MSG'IO'ERROR               = 1113,                                80576000
      MSG'EOF'ERR                = 1114,                                80578000
      MSG'CLOCK'TIME             = 1115,                                80580000
      MSG'CPU'TIME               = 1116,                                80582000
      MSG'MSECS                  = 1117,                                80584000
      MSG'THIS'IS'REEL'NO        = 1118,                                80586000
      MSG'DESIRED'REEL'IS'NO     = 1119,                                80588000
      MSG'FROM                   = 1120,                                80590000
      MSG'PREV'CATASTROPHIC      = 1121,                       <<LB.RS>>80592000
      MSG'ACCT'DISC'SPACE        = 1122,                       <<LB.RS>>80592010
      MSG'GROUP'DISC'SPACE       = 1123,                       <<LB.RS>>80592020
      MSG'ACCT'SAVE'ACCESS       = 1124,                       <<LB.RS>>80592030
      MSG'GROUP'SAVE'ACCESS      = 1125,                       <<LB.RS>>80592040
      MSG'DIREC'NO'ROOM          = 1126,                       <<LB.RS>>80592050
      MSG'DIREC'UNKNOWN          = 1127,                       <<LB.RS>>80592060
      MSG'EXCLUSIVE'ACCESS       = 1128,                       <<LB.RS>>80592070
      MSG'BAD'DISC'LOCKWORD      = 1129,                       <<LB.RS>>80592080
      MSG'OUT'OF'DISC'SPACE      = 1130,                       <<LB.RS>>80592090
      MSG'TAPE'ERROR             = 1131,                       <<LB.RS>>80592100
      MSG'NOT'PURGED             = 1132,                                80592110
      MSG'HOLDER                 =    0;                       <<LB.RS>>80593999
                                                                        80594000
$PAGE                                                                   80596000
                                                                        80598000
            <<This array uses the P' and MSG' equates to                80600000
              build messages...>>                                       80602000
                                                                        80604000
   INTEGER ARRAY                                                        80606000
                                                                        80608000
      MSG'CONTROL (*) = PB:=                                            80610000
                                                                        80612000
            <<message#>>                                                80614000
                                                                        80616000
               <<#Pnn   ... template parts...>>                         80618000
                                                                        80620000
         M'READ'ACCESS'FAILURE,                                         80622000
               2,    P'NSR, MSG'READ'ACCESS'FAILURE,                    80624000
         M'ACCESS'10'FAILURE,                                           80626000
               2,    P'NSR, MSG'ACCESS'10'FAILURE,                      80628000
         M'ACCT'DISC'SPACE,                                    <<LB.RS>>80628100
               2,    P'NSR, MSG'ACCT'DISC'SPACE,               <<LB.RS>>80628200
         M'ACCT'SAVE'ACCESS,                                   <<LB.RS>>80628300
               2,    P'NSR, MSG'ACCT'SAVE'ACCESS,              <<LB.RS>>80628400
         M'ADATE'NOT'IN'RANGE,                                          80630000
               3,    P'NSR, MSG'ADATE, P'DATE'RANGE,                    80632000
         M'BAD'IRESTORE'TITLE,                                          80634000
               3,    MSG'BAD'IRESTORE'TITLE, P'TEXT, P'MNUM,   <<06156>>80636000
         M'BLANK'LINE,                                                  80638000
               0,                                                       80640000
         M'CANT'PURGE'DISC'FILE,                                        80642000
               2,    P'NSR, MSG'CANT'PURGE,                             80644000
         M'CANT'READ'TAPE'FILE,                                         80646000
               2,    P'NSR, MSG'CANT'READ,                              80648000
         M'CANT'RESTORE'THIS'FILE,                                      80650000
               2,    P'NSR, MSG'CANT'RESTORE'THIS'FILE,                 80652000
         M'CDATE'NOT'IN'RANGE,                                          80654000
               3,    P'NSR, MSG'CDATE, P'DATE'RANGE,                    80656000
         M'CONTAINED'TAPE'ERROR,                               <<LB.RS>>80656100
               2,    P'NSR, MSG'TAPE'ERROR,                    <<LB.RS>>80656200
         M'CREATED'DIR'ENTRY,                                           80658000
               3,    P'LEVEL, MSG'CREATED'DIR'ENTRY, P'MNUM,   <<06156>>80660000
         M'DATELINE,                                                    80662000
               1,    P'DATELINE,                                        80664000
         M'DIREC'NO'ROOM,                                      <<LB.RS>>80664100
               3,    P'NSR, MSG'DIREC'NO'ROOM, P'ERRNUM,       <<LB.RS>>80664200
         M'DIREC'UNXPECTED,                                    <<LB.RS>>80664300
               3,    P'NSR, MSG'DIREC'UNKNOWN, P'ERRNUM,       <<LB.RS>>80664400
         M'DIRECSCAN'ERROR,                                             80666000
               1,    MSG'DIRECSCAN'ERROR,                               80668000
         M'DISK'READ'FAILED,                                            80670000
               5,    MSG'DISK'READ'ERR, P'TITLE, P'LINE2,      <<06156>>80672000
                     P'DISK'ERR, P'MNUM,                       <<06156>>80674000
         M'DISK'WRITE'FAILED,                                           80676000
               5,    MSG'DISK'WRITE'ERR, P'TITLE, P'LINE2,     <<06156>>80678000
                     P'DISK'ERR, P'MNUM,                       <<06156>>80680000
         M'ERR'STORING'FILE,                                            80682000
               4,    P'NSR, MSG'STORE'IO'ERROR, P'LINE2, P'INDENT9,     80684000
         M'ERROR'ACCT'VALIDATION,                              <<LB.RS>>80684100
               3,    P'NSR, MSG'ERROR'VALIDATING, MSG'ACCT,    <<LB.RS>>80684200
         M'ERROR'GROUP'VALIDATION,                                      80686000
               3,    P'NSR, MSG'ERROR'VALIDATING, MSG'GROUP,            80688000
         M'ERROR'USER'VALIDATION,                                       80690000
               3,    P'NSR, MSG'ERROR'VALIDATING, MSG'CREATOR,          80692000
         M'FILE'EXCL'ACC,                                      <<LB.RS>>80692100
               2,    P'NSR, MSG'EXCLUSIVE'ACCESS,              <<LB.RS>>80692200
         M'FILE'LOCKWORD'WRONG,                                         80694000
               2,    P'NSR, MSG'LOCKWORD'MISMATCH,                      80696000
         M'FILECODE'NOT'IN'RANGE,                                       80698000
               2,    MSG'FILECODE, P'FILECODE'RANGE,                    80700000
         M'FLAB'ADDRESS'MISMATCH,                                       80702000
               2,    P'NSR, P'FLAB'ADDRESS,                             80704000
         M'FLAB'CHECKSUM,                                               80706000
               2,    P'NSR, P'FLAB'CHECKSUM,                            80708000
         M'FLAB'TITLE'MISMATCH,                                         80710000
               2,    P'NSR, P'FLAB'TITLE,                               80712000
         M'GROUP'DISC'SPACE,                                   <<LB.RS>>80712100
               2,    P'NSR, MSG'GROUP'DISC'SPACE,              <<LB.RS>>80712200
         M'GROUP'SAVE'ACCESS,                                  <<LB.RS>>80712300
               2,    P'NSR, MSG'GROUP'SAVE'ACCESS,             <<LB.RS>>80712400
         M'KEEP'OLD'COPY,                                               80714000
               2,    P'NSR, MSG'KEEP,                                   80716000
         M'LOADED,                                                      80718000
               2,    P'NSR, MSG'LOADED,                                 80720000
         M'HEADING,                                                     80722000
               1,    P'HEADING,                                         80724000
         M'LOCKWORD'VIOL,                                      <<LB.RS>>80724100
               2,    P'NSR, MSG'BAD'DISC'LOCKWORD,             <<LB.RS>>80724200
         M'MDATE'NOT'IN'RANGE,                                          80726000
               3,    P'NSR, MSG'MDATE, P'DATE'RANGE,                    80728000
         M'MISSING'EOF,                                                 80730000
               2,    P'NSR, MSG'MISSING'EOF,                            80732000
         M'MOUNT'FAILED,                                                80734000
               2,    P'NSR, MSG'MOUNT'FAILED,                           80736000
         M'NEGATIVE'FILECODE,                                           80738000
               2,    P'NSR, MSG'FILECODE'NEGATIVE,                      80740000
         M'NO'ACCT,                                                     80742000
               3,    P'NSR, MSG'ACCT,  MSG'NOT'IN'DIRECTORY,            80744000
         M'NO'CREATE,                                                   80746000
               3,    P'NSR, P'LEVEL, MSG'NO'CREATE,                     80748000
         M'NO'CREATOR,                                                  80750000
               3,    P'NSR, MSG'CREATOR, MSG'NOT'IN'DIRECTORY,          80752000
         M'NO'FILE,                                                     80754000
               3,    P'NSR, MSG'FILE,  MSG'NOT'IN'DIRECTORY,            80756000
         M'NO'GROUP,                                                    80758000
               3,    P'NSR, MSG'GROUP, MSG'NOT'IN'DIRECTORY,            80760000
         M'NO'FILES'TO'RESTORE,                                         80762000
               4,    P'INDENT9, P'LINE2, MSG'NO'RESTORE'FILES, <<06156>>80764000
                     P'MNUM,                                   <<06156>>80765000
         M'NO'FILES'TO'STORE,                                           80766000
               4,    P'INDENT9, P'LINE2, MSG'NO'STORE'FILES,   <<06156>>80768000
                     P'MNUM,                                   <<06156>>80769000
         M'NOLOCK'WRITE'FAILED,                                         80770000
               2,    P'NSR, MSG'LABEL'WRITE'FAIL,                       80772000
         M'NOT'ALL'SECTORS'WRITTEN,                                     80774000
               2,    P'NSR, MSG'NOT'ALL'SECTORS'WRITTEN,                80776000
         M'NOT'PURGED,                                                  80776100
               1,    P'NOT'PURGED,                                      80776200
         M'NOUNLOCK'WRITE'FAILED,                                       80778000
               2,    MSG'NOUNLOCK'WRITE'FAILED, P'MNUM,        <<06156>>80780000
         M'OPEN'FAIL,                                                   80782000
               2,    P'OPEN'FAIL, P'MNUM,                      <<06156>>80784000
         M'OPEN'FOR'READ,                                               80786000
               2,    P'NSR, MSG'FILE'READ'BUSY,                         80788000
         M'OPEN'FOR'RESTORE,                                            80790000
               2,    P'NSR, MSG'INUSE'RESTORE,                          80792000
         M'OPEN'FOR'RW,                                                 80794000
               2,    P'NSR, MSG'FILE'IO'BUSY,                           80796000
         M'OPEN'FOR'STORE,                                              80798000
               2,    P'NSR, MSG'INUSE'STORE,                            80800000
         M'OPEN'FOR'WRITE,                                              80802000
               2,    P'NSR, MSG'INUSE'WRITE,                            80804000
         M'OUT'OF'DISC'SPACE,                                  <<LB.RS>>80804100
               2,    P'NSR, MSG'OUT'OF'DISC'SPACE,             <<LB.RS>>80804200
         M'PV'DISMOUNT'FAIL,                                            80806000
               3,    P'TEXT, MSG'PV'DISMOUNT'FAIL, P'MNUM,     <<06156>>80808000
         M'PV'MOUNT'PROBLEM,                                            80810000
               3,    P'TITLE, MSG'PV'MOUNT'FAIL, P'MNUM,       <<06156>>80812000
         M'PRE'ACCROSS'ACCOUNTS,                                        80814000
               3,    P'DIREC, MSG'ACCROSS'ACCOUNTS, P'MNUM,    <<06156>>80816000
         M'PRE'NO'SAVE'ACCESS,                                          80818000
               3,    P'DIREC, MSG'NO'SAVE'ACCESS, P'MNUM,      <<06156>>80820000
         M'PREV'CATASTROPHIC,                                           80822000
               2,    P'NSR, MSG'PREV'CATASTROPHIC,                      80824000
         M'READ'FILE'LABEL'FAILED,                                      80826000
               2,    P'NSR, P'FLAB'READ,                                80828000
         M'REEL'SUPPLIED,                                               80830000
               5,    MSG'THIS'IS'REEL'NO, P'NUM, MSG'FROM,     <<06156>>80832000
                     P'DATE, P'MNUM,                           <<06156>>80833000
         M'RES'ACCT'DOESNT'EXIST,                                       80834000
               2,    P'DIREC, MSG'NOT'IN'DIRECTORY,                     80836000
         M'RES'ACCT'VERIFY,                                             80838000
               2,    P'DIREC, MSG'VALIDATION'FAILED,                    80840000
         M'RES'GROUP'DOESNT'EXIST,                                      80842000
               2,    P'DIREC, MSG'NOT'IN'DIRECTORY,                     80844000
         M'RES'GROUP'VERIFY,                                            80846000
               2,    P'DIREC, MSG'VALIDATION'FAILED,                    80848000
         M'RES'USER'DOESNT'EXIST,                                       80850000
               2,    P'DIREC, MSG'NOT'IN'DIRECTORY,                     80852000
         M'RES'USER'VERIFY,                                             80854000
               2,    P'DIREC, MSG'VALIDATION'FAILED,                    80856000
         M'RESTORE'PREVIEW,                                             80858000
               1,    P'RESTORE'P,                                       80860000
         M'RESTORE'SUMMARY,                                             80862000
               1,    P'SUMMARY,                                         80864000
         M'RESTORED,                                                    80866000
               1,    P'INFO,                                            80868000
         M'SECURITY,                                                    80870000
               2,    P'INDENT9, P'SECURITY,                             80872000
         M'SETTING'EOF,                                                 80874000
               3,    P'NSR, MSG'WRITING'EOF, P'FCHECK,                  80876000
         M'STORE'SUMMARY,                                               80878000
               1,    P'SUMMARY,                                         80880000
         M'SYNCHRONIZING,                                               80882000
               2,    P'NSR, MSG'SYNCHRONIZING,                          80884000
         M'STORED,                                                      80886000
               1,    P'INFO,                                            80888000
         M'T'EOF'TAPEREAD,                                              80890000
               4,    P'TITLE, MSG'READING'TRLBL, MSG'BAD'SIZE, <<06156>>80892000
                     P'MNUM,                                   <<06156>>80893000
         M'T'NEXT'TAPE'FILE'ERROR,                                      80894000
               3,    P'TITLE, MSG'GETTING'NEXT'VOL, P'MNUM,    <<06156>>80896000
         M'T'TRLBL'ERROR,                                               80898000
               4,    P'TITLE, MSG'READING'TRLBL, P'FCHECK,     <<06156>>80900000
                     P'MNUM,                                   <<06156>>80901000
         M'TAPE'BAD'LOCKWORD,                                           80902000
               2,    P'NSR, MSG'TAPE'LOCKWORD,                          80904000
         M'TAPE'DESIRED,                                                80906000
               5,    MSG'DESIRED'REEL'IS'NO, P'NUM, MSG'FROM,  <<06156>>80908000
                     P'DATE, P'MNUM,                           <<06156>>80909000
         M'TIME'INFO,                                                   80910000
               2,    P'DOUBLE'1,                                        80912000
                     P'DOUBLE'2,                                        80914000
         M'TITLE,                                              <<06156>>80914100
               1,    P'TITLE,                                  <<06156>>80914200
         M'TEXT,                                                        80916000
               1,    P'TEXT,                                            80918000
         M'W'CREATOR'CHANGED,                                           80920000
               2,    P'CHANGED'CREATOR, P'MNUM,                <<06156>>80922000
         M'WRITE'FILE'LABEL'FAILED,                                     80924000
               2,    P'NSR, P'FLAB'WRITE,                               80926000
         M'NOT'ON'TAPE,                                                 80926010
               2,    P'PATTERN, MSG'NOT'ON'TAPE,                        80926020
         0,                                                             80928000
               1,    P'UNKNOWN;                                         80930000
                                                                        80932000
$PAGE                                                                   80934000
                                                                        80936000
   LOGICAL ARRAY                                               <<04752>>80938000
      REG'MONTH'DAYS  (*) = PB :=   0,  31,  59,  90, 120, 151,<<04752>>80940000
                             181, 212, 243, 273, 304, 334, 999;<<04752>>80942000
   LOGICAL ARRAY                                               <<04752>>80944000
      LEAP'MONTH'DAYS (*) = PB :=   0,  31,  60,  91, 121, 152,<<04752>>80946000
                             182, 213, 244, 274, 305, 335, 999;<<04752>>80948000
   LOGICAL ARRAY                                               <<04752>>80950000
      DAYS'PER'MONTH (0:12);                                   <<04752>>80952000
   INTEGER ARRAY                                                        80954000
      FO'FORMAT   (*) = PB:="F", "V", "U", "3";                         80956000
                                                                        80958000
   INTEGER ARRAY                                                        80960000
      FO'BINARY'ASCII(*)=PB:= "B", "A";                                 80962000
                                                                        80964000
   INTEGER ARRAY                                                        80966000
      FO'FILEKIND (*) = PB:=" ", " ", "R", "M", "O", "5", "6", "7";     80968000
                                                                        80970000
   BYTE ARRAY                                                           80972000
      FILE'SECURITY'BITS' (*) = PB := "ANACALGUGLCR";                   80974000
                                                                        80976000
   DEFINE                                                               80978000
      APPEND      = BEGIN MOVE PTEXT:= #,                               80980000
      COMPACTv    = FALSE #,           <<reverse of FIXEDv>>            80982000
      ENDAPPEND   = ,2; @PTEXT:=TOS; END #,                             80984000
      FIXEDv      = TRUE #,                                             80986000
      OCTAL       = 8 #,                                                80988000
            <<line size defines...>>                                    80990000
      BIG'line    = SIZE'FLAGS.(15:01) #,                               80992000
      MEDIUM'line = SIZE'FLAGS.(14:01) #,                               80994000
      SHORT'line  = SIZE'FLAGS.(13:01) #,                               80996000
      SHOWSHORTFLAG=SIZE'FLAGS.(12:01) #;                               80998000
                                                                        81000000
   <<------------->>                                                    81002000
   <<  SPACE      >>                                                    81004000
   <<------------->>                                                    81006000
                                                                        81008000
   SUBROUTINE SPACE (N);                                                81010000
            VALUE    N;                                                 81012000
            INTEGER  N;                                                 81014000
      BEGIN                                                             81016000
                                                                        81018000
      FILL' (PTEXT, N, " ");                                            81020000
      @PTEXT:=@PTEXT(N);                                                81022000
                                                                        81024000
      END <<SPACE SUB>>;                                                81026000
                                                                        81028000
   <<------------->>                                                    81030000
   <<  NEXTLINE   >>                                                    81032000
   <<------------->>                                                    81034000
                                                                        81036000
   SUBROUTINE NEXTLINE (N);                                             81038000
            VALUE   N;                                                  81040000
            INTEGER N;                                                  81042000
      BEGIN                                                             81044000
                                                                        81046000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        81048000
      IF DEBUG'SENDMESSAGE THEN                                         81050000
         BEGIN                                                          81052000
         SAY "NEXTLINE (" ENDSAY; SAYNUM (N); SAY1 (")");               81054000
         SEND;                                                          81056000
         END;                                                           81058000
$IF                           <<DEBUGGING CODE>>                        81060000
                                                                        81062000
      @PTEXT:=@TEXT2';                                                  81064000
      SPACE (N);                                                        81066000
                                                                        81068000
      END <<NEXTLINE SUB>>;                                             81070000
                                                                        81072000
   <<------------->>                                                    81074000
   <<  WRITE'MSG  >>                                                    81076000
   <<------------->>                                                    81078000
                                                                        81080000
   SUBROUTINE WRITE'MSG (FNUM);                                         81082000
            VALUE FNUM;                                                 81084000
            INTEGER FNUM;                                               81086000
      BEGIN                                                             81088000
                                                                        81090000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        81092000
      IF DEBUG'SENDMESSAGE THEN                                         81094000
         BEGIN                                                          81096000
         SAY "   WRITE'MSG (" ENDSAY; SAYNUM (FNUM);                    81098000
         SAY1 (")");                                                    81100000
         SEND;                                                          81102000
         END;                                                           81104000
$IF                           <<DEBUGGING CODE>>                        81106000
                                                                        81108000
      IF SEND'NO'CRLF THEN CONTROL'CODE := %320                         81110000
      ELSE CONTROL'CODE := 0;                                           81112000
                                                                        81114000
      IF FNUM = 0 THEN                                                  81116000
         RETURN;                                                        81118000
                                                                        81120000
      SCAN TEXT1' UNTIL 0,1;           <<point to null at end.>>        81122000
      LEN:=TOS - LOGICAL(@TEXT1');     <<number of non-nulls.>>         81124000
                                                               <<LB.RS>>81124100
      IF PUT'IN'STRING THEN                                    <<LB.RS>>81124200
         BEGIN                                                 <<LB.RS>>81124300
         MOVE STRING := TEXT1', (LEN+1);                       <<LB.RS>>81124400
         RETURN;                                               <<LB.RS>>81124500
         END;                                                  <<LB.RS>>81124600
                                                                        81126000
      IF TELL'TO'OP THEN                                                81128000
         PRINTOP (TEXT1, -LEN, CONTROL'CODE)                            81130000
      ELSE                                                              81132000
         FWRITE (FNUM, TEXT1, -LEN, CONTROL'CODE);                      81134000
                                                                        81136000
      IF <> THEN                                                        81138000
         SENDMESSAGE:=FAILED;                                           81140000
                                                                        81142000
      SCAN TEXT2' UNTIL 0,1;           <<point to null at end.>>        81144000
      LEN:=TOS-LOGICAL(@TEXT2');       <<number of non-nulls>>          81146000
                                                                        81148000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        81150000
      IF DEBUG'SENDMESSAGE THEN                                         81152000
         BEGIN                                                          81154000
         SAY "   LEN2 = " ENDSAY; SAYNUM (LEN);                         81156000
         SEND;                                                          81158000
         END;                                                           81160000
$IF                           <<DEBUGGING CODE>>                        81162000
                                                                        81164000
      IF LEN > 0 THEN                  <<write the second line>>        81166000
         BEGIN                                                          81168000
         IF TELL'TO'OP THEN                                             81170000
            PRINTOP (TEXT2, -LEN, CONTROL'CODE)                         81172000
         ELSE                                                           81174000
            FWRITE (FNUM, TEXT2, -LEN, CONTROL'CODE);                   81176000
                                                                        81178000
         IF <> THEN                                                     81180000
            SENDMESSAGE:=FAILED;                                        81182000
         END;                                                           81184000
                                                                        81186000
      END <<WRITE'MSG SUB>>;                                            81188000
                                                                        81190000
   <<--------------->>                                                  81192000
   <<  ASSURE'ROOM  >>                                                  81194000
   <<--------------->>                                                  81196000
                                                                        81198000
   SUBROUTINE ASSURE'ROOM (N);                                          81200000
            VALUE   N;                                                  81202000
            LOGICAL N;                                                  81204000
                                                                        81206000
      BEGIN                                                             81208000
                                                                        81210000
      IF (LOGICAL(@PTEXT) - LOGICAL(@TEXT1')) + N >= 70 THEN            81212000
         NEXTLINE (12);                                                 81214000
                                                                        81216000
      END <<ASSURE'ROOM SUB>>;                                          81218000
                                                                        81220000
   <<----------->>                                                      81222000
   <<  APPEND1  >>                                                      81224000
   <<----------->>                                                      81226000
                                                                        81228000
   SUBROUTINE APPEND1 (CHAR); VALUE CHAR; LOGICAL CHAR;                 81230000
                                                                        81232000
      BEGIN                                                             81234000
                                                                        81236000
      IF CHAR.(8:8) = 0 THEN                                            81238000
         CHAR.(8:8):=CHAR.(0:8);                                        81240000
                                                                        81242000
       IF CHAR.(8:8) = " " THEN        <<handle SPL 'bug' of:     >>    81244000
         IF CHAR.(0:8) <> 0 THEN       << INT ARR A(*)=PB:=       >>    81246000
            CHAR.(8:8):=CHAR.(0:8);    << ... "S" ...  SPL emits: >>    81248000
                                       <<     "S " !!!!!!!!!!!!!! >>    81250000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        81252000
      IF DEBUG'SENDMESSAGE THEN                                         81254000
         BEGIN                                                          81256000
         SAY "APPEND1 (" ENDSAY;                                        81258000
         SAY1 (CHAR);                                                   81260000
         SAY1(")");                                                     81262000
         SEND;                                                          81264000
         END;                                                           81266000
$IF                           <<DEBUGGING CODE>>                        81268000
                                                                        81270000
      PTEXT:=CHAR;                                                      81272000
      @PTEXT:=@PTEXT(1);                                                81274000
                                                                        81276000
      END <<APPEND1 SUB>>;                                              81278000
                                                                        81280000
   <<--------------------->>                                            81282000
   <<  APPEND'FMTI        >>                                            81284000
   <<--------------------->>                                            81286000
                                                                        81288000
   SUBROUTINE APPEND'DOUBLE (N);                                        81290000
      VALUE N;                                                          81292000
      DOUBLE N;                                                         81294000
   BEGIN                                                                81296000
      IF N<0D THEN                                                      81298000
         APPEND1 ("-");                                                 81300000
                                                                        81302000
      @PTEXT := @PTEXT + DASCII(\N\,10,PTEXT);                          81304000
   END;                                                                 81306000
                                                                        81308000
   <<--------------------->>                                            81310000
   <<  APPEND'FMTI        >>                                            81312000
   <<--------------------->>                                            81314000
                                                                        81316000
   SUBROUTINE APPEND'FMTI (DN, I, BASE, FILLER);                        81318000
            VALUE DN, I, BASE, FILLER;                                  81320000
            DOUBLE DN;                                                  81322000
            INTEGER I;                                                  81324000
            LOGICAL BASE, FILLER;                                       81326000
      BEGIN                                                             81328000
                                                                        81330000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        81332000
      IF DEBUG'SENDMESSAGE THEN                                         81334000
         BEGIN                                                          81336000
         SAY "   APPEND'FMTI (" ENDSAY;                                 81338000
         SAYDNUM (DN);                                                  81340000
         SAY ", " ENDSAY; SAYNUM (BASE);                                81342000
         SAY ", " ENDSAY; SAY1 (FILLER);                                81344000
         SAY1 (")");                                                    81346000
         SEND;                                                          81348000
         END;                                                           81350000
$IF                           <<DEBUGGING CODE>>                        81352000
                                                                        81354000
      LEN:=DASCII (DN, BASE, SCRATCH');                                 81356000
                                                                        81358000
      IF BASE = OCTAL THEN    <<DASCII treats octal stupidly>>          81360000
         MOVE SCRATCH'(0):=SCRATCH'(11-LEN),(LEN);                      81362000
            <<above does: SCRATCH':=(11-LEN) DROP SCRATCH'>>            81364000
                                                                        81366000
      IF (I:=I-LEN) > 0 THEN                                            81368000
         BEGIN                                                          81370000
         PTEXT(0):=FILLER;                                              81372000
         IF I > 1 THEN                                                  81374000
            MOVE PTEXT(1):=PTEXT(0),(I-1);                              81376000
         @PTEXT:=INTEGER(LOGICAL(@PTEXT)+LOGICAL(I));                   81378000
         END;                                                           81380000
                                                                        81382000
      APPEND SCRATCH',(LEN) ENDAPPEND;                                  81384000
                                                                        81386000
      END <<APPEND'FMTI SUB>>;                                          81388000
                                                                        81390000
   <<--------------------->>                                            81392000
   <<  APPEND'FILECODE    >>                                            81394000
   <<--------------------->>                                            81396000
                                                                        81398000
   SUBROUTINE APPEND'FILECODE (FCODE, FOPT);                            81400000
            VALUE   FCODE, FOPT;                                        81402000
            INTEGER FCODE;                                              81404000
            LOGICAL        FOPT;                                        81406000
      BEGIN                                                             81408000
                                                                        81410000
      IF FOPT.(2:3) = 1 AND FCODE = 0 THEN                              81412000
         APPEND "KSAM " ENDAPPEND                                       81414000
      ELSE IF FCODE = 0 THEN                                            81416000
         SPACE (5)                                                      81418000
      ELSE IF FCODE = 111 THEN                                          81420000
         APPEND "111  " ENDAPPEND                              <<05031>>81422000
      ELSE                                                              81424000
         BEGIN                                                          81426000
         MOVE PTEXT:="     ";          << 5 blanks >>                   81428000
         GET'FILEMNEMONIC (FCODE, PTEXT, FOPT);                         81430000
         IF <> THEN           <<no mnemonic for this fcode>>            81432000
            IF FCODE < 0 THEN                                           81434000
               MOVE PTEXT:="PRIV"                                       81436000
            ELSE                                                        81438000
               ASCII (FCODE, 10, PTEXT);                                81440000
         @PTEXT:=@PTEXT(5);                                             81442000
         END;                                                           81444000
                                                                        81446000
      END <<APPEND'FILECODE SUB>>;                                      81448000
   <<--------------------->>                                            81448010
   <<  APPEND'FSERR       >>                                            81448020
   <<--------------------->>                                            81448030
                                                                        81448040
   SUBROUTINE APPEND'FSERR (FNUM);                                      81448050
      VALUE FNUM;                                                       81448060
      INTEGER FNUM;                                                     81448070
   BEGIN                                                                81448080
      FCHECK (FNUM, L1);                                                81448090
      FERRMSG (L1, SCRATCH, L2);                                        81448100
      MOVE PTEXT := SCRATCH', (L2);                                     81448101
      @PTEXT := @PTEXT + INTEGER(L2);                                   81448110
   END;                                                                 81448120
                                                                        81450000
   <<--------------------->>                                            81452000
   <<  APPEND'MSG         >>                                            81454000
   <<--------------------->>                                            81456000
                                                                        81458000
   SUBROUTINE APPEND'MSG (N); VALUE N; INTEGER N;                       81460000
                                                                        81462000
         <<appends the message 'N' (fetched from the                    81464000
            catalog) to PTEXT.  No leading/trailing                     81466000
           blanks are added. >>                                         81468000
                                                                        81470000
      BEGIN                                                             81472000
                                                                        81474000
      LEN:=0;                                                           81476000
                                                                        81478000
      IF STORE'CATALOG > 0 THEN                                         81480000
         LEN:=GENMESSAGE (STORE'CATALOG, SR'MESSAGE'SET, N,             81482000
                          PTEXT, 132, %133333,                          81484000
                          <<p1>>, <<p2>>, <<p3>>, <<p4>>, <<p5>>,       81486000
                          <<msgdest>>)                                  81488000
      ELSE                                                              81490000
         FORMSG (SCRATCH', SR'MESSAGE'SET, N, %133333,                  81492000
                 DUMMY, DUMMY, DUMMY, DUMMY, DUMMY, << = P1...P5>>      81494000
                 PTEXT, 132, LEN, -1, 0);                               81496000
                                                                        81498000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        81500000
      IF DEBUG'SENDMESSAGE THEN                                         81502000
         BEGIN                                                          81504000
         SAY "FORMSG...LEN=" ENDSAY; SAYNUM(LEN);                       81506000
         SEND;                                                          81508000
         SAY "  PTEXT=" ENDSAY;                                         81510000
         SAY PTEXT,(LEN) ENDSAY;                                        81512000
         SAY "//" ENDSAY;                                               81514000
         SEND;                                                          81516000
         END;                                                           81518000
$IF                           <<DEBUGGING CODE>>                        81520000
                                                                        81522000
      @PTEXT:=@PTEXT(LEN);                                              81524000
                                                                        81526000
      END <<APPEND'MSG SUB>>;                                           81528000
                                                                        81530000
   <<--------------------->>                                            81532000
   <<  APPEND'NUM         >>                                            81534000
   <<--------------------->>                                            81536000
                                                                        81538000
   SUBROUTINE APPEND'NUM (N); VALUE N; INTEGER N;                       81540000
                                                                        81542000
      BEGIN                                                             81544000
                                                                        81546000
      IF N < 0 THEN                                                     81548000
         APPEND1 ("-");                                                 81550000
                                                                        81552000
      @PTEXT:=@PTEXT+ASCII (\N\, 10, PTEXT);                            81554000
                                                                        81556000
      END <<APPEND'NUM SUB>>;                                           81558000
                                                                        81560000
   <<---------------->>                                                 81562000
   <<  APPEND'OCTAL  >>                                                 81564000
   <<---------------->>                                                 81566000
                                                                        81568000
   SUBROUTINE APPEND'OCTAL (N);                                         81570000
            VALUE           N;                                          81572000
            INTEGER         N;                                          81574000
                                                                        81576000
         <<results in:     "%123456"  placed in PTEXT >>                81578000
                                                                        81580000
      BEGIN                                                             81582000
                                                                        81584000
      PTEXT:="%";                                                       81586000
                                                                        81588000
      ASCII (N, 8, PTEXT(1));                                           81590000
                                                                        81592000
      @PTEXT:=@PTEXT(7);      << 1 for "%", 6 for octal >>              81594000
                                                                        81596000
      END <<APPEND'OCTAL SUB>>;                                         81598000
                                                                        81598100
   <<--------------------->>                                            81598200
   <<  APPEND'PATTERN     >>                                            81598300
   <<--------------------->>                                            81598400
                                                                        81598410
   SUBROUTINE APPEND'PATTERN (PAT);                                     81598500
         INTEGER ARRAY PAT;                                             81598600
                                                                        81598700
   BEGIN                                                                81598800
                                                                        81598900
   PAT'CHAR        := 0;                                                81599100
   PAT'INX         := 1;                                                81599200
   PAT'LEN         := 0;                                                81599300
   PAT'PARTS       := 0;                                                81599400
   PAT'WORD        := 0;                                                81599500
   PAT'TOTAL'LEN   := 0;                                                81599600
                                                                        81599610
   PAT'PARTS := PAT(0);                                                 81599700
                                                                        81599800
   WHILE (PAT'PARTS := PAT'PARTS - 1) >= 0 DO                           81599900
      BEGIN                                                             81600000
                                                                        81600100
      PAT'WORD := PAT (PAT'INX);                                        81600200
      PAT'LEN  := PAT'WORD.PATLENf;                                     81600300
      PAT'TOTAL'LEN := PAT'TOTAL'LEN + PAT'LEN;                         81600310
      PAT'CHAR := PAT'WORD.PATCHARf;                                    81600400
                                                                        81600500
      IF PAT'WORD.PATTYPEf = ANYCHARACTERSp THEN                        81600600
         LEN := 1;                                                      81600700
                                                                        81600800
      WHILE (PAT'LEN := PAT'LEN - 1) >= 0 DO                            81600900
         APPEND1 (PAT'CHAR);                                            81601000
                                                                        81601100
      PAT'INX := PAT'INX+1;                                             81601200
                                                                        81601300
      END;                                                              81601400
                                                                        81601410
   SPACE (FILE'PART'SIZE - PAT'TOTAL'LEN);                              81601420
                                                                        81601500
   END <<SAY'PATTERN PROC>>;                                            81601600
   <<------------------>>                                               81602000
   <<  APPEND'ADDRESS  >>                                               81604000
   <<------------------>>                                               81606000
                                                                        81608000
   SUBROUTINE APPEND'ADDRESS (LDEV, ADDR);                              81610000
            VALUE    LDEV, ADDR;                                        81612000
            INTEGER  LDEV;                                              81614000
            DOUBLE         ADDR;                                        81616000
      BEGIN                                                             81618000
                                                                        81620000
      APPEND'FMTI (DOUBLE(LDEV), 3, OCTAL, " ");                        81622000
      APPEND1 ("%");                                                    81624000
      APPEND'FMTI (ADDR, 8, OCTAL, "0");                                81626000
                                                                        81628000
      END <<APPEND'ADDRESS SUB>>;                                       81630000
                                                                        81632000
   <<------------------->>                                              81634000
   << APPEND'DATE'TIME  >>                                              81636000
   <<------------------->>                                              81638000
                                                                        81640000
   SUBROUTINE APPEND'DATE'TIME (YYDDD,HHMMSSTT);                        81642000
             VALUE YYDDD, HHMMSSTT;                                     81644000
             INTEGER YYDDD;                                             81646000
             DOUBLE HHMMSSTT;                                           81648000
      BEGIN                                                             81650000
      FMTDATE (YYDDD, HHMMSSTT, PTEXT);                                 81652000
      @PTEXT := @PTEXT(27);        <<Date formatted 27 bytes>>          81654000
      END;                                                              81656000
                                                                        81658000
                                                                        81660000
   <<------------------->>                                              81662000
   <<  APPEND'SECURITY  >>                                              81664000
   <<------------------->>                                              81666000
                                                                        81668000
   INTEGER SUBROUTINE APPEND'SECURITY (TYPE, BITS);                     81670000
            VALUE   TYPE, BITS;                                         81672000
            LOGICAL TYPE, BITS;                                         81674000
                                                                        81676000
         <<Returns the number of characters appended>>                  81678000
                                                                        81680000
      BEGIN                                                             81682000
                                                                        81684000
      @SAVE'PTEXT:=@PTEXT;                                              81686000
                                                                        81688000
      I:=-1;                                                            81690000
                                                                        81692000
      IF BITS = %(2)011111 OR BITS.(10:1) = 1 THEN                      81694000
         BITS:= %(2)100000;   <<bit 10 = ANY, 11..15=AC,AL,GU,GL,CR>>   81696000
                                                                        81698000
      WHILE (I:=I+1) <= 5 DO                                            81700000
         BEGIN                                                          81702000
         IF BITS.(10:1) = 1 THEN                                        81704000
            BEGIN                                                       81706000
            IF @SAVE'PTEXT = @PTEXT THEN                                81708000
               BEGIN                   <<true if first time thru>>      81710000
               IF LEN = 0 THEN                                          81712000
                  APPEND1 ("(")                                         81714000
               ELSE                                                     81716000
                  APPEND "; " ENDAPPEND;                                81718000
               APPEND1 (TYPE);                                          81720000
               APPEND1 (":");                                           81722000
               END;                                                     81724000
            APPEND FILE'SECURITY'BITS' (I*2),(2) ENDAPPEND;             81726000
            IF I = 0 THEN                                               81728000
               APPEND1 ("Y");    <<append the 'Y' of 'ANY'>>            81730000
                                                                        81732000
                  <<any more to come?...>>                              81734000
                                                                        81736000
            IF BITS <> %(2)100000 THEN                                  81738000
               APPEND1 (",");                                           81740000
            END;                                                        81742000
         BITS:=BITS.(11:5) & LSL(1); <<drop bit 10>>                    81744000
         END;                                                           81746000
                                                                        81748000
      APPEND'SECURITY:=LOGICAL(@PTEXT) -  LOGICAL(@SAVE'PTEXT);         81750000
                                                                        81752000
      END <<APPEND'SECURITY SUB>>;                                      81754000
                                                                        81756000
   <<--------------------->>                                            81758000
   <<  APPEND'TITLE       >>                                            81760000
   <<--------------------->>                                            81762000
                                                                        81764000
   SUBROUTINE APPEND'TITLE (PSTD, HOW);                                 81766000
         VALUE PSTD, HOW;                                               81768000
         BYTE POINTER PSTD;                                             81770000
         LOGICAL HOW;                                                   81772000
                                                                        81774000
      BEGIN                                                             81776000
                                                                        81778000
      IF HOW = FIXEDv THEN                                              81780000
         BEGIN      <<0123456789 123456789 12345>>                      81782000
         MOVE PTEXT:="        .        .        ";                      81784000
         IF RES'FILE' <> " " THEN                              <<LB.RS>>81785000
            MOVE PTEXT(0) := RES'FILE',  (FILE'PART'SIZE)      <<LB.RS>>81785500
         ELSE                                                  <<LB.RS>>81786000
            MOVE PTEXT(0) := STD'FILE',  (STD'FILE'LEN);       <<LB.RS>>81786500
                                                               <<LB.RS>>81787000
         IF RES'GROUP' <> " " THEN                             <<LB.RS>>81787500
            MOVE PTEXT(9) := RES'GROUP', (FILE'PART'SIZE)      <<LB.RS>>81788000
         ELSE                                                  <<LB.RS>>81788500
            MOVE PTEXT(9) := STD'GROUP', (STD'GROUP'LEN);      <<LB.RS>>81789000
                                                               <<LB.RS>>81789500
         IF RES'ACCT' <> " " THEN                              <<LB.RS>>81790000
            MOVE PTEXT(18) := RES'ACCT', (FILE'PART'SIZE)      <<LB.RS>>81790500
         ELSE                                                  <<LB.RS>>81791000
            MOVE PTEXT(18) := STD'ACCT', (STD'ACCT'LEN);       <<LB.RS>>81791500
         @PTEXT:=@PTEXT(26);                                            81792000
         END                                                            81794000
      ELSE                                                              81796000
         BEGIN                                                          81798000
         STANDARD'TO'DISPLAY (PSTD, PTEXT, I, LEN);                     81800000
         @PTEXT:=@PTEXT(LEN);                                           81802000
         END;                                                           81804000
                                                                        81806000
      END <<APPEND'TITLE SUB>>;                                         81808000
                                                                        81810000
   <<--------------->>                                                  81812000
   <<  APPEND'TYPE  >>                                                  81814000
   <<--------------->>                                                  81816000
                                                                        81818000
   SUBROUTINE APPEND'TYPE (FOPT);                                       81820000
         VALUE   FOPT;                                                  81822000
         INTEGER FOPT;                                                  81824000
      BEGIN                                                             81826000
                                                                        81828000
      APPEND1 (FO'FORMAT(FOPT.(08:02)));   <<F/V/U>>                    81830000
      APPEND1 (FO'BINARY'ASCII(FOPT.(13:01))); <<B/A>>                  81832000
                                                                        81834000
      IF FOPT.(07:01) = 1 THEN                                          81836000
         BEGIN                         <<CCTL>>                         81838000
         APPEND1 ("C");                                                 81840000
         APPEND1 (FO'FILEKIND(FOPT.(02:03)));  << /R/M/C>>              81842000
         END                                                            81844000
      ELSE                                                              81846000
         BEGIN                                                          81848000
         APPEND1 (FO'FILEKIND(FOPT.(02:03)));  << /R/M/C>>              81850000
         SPACE (1);                    <<NO CCTL>>                      81852000
         END;                                                           81854000
                                                                        81856000
      END <<APPEND'TYPE SUB>>;                                          81858000
                                                                        81860000
   <<--------------->>                                                  81862000
   <<  APPEND'DATE  >>                                                  81864000
   <<--------------->>                                                  81866000
                                                                        81868000
   SUBROUTINE APPEND'DATE (YYDDD);                                      81870000
            VALUE   YYDDD;                                              81872000
            LOGICAL YYDDD;                                              81874000
                                                                        81876000
         <<results in:  "mm/dd/yy" >>                                   81878000
                                                                        81880000
      BEGIN                                                             81882000
                                                                        81884000
      L1:=YYDDD.(0:7);        <<YEAR>>                                  81886000
      L2:=YYDDD.(7:9);        <<DAYS SINCE JAN 0, 19YY>>                81888000
                                                                        81890000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        81892000
      IF DEBUG'SENDMESSAGE THEN                                         81894000
         BEGIN                                                          81896000
         SAY "    DATE = " ENDSAY;                                      81898000
         SAYNUM (L1); SAY1 ("/"); SAYNUM (L2);                          81900000
         SAY "  = %" ENDSAY;                                            81902000
         SAYOCTAL (YYDDD);                                              81904000
         SEND;                                                          81906000
         END;                                                           81908000
$IF                           <<DEBUGGING CODE>>                        81910000
      IF L1 MOD 4 = 0 THEN                                     <<04752>>81912000
         MOVE DAYS'PER'MONTH := LEAP'MONTH'DAYS, (13)          <<04752>>81914000
      ELSE MOVE DAYS'PER'MONTH := REG'MONTH'DAYS, (13);        <<04752>>81916000
      I:=1;                   <<index into DAYS'PER'MONTH>>             81918000
      WHILE DAYS'PER'MONTH (I) < L2 AND I < 12 DO                       81920000
         I:=I+1;                                                        81922000
                                                                        81924000
            << I is month index  1..12>>                                81926000
                                                                        81928000
      APPEND'FMTI (DOUBLE(I), 2, 10, " ");                              81930000
      L2:=L2-DAYS'PER'MONTH(I-1);                                       81932000
      APPEND1 ("/");                                                    81934000
      APPEND'FMTI (DOUBLE(L2), 2, 10, "0");                             81936000
      APPEND1 ("/");                                                    81938000
      APPEND'FMTI (DOUBLE(L1), 2, 10, "0");                             81940000
                                                                        81942000
      END <<APPEND'DATE SUB>>;                                          81944000
                                                                        81946000
   <<--------------------->>                                            81948000
   <<  FIND'MSG'TEMPLATE  >>                                            81950000
   <<--------------------->>                                            81952000
                                                                        81954000
   SUBROUTINE FIND'MSG'TEMPLATE;                                        81956000
         <<looks for the message number MSGNO in the array              81958000
           MSG'CONTROL.  Each entry in the array is of the form:        81960000
              msgno (1 word), length (1 word), template ("length"       81962000
                                                         words)         81964000
           If the message number is found, MSG'PARTS is set to the      81966000
           number of parts for this message's template.                 81968000
           The template itself is copied into the array TEMPLATE.       81970000
                                                                        81972000
           If the message is not found, the array DEFAULT'TEMPLATE      81974000
           is used.      >>                                             81976000
      BEGIN                                                             81978000
                                                                        81980000
      INX:=0;                                                           81982000
                                                                        81984000
      DO                                                                81986000
         BEGIN                                                          81988000
         I:=MSG'CONTROL (INX);                                          81990000
         IF I = MSGNO OR I = 0 THEN                                     81992000
            BEGIN                                                       81994000
            INX:=INX+1;                                                 81996000
            MSG'PARTS:=MSG'CONTROL (INX);                               81998000
            MOVE TEMPLATE:=MSG'CONTROL (INX+1), (MSG'PARTS);            82000000
            RETURN;                                                     82002000
            END                                                         82004000
         ELSE                                                           82006000
            INX:=INX + MSG'CONTROL (INX+1) + 2;                         82008000
         END                                                            82010000
      UNTIL INX > 32765;                                                82012000
                                                                        82014000
      END <<FIND'MSG'TEMPLATE SUB>>;                                    82016000
                                                                        82018000
   <<-------------------------->>                                       82020000
   <<  INITIALIZE'SENDMESSAGE  >>                                       82022000
   <<-------------------------->>                                       82024000
                                                                        82026000
   SUBROUTINE INITIALIZE'SENDMESSAGE;                                   82028000
      BEGIN                                                             82030000
                                                                        82032000
      SENDMESSAGE:=GOOD;                                                82034000
                                                                        82036000
      INX:=0;                                                           82038000
      LEN:=0;                                                           82040000
      MSG'PARTS:=0;                                                     82042000
      PTYPE:=0;                                                         82044000
                                                                        82046000
      FILL (TEXT1, 67, 0);                                              82048000
      FILL (TEXT2, 67, 0);                                              82050000
                                                                        82052000
      IF \RECSIZE\ <= 99 THEN                                           82054000
         SHORT'LINE:=TRUE                                               82056000
      ELSE IF \RECSIZE\ >= 132 THEN                                     82058000
         BIG'LINE:=TRUE                                                 82060000
      ELSE                                                              82062000
         MEDIUM'LINE:=TRUE;                                             82064000
                                                                        82066000
      END <<INITIALIZE'SENDMESSAGE SUB>>;                               82068000
                                                                        82070000
   <<---------------------->>                                           82072000
   <<  INTERPRET'TEMPLATE  >>                                           82074000
   <<---------------------->>                                           82076000
                                                                        82078000
   SUBROUTINE INTERPRET'TEMPLATE;                                       82080000
                                                                        82082000
         <<This routine takes the template found in the array           82084000
           TEMPLATE and builds one or two lines of output text          82086000
           from it.                                                     82088000
           A blank is added to PTEXT at the end of every loop,          82090000
           unless the last phrase was a P'LINE2.              >>        82092000
                                                                        82094000
      BEGIN                                                             82096000
                                                                        82098000
      @PTEXT:=@TEXT1';      <<initially accumulate into TEXT1'>>        82100000
      INX:=-1;                                                          82102000
                                                                        82104000
      WHILE (INX:=INX+1) < MSG'PARTS DO                                 82106000
         BEGIN                                                          82108000
         PTYPE:=TEMPLATE(INX);                                          82110000
                                                                        82112000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        82114000
         IF DEBUG'SENDMESSAGE THEN                                      82116000
            BEGIN                                                       82118000
            SAY "INX=" ENDSAY;                                          82120000
            SAYNUM (INX);                                               82122000
            SAY ", PTYPE="ENDSAY; SAYNUM(PTYPE);                        82124000
            SAY ", @PTEXT=" ENDSAY; SAYOCTAL(@PTEXT);                   82126000
            SEND;                                                       82128000
            END;                                                        82130000
$IF                           <<DEBUGGING CODE>>                        82132000
                                                                        82134000
         IF 1 <= PTYPE <= P'MAX'P' THEN                                 82136000
            BEGIN                                                       82138000
                                                                        82140000
            CASE PTYPE - 1 OF                                           82142000
               BEGIN                                                    82144000
                                                                        82146000
            <<P'BAD'FILESIZE:>>                                         82148000
               BEGIN                                                    82150000
               APPEND "Bad filesize...D=" ENDAPPEND;                    82152000
               D:=FIND'FILE'SIZE (FILE'SIZE'MINv, SCRATCH'D);           82154000
               APPEND'FMTI (D, 7, 10, " ");                             82156000
               APPEND " sectors, err=" ENDAPPEND;                       82158000
               APPEND'NUM (I);                                          82160000
               END;                                                     82162000
                                                                        82164000
            <<P'CHANGED'CREATOR:>>                                      82166000
               BEGIN                                                    82168000
                  APPEND'MSG (MSG'CREATOR'CHANGED);                     82170000
                  APPEND " " ENDAPPEND;                                 82172000
                  APPEND FLUSERID',(8) ENDAPPEND;                       82174000
                  APPEND'MSG (MSG'TO);                                  82176000
                  APPEND " " ENDAPPEND;                        <<LB.RS>>82176100
                  APPEND RES'CREATOR', (8) ENDAPPEND;                   82178000
               END;                                                     82180000
                                                                        82182000
            <<P'DATE:>>                                                 82184000
               BEGIN                                                    82186000
                  APPEND'DATE'TIME (PARMS'TEMPI'2, PARMS'TEMPD'1);      82188000
               END;                                                     82190000
                                                                        82192000
            <<P'DATE'RANGE:>>                                           82194000
               BEGIN                                                    82196000
               IF MSGNO=M'ADATE'NOT'IN'RANGE THEN              <<04760>>82198000
                  L3 := FLLASTACC                              <<04760>>82200000
               ELSE IF MSGNO=M'CDATE'NOT'IN'RANGE THEN         <<04760>>82202000
                  L3 := FLCREATE                               <<04760>>82204000
               ELSE IF MSGNO=M'MDATE'NOT'IN'RANGE THEN         <<04760>>82206000
                  L3 := FLLASTMOD;                             <<04760>>82208000
                                                               <<04760>>82210000
               SPACE (1);                                      <<04760>>82212000
               APPEND'DATE (L3);                               <<04760>>82214000
               END;                                                     82216000
                                                                        82218000
            <<P'DATELINE:>>                                             82220000
               BEGIN                                                    82222000
               DATE'LINE (SCRATCH');                                    82224000
               APPEND SCRATCH',(27) ENDAPPEND;                          82226000
               END;                                                     82228000
                                                                        82230000
            <<P'DIREC:>>                                                82232000
               BEGIN                                                    82234000
                  LOC'LEV := PARMS'TEMPI'1;                             82236000
                  APPEND'MSG (MSG'USER'SPECIFIED);                      82238000
                  APPEND " " ENDAPPEND;                                 82240000
                                                                        82242000
                  IF SEEN'ACCT THEN                                     82244000
                     BEGIN                                              82246000
                        APPEND'MSG (MSG'ACCT);                          82248000
                        APPEND " = " ENDAPPEND;                         82250000
                        APPEND RES'ACCT',(8) ENDAPPEND;                 82252000
                        APPEND "; " ENDAPPEND;                          82254000
                     END;                                               82256000
                                                                        82258000
                  IF LOC'LEV = ACCTLEVEL THEN                           82260000
                     BEGIN                                              82262000
                        NEXTLINE (0);                                   82264000
                        APPEND'MSG (MSG'ACCT);                          82266000
                     END                                                82268000
                  ELSE IF LOC'LEV = GROUPLEVEL THEN                     82270000
                     BEGIN                                              82272000
                        APPEND'MSG (MSG'GROUP);                         82274000
                        APPEND " = " ENDAPPEND;                         82276000
                        APPEND RES'GROUP', (8) ENDAPPEND;               82278000
                     END                                                82280000
                  ELSE                                                  82282000
                     BEGIN                                              82284000
                        APPEND'MSG (MSG'CREATOR);                       82286000
                        APPEND " = " ENDAPPEND;                         82288000
                        APPEND RES'CREATOR', (8) ENDAPPEND;             82290000
                     END;                                               82292000
                                                                        82294000
                  IF NOT SEEN'ACCT THEN                                 82296000
                     BEGIN                                              82298000
                        APPEND "; " ENDAPPEND;                          82300000
                        APPEND'MSG (MSG'LOGON'ACCT'ASSUMED);            82302000
                     END;                                               82304000
                                                                        82306000
                  IF LOC'LEV <> ACCTLEVEL THEN                          82308000
                     BEGIN                                              82310000
                        NEXTLINE (0);                                   82312000
                        APPEND'MSG (MSG'ACCT'EXISTS);                   82314000
                        APPEND ";  " ENDAPPEND;                         82316000
                        IF LOC'LEV = GROUPLEVEL THEN                    82318000
                           APPEND'MSG (MSG'GROUP)                       82320000
                        ELSE                                            82322000
                           APPEND'MSG (MSG'CREATOR);                    82324000
                     END;                                               82326000
                                                                        82328000
               END;                                                     82330000
            <<P'DISK'ERR: >>                                            82332000
               BEGIN                                                    82334000
               APPEND'MSG (MSG'ADDRESS);     <<"LDEV/ADDRESS=">>        82336000
               APPEND'ADDRESS (PARMS'TEMPI'1, PARMS'TEMPD'1);           82338000
               APPEND ", " ENDAPPEND;                                   82340000
               APPEND'MSG (MSG'SECTORS);     <<"#SECTORS=">>            82342000
               APPEND'NUM (PARMS'TEMPI'2);   <<#sectors>>               82344000
               APPEND ", " ENDAPPEND;                                   82346000
               APPEND'MSG (MSG'ERROR);       <<"ERROR=">>               82348000
                     <<IOB...word1...>>                                 82350000
               APPEND'OCTAL (PARMS'TEMPD'2'1);                          82352000
               APPEND1 ("/");                                           82354000
                     <<IOB...word 2...>>                                82356000
               APPEND'OCTAL (PARMS'TEMPD'2'2);                          82358000
               END;                                                     82360000
                                                                        82362000
            <<P'DOUBLE'1: >>                                            82364000
               BEGIN                                                    82366000
               APPEND'FMTI (PROCTIME - START'CPU'TIME, 15, 10, " ");    82368000
               END;                                                     82370000
                                                                        82372000
            <<P'DOUBLE'2: >>                                            82374000
               BEGIN                                                    82376000
               APPEND'FMTI (TIMER - START'CLOCK'TIME, 15, 10, " ");     82378000
               END;                                                     82380000
                                                               <<LB.RS>>82380100
            <<P'ERRNUM: >>                                     <<LB.RS>>82380200
               BEGIN                                           <<LB.RS>>82380300
               APPEND'NUM (PARMS'TEMPD'2'2);                   <<LB.RS>>82380400
               APPEND "/" ENDAPPEND;                           <<LB.RS>>82380500
               APPEND'NUM (PARMS'TEMPD'2'1);                   <<LB.RS>>82380600
               END;                                            <<LB.RS>>82380700
                                                               <<LB.RS>>82380800
            <<P'FCHECK: >>                                              82382000
            BEGIN                                                       82384000
            END;                                                        82386000
                                                                        82388000
            <<P'FILECODE'RANGE:>>                                       82390000
               BEGIN                                                    82392000
               APPEND'FILECODE (FLFILECODE, FLFOPTIONS);                82394000
               SPACE (1);                                               82396000
               APPEND'MSG (MSG'NOT'IN'RANGE);                           82398000
               SPACE (1);                                               82400000
               APPEND'FILECODE (FILECODE'LOW, 0);                       82402000
               APPEND1 ("/");                                           82404000
               APPEND'FILECODE (FILECODE'HIGH, 0);                      82406000
               END;                                                     82408000
                                                                        82410000
            <<P'FLAB'ADDRESS: >>                                        82412000
               BEGIN                                                    82414000
               APPEND'MSG (MSG'FLAB'ADDRESS'MISMATCH);                  82416000
               NEXTLINE (0);                                            82418000
               APPEND'MSG (MSG'LABEL'ADDRESS);                          82420000
               APPEND'ADDRESS (PARMS'TEMPI'1, PARMS'TEMPD'1);           82422000
               APPEND ", " ENDAPPEND;                                   82424000
               APPEND'MSG (MSG'FIRST'EXTENT);                           82426000
               APPEND'ADDRESS (PARMS'TEMPI'2, PARMS'TEMPD'2);           82428000
               END;                                                     82430000
                                                                        82432000
            <<P'FLAB'CHECKSUM: >>                                       82434000
               BEGIN                                                    82436000
               APPEND'MSG (MSG'FLAB'CHECKSUM);                          82438000
               NEXTLINE (0);                                            82440000
               APPEND'MSG (MSG'CHECKSUM'COMPUTED);                      82442000
               APPEND'OCTAL (PARMS'TEMPI'1);                            82444000
               SPACE (2);                                               82446000
               APPEND'MSG (MSG'CHECKSUM'FOUND);                         82448000
               APPEND'OCTAL (PARMS'TEMPI'2);                            82450000
               END;                                                     82452000
                                                                        82454000
            <<P'FLAB'READ:>>                                            82456000
               BEGIN                                                    82458000
               APPEND'MSG (MSG'LABEL'READ'FAIL);                        82460000
               NEXTLINE (0);                                            82462000
               APPEND'MSG (MSG'ADDRESS);                                82464000
               APPEND'ADDRESS (PARMS'TEMPI'1, PARMS'TEMPD'1);           82466000
               END;                                                     82468000
                                                                        82470000
            <<P'FLAB'TITLE:>>                                           82472000
               BEGIN                                                    82474000
               APPEND'MSG (MSG'FLAB'TITLE);                             82476000
               NEXTLINE (0);                                            82478000
               APPEND'MSG (MSG'FOUND);    <<"FOUND:">>                  82480000
               APPEND FLAB', (FILE'PART'SIZE) ENDAPPEND;                82482000
               APPEND1 (".");                                           82484000
               APPEND FLAB'(8), (FILE'PART'SIZE) ENDAPPEND;             82486000
               APPEND1 (".");                                           82488000
               APPEND FLAB'(16), (FILE'PART'SIZE) ENDAPPEND;            82490000
               END;                                                     82492000
                                                                        82494000
            <<P'FLAB'WRITE:>>                                           82496000
               BEGIN                                                    82498000
               APPEND'MSG (MSG'LABEL'WRITE'FAIL);                       82500000
               NEXTLINE (0);                                            82502000
               APPEND'MSG (MSG'ADDRESS);                                82504000
               APPEND'ADDRESS (PARMS'TEMPI'1, PARMS'TEMPD'1);           82506000
               END;                                                     82508000
                                                                        82510000
            <<P'HEADING: >>                                             82512000
               BEGIN                                                    82514000
               APPEND'MSG (MSG'HEADING1);                               82516000
                                                                        82518000
               IF SHOWSHORTFLAG THEN                                    82520000
                  BEGIN                                                 82522000
                  IF SHOW'DATES'FLAG THEN                               82524000
                     BEGIN                                              82526000
                     IF SHORT'line THEN                                 82528000
                        NEXTLINE (7);                                   82530000
                     SPACE (2);                                         82532000
                     APPEND'MSG (MSG'DATEHEADING);                      82534000
                     END;                                               82536000
                  END                                                   82538000
                                                                        82540000
               ELSE           <<not SHOWSHORTFLAG...>>                  82542000
                  BEGIN                                                 82544000
                  IF SHORT'line THEN                                    82546000
                     NEXTLINE (8);                                      82548000
                  SPACE (3);                                            82550000
                  APPEND'MSG (MSG'HEADING2);                            82552000
                  IF SHOW'DATES'FLAG THEN                               82554000
                     BEGIN                                              82556000
                     IF MEDIUM'line THEN                                82558000
                        NEXTLINE (7);                                   82560000
                     SPACE (2);                                         82562000
                     APPEND'MSG (MSG'DATEHEADING);                      82564000
                     END;                                               82566000
                  END;                                                  82568000
               END;                                                     82570000
                                                                        82572000
            <<P'INDENT9:>>                                              82574000
               SPACE (9);                                               82576000
                                                                        82578000
            <<P'INFO:>>                                                 82580000
               BEGIN                                                    82582000
               APPEND'TITLE (CURR'TITLE', FIXEDv);                      82584000
                                                                        82586000
                     << LDEV ADDRESS >>                                 82588000
                                                                        82590000
               SPACE (2);                                               82592000
               APPEND'ADDRESS (FILE'LDEV, FILE'ADDRESS);                82594000
                                                                        82596000
                     << REEL >>                                         82598000
                                                                        82600000
               APPEND'FMTI (DOUBLE(TAPE'REEL), 5, 10, " ");             82602000
                                                                        82604000
                     << SECTORS >>                                      82606000
                                                                        82608000
                     <<calculate # sectors required by                  82610000
                       file when it is on disk...      >>               82612000
                                                                        82614000
               D:=FIND'FILE'SIZE (FILE'SIZE'MAXv, SCRATCH'D);           82616000
               APPEND'FMTI (D, 9, 10, " ");                             82618000
                                                                        82620000
               SPACE (1);                                               82622000
                                                                        82624000
                     << CODE >>                                         82626000
                                                                        82628000
               APPEND'FILECODE (FLFILECODE, FLFOPTIONS);                82630000
                                                                        82632000
                     <<see if we want other info...>>                   82634000
                                                                        82636000
               IF NOT SHOWSHORTFLAG THEN                                82638000
                  BEGIN                                                 82640000
                                                                        82642000
                  IF SHORT'line THEN                                    82644000
                     NEXTLINE (8);                                      82646000
                                                                        82648000
                        << SIZE >>                                      82650000
                                                                        82652000
                  IF FLFOPTIONS.(13:01) = 1 THEN   <<ASCII>>            82654000
                     BEGIN                                              82656000
                     APPEND'FMTI (DOUBLE(\FLRECSIZE\), 6, 10, " ");     82658000
                     APPEND1 ("B");                                     82660000
                     END                                                82662000
                  ELSE                             <<BINARY>>           82664000
                     BEGIN                                              82666000
                     APPEND'FMTI (DOUBLE(\FLRECSIZE\/2),                82668000
                                  6, 10, " ");                          82670000
                     APPEND1 ("W");                                     82672000
                     END;                                               82674000
                                                                        82676000
                  SPACE (1);                                            82678000
                                                                        82680000
                        << TYP >>                                       82682000
                                                                        82684000
                  APPEND'TYPE (FLFOPTIONS);                             82686000
                                                                        82688000
                        << EOF >>                                       82690000
                                                                        82692000
                  APPEND'FMTI (FLEOF, 8, 10, " ");                      82694000
                                                                        82696000
                        << LIMIT >>                                     82698000
                                                                        82700000
                  APPEND'FMTI (FLFLIM, 9, 10, " ");                     82702000
                                                                        82704000
                        << R/B >>                                       82706000
                                                                        82708000
                  D:=DOUBLE(FIND'BLOCK'FACTOR (I));                     82710000
                  IF I <> 0 THEN                                        82712000
                     SPACE (4)                                          82714000
                  ELSE                                                  82716000
                     APPEND'FMTI (D, 4, 10, " ");                       82718000
                                                                        82720000
                        << #X/MX >>                                     82722000
                                                                        82724000
                        <<count number of in-use extents...>>           82726000
                  DUMMY:=0;                                             82728000
                  FOR I:=0 STEP 1 UNTIL FLNUMEXTS DO                    82730000
                     IF FLAB'D(I + 22) <> 0D THEN                       82732000
                        DUMMY:=DUMMY+1;                                 82734000
                  APPEND'FMTI (DOUBLE(DUMMY), 3, 10, " ");              82736000
                           <<  "/"  >>                                  82738000
                  APPEND1 ("/");                                        82740000
                           <<maximum number of extents...>>             82742000
                  APPEND'FMTI (DOUBLE(FLNUMEXTS+1), 2, 10, "0");        82744000
                                                                        82746000
                  END;                                                  82748000
                                                                        82750000
               IF SHOW'DATES'FLAG THEN                                  82752000
                  BEGIN                                                 82754000
                  IF SHOWSHORTFLAG THEN                                 82756000
                     IF SHORT'line THEN                                 82758000
                        NEXTLINE (8)                                    82760000
                     ELSE                                               82762000
                  ELSE IF MEDIUM'line THEN                              82764000
                     NEXTLINE (8);                                      82766000
                                                                        82768000
                        << CREATED >>                                   82770000
                                                                        82772000
                  SPACE (1);                                            82774000
                  APPEND'DATE (FLCREATE);                               82776000
                                                                        82778000
                        << ACCESSED >>                                  82780000
                                                                        82782000
                  SPACE (1);                                            82784000
                  APPEND'DATE (FLLASTACC);                              82786000
                                                                        82788000
                        << MODIFIED >>                                  82790000
                                                                        82792000
                  SPACE (1);                                            82794000
                  APPEND'DATE (FLLASTMOD);                              82796000
                                                                        82798000
                  END;                                                  82800000
               END;                                                     82802000
                                                                        82804000
            <<P'LEVEL:>>                                                82806000
               BEGIN                                                    82808000
                  IF PARMS'TEMPI'1 = GROUPLEVEL THEN                    82810000
                     BEGIN                                              82812000
                        APPEND'MSG(MSG'GROUP);                          82814000
                        APPEND " " ENDAPPEND;                           82816000
                        APPEND RES'GROUP',(8) ENDAPPEND;                82818000
                     END                                                82820000
                  ELSE IF PARMS'TEMPI'1 = USERLEVEL THEN                82822000
                     BEGIN                                              82824000
                        APPEND'MSG(MSG'CREATOR);                        82826000
                        APPEND " " ENDAPPEND;                           82828000
                        APPEND RES'CREATOR',(8) ENDAPPEND;              82830000
                     END;                                               82832000
                                                                        82834000
                  IF PARMS'TEMPI'1 <> ACCTLEVEL THEN                    82836000
                     BEGIN                                              82838000
                        APPEND " " ENDAPPEND;                           82840000
                        APPEND'MSG(MSG'IN);                             82842000
                        APPEND " " ENDAPPEND;                           82844000
                     END;                                               82846000
                                                                        82848000
                                                                        82850000
                  APPEND'MSG(MSG'ACCT);                                 82852000
                  APPEND " " ENDAPPEND;                                 82854000
                  APPEND RES'ACCT',(8) ENDAPPEND;                       82856000
               END;                                                     82858000
                                                                        82860000
            <<P'LINE2:>>                                                82862000
               NEXTLINE (0);                                            82864000
                                                                        82866000
            <<P'MNUM>>                                         <<06312>>82866100
               BEGIN                                           <<06312>>82866200
               APPEND "(S/R " ENDAPPEND;                       <<06312>>82866300
               APPEND'NUM (MSGNO);                             <<06312>>82866400
               APPEND1 (")");                                  <<06312>>82866500
               END;                                            <<06312>>82866600
            <<P'NOT'TITLE:>>                                            82868000
               APPEND'TITLE (NOT'TITLE', FIXEDv);                       82870000
            <<P'NOT'PURGED>>                                            82870100
               BEGIN                                                    82870200
               APPEND'TITLE (CURR'TITLE', FIXEDv);                      82870300
               APPEND'MSG (MSG'NOT'PURGED);                             82870400
               APPEND'FSERR (PARMS'TEMPI'1);                            82870500
               END;                                                     82870600
                                                                        82872000
            <<P'NSR:>>                                                  82874000
               BEGIN                                                    82876000
               APPEND'TITLE (CURR'TITLE', FIXEDv);                      82878000
               SPACE (1);                                               82880000
               IF STORING THEN                                          82882000
                  APPEND'MSG (MSG'NOT'STORED)                           82884000
               ELSE                                                     82886000
                  APPEND'MSG (MSG'NOT'RESTORED);                        82888000
               END;                                                     82890000
                                                                        82892000
            <<P'NUM:>>                                                  82894000
               BEGIN                                                    82896000
               APPEND'NUM (PARMS'TEMPI'1);                              82898000
               END;                                                     82900000
                                                                        82902000
            <<P'OPEN'FAIL:>>                                            82904000
               BEGIN                                                    82906000
               APPEND'MSG (MSG'OPEN'FAIL);                              82908000
                                                                        82910000
               SPACE (1);                                               82912000
                                                                        82914000
               @P:=PARMS'TEMPI'1;                                       82916000
               IF (I:=\PARMS'TEMPI'2\) > 132 THEN                       82918000
                  I:=132;                                               82920000
               APPEND P,(I) ENDAPPEND;                                  82922000
                                                                        82924000
               IF FID > 0 THEN                                          82926000
                  GENMSG (IO'MESSAGE'SET, ERROR'CODE,                   82928000
                          %133333, <<p1>>, <<p2>>, <<p3>>,              82930000
                          <<p4>>, <<p5>>, -FID);                        82932000
               END;                                                     82934000
                                                                        82936000
            <<P'PATTERN>>                                               82936100
               BEGIN                                                    82936200
               APPEND'PATTERN (LOOK'FILE'PAT);                          82936300
               APPEND1 (".");                                           82936400
               APPEND'PATTERN (LOOK'GROUP'PAT);                         82936500
               APPEND1 (".");                                           82936600
               APPEND'PATTERN (LOOK'ACCT'PAT);                          82936700
               SPACE (1);                                               82936800
               END;                                                     82936900
            <<P'RESTORE'P:>>                                            82938000
               BEGIN                                                    82940000
               APPEND'MSG (MSG'WILL'RESTORE);                           82942000
               SPACE (1);                                               82944000
               APPEND'FMTI (FILES'SELECTED, 6, 10, " ");                82946000
               SPACE (1);                                               82948000
               APPEND'MSG (MSG'FILES'ON'TAPE);                          82950000
               SPACE (1);                                               82952000
               APPEND'FMTI (FILES'ON'TAPE+1D, 6, 10, " ");              82954000
               END;                                                     82956000
                                                                        82958000
            <<P'SECURITY:>>                                             82960000
               BEGIN                                                    82962000
               APPEND FLUSERID',(8) ENDAPPEND;                          82964000
               SPACE (1);                                               82966000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        82968000
               IF DEBUG'SENDMESSAGE THEN                                82970000
                  BEGIN                                                 82972000
                  APPEND1 ("%");                                        82974000
                  APPEND'FMTI (FLSECMX, 11, OCTAL, "0");                82976000
                  SPACE (1);                                            82978000
                  END;                                                  82980000
$IF                           <<DEBUGGING CODE>>                        82982000
               LEN:=0;        <<length of security "text">>             82984000
                              <<APPEND'SECURITY examines LEN>>          82986000
               LEN:=LEN + APPEND'SECURITY ("R", FLSECMX1.(02:6));       82988000
               ASSURE'ROOM (18);                                        82990000
               LEN:=LEN + APPEND'SECURITY ("A", FLSECMX1.(08:6));       82992000
               ASSURE'ROOM (18);                                        82994000
               LEN:=LEN + APPEND'SECURITY ("W",                         82996000
                                            0 CAT FLSECMX1 (10:14:2)    82998000
                                              CAT FLSECMX2 (12:00:4));  83000000
               ASSURE'ROOM (18);                                        83002000
               LEN:=LEN + APPEND'SECURITY ("L", FLSECMX2.(04:6));       83004000
               ASSURE'ROOM (18);                                        83006000
               LEN:=LEN + APPEND'SECURITY ("X", FLSECMX2.(10:6));       83008000
               IF LEN > 0 THEN                                          83010000
                  APPEND1 (")");                                        83012000
                                                                        83014000
               IF FLSECURE = 0 THEN                                     83016000
                  BEGIN                                                 83018000
                  ASSURE'ROOM (8);                                      83020000
                  SPACE (1);                                            83022000
                  APPEND'MSG (MSG'RELEASED);                            83024000
                  END;                                                  83026000
               END;                                                     83028000
                                                                        83030000
            <<P'SUMMARY:>>                                              83032000
               BEGIN                                                    83034000
               IF RESTORING THEN                                        83036000
                  APPEND'MSG (MSG'FILES'RESTORED)                       83038000
               ELSE                                                     83040000
                  APPEND'MSG (MSG'FILES'STORED);                        83042000
               APPEND'FMTI (GOOD'FILE'COUNT, 11, 10, " ");              83044000
                                                                        83046000
               IF FAILED'FILE'COUNT > 0D THEN                           83048000
                  BEGIN                                                 83050000
                  APPEND1 (",");                                        83052000
                  SPACE (6);                                            83054000
                  IF RESTORING THEN                                     83056000
                     APPEND'MSG (MSG'FAILED'RESTORE'FILES)              83058000
                  ELSE                                                  83060000
                     APPEND'MSG (MSG'FAILED'STORE'FILES);               83062000
                  APPEND'FMTI (FAILED'FILE'COUNT, 6, 10, " ");          83064000
                  END;                                                  83066000
                                                                        83068000
               NEXTLINE (0);                                            83070000
                                                                        83072000
               IF RESTORING THEN                                        83074000
                  BEGIN                                                 83076000
                  APPEND'MSG (MSG'FILES'NOT'RESTORED);                  83078000
                  APPEND'FMTI (BAD'FILE'COUNT, 7, 10, " ");             83080000
                  END                                                   83082000
               ELSE                                                     83084000
                  BEGIN                                                 83086000
                  APPEND'MSG (MSG'FILES'NOT'STORED);                    83088000
                  APPEND'FMTI (FILES'REJECTED, 7, 10, " ");             83090000
                  END;                                                  83092000
               END;                                                     83094000
                                                                        83096000
            <<P'TEXT:>>                                                 83098000
               BEGIN                                                    83100000
               @P:=PARMS'TEMPI'1;                                       83102000
               IF (I:=\PARMS'TEMPI'2\) > 132 THEN                       83104000
                  I:=132;                                               83106000
               APPEND P, (I) ENDAPPEND;                                 83108000
               END;                                                     83110000
                                                                        83112000
            <<P'TITLE:>>                                                83114000
               APPEND'TITLE (CURR'TITLE', FIXEDv);                      83116000
                                                                        83118000
            <<P'UNKNOWN:>>                                              83120000
               BEGIN                                                    83122000
               APPEND "Cannot interpret message # " ENDAPPEND;          83124000
               APPEND'NUM (MSGNO);                                      83126000
               END;                                                     83128000
                                                                        83130000
               END;                                                     83132000
            END                                                         83134000
                                                                        83136000
         ELSE IF PTYPE >= 1000 THEN                                     83138000
            APPEND'MSG (PTYPE)                                          83140000
                                                                        83142000
         ELSE                                                           83144000
            BEGIN                                                       83146000
            APPEND "IN MSG#" ENDAPPEND;                                 83148000
            APPEND'NUM (MSGNO);                                         83150000
            APPEND " UNKNOWN PTYPE#" ENDAPPEND;                         83152000
            APPEND'NUM(PTYPE);                                          83154000
            APPEND " AT INX=" ENDAPPEND;                                83156000
            APPEND'NUM(INX);                                            83158000
            END;                                                        83160000
                                                                        83162000
         IF PTYPE <> P'LINE2 THEN                                       83164000
            SPACE (1);                                                  83166000
                                                                        83168000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        83170000
         IF DEBUG'SENDMESSAGE THEN                                      83172000
            BEGIN                                                       83174000
            SAY "@PTEXT NOW " ENDSAY;                                   83176000
            SAYOCTAL (@PTEXT);                                          83178000
            SEND;                                                       83180000
            SAY "  PTEXT=" ENDSAY;                                      83182000
            SAY TEXT1',(70) ENDSAY;                                     83184000
            SEND;                                                       83186000
            END;                                                        83188000
$IF                           <<DEBUGGING CODE>>                        83190000
                                                                        83192000
                                                                        83194000
         END;                                                           83196000
                                                                        83198000
      END <<INTERPRET'TEMPLATE SUB>>;                                   83200000
   <<-------------------------------->>                                 83202000
   IF NOT PMASK.(12:1) OR MSGNO = 0 THEN RETURN;               <<LB.RS>>83204000
   IF NOT PMASK.(13:1) THEN SEND'NO'CRLF := FALSE;             <<LB.RS>>83206000
   IF NOT PMASK.(14:1) THEN TELL'TO'OP := FALSE;               <<LB.RS>>83208000
   PUT'IN'STRING := PMASK.(15:1);                              <<LB.RS>>83208100
                                                                        83210000
         <<..sigh...disable arithmetic traps cuz this                   83212000
           procedure might call GENMSG/FORMSG, which                    83214000
           rather dumbly depends on traps being off instead             83216000
           of turning them off itself...>>                              83218000
                                                                        83220000
   DISABLE'ARITHMETIC'TRAPS;                                            83222000
                                                                        83224000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        83226000
   IF DEBUGGING THEN                                                    83228000
      BEGIN                                                             83230000
      SAY "SENDMESSAGE (" ENDSAY; SAYNUM (MSGNO); SAY1 (")");           83232000
      SEND;                                                             83234000
      END;                                                              83236000
$IF                           <<DEBUGGING CODE>>                        83238000
                                                                        83240000
         <<assure ourselves that we can talk to $STDLIST if             83242000
           this routine is called before SYSLIST has been               83244000
           opened...>>                                                  83246000
                                                                        83248000
   IF (SYSLISTNUM:=SYSLIST'NUM) = 0 THEN                                83250000
      SYSLISTNUM:=STDLIST'NUM;                                          83252000
                                                                        83254000
IF MSGNO >= 10000 THEN                                                  83256000
   BEGIN                                                                83258000
      MOVE TEXT1' := "*** ERROR *** RESTORE # ";                        83260000
      ASCII(MSGNO,10,TEXT1(12) );                                       83262000
      PRINT(TEXT1,-29,0);                                               83264000
      ENABLE'ARITHMETIC'TRAPS;                                          83266000
      RETURN;                                                           83268000
   END;                                                                 83270000
   IF MSGNO >= FIRST'REAL'MSG THEN                                      83272000
      BEGIN                                                             83274000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        83276000
      IF DEBUG'SENDMESSAGE THEN                                         83278000
         BEGIN                                                          83280000
         SAY "REAL MSG!" ENDSAY;                                        83282000
         SEND;                                                          83284000
         END;                                                           83286000
$IF                           <<DEBUGGING CODE>>                        83288000
                                                                        83290000
            <<prevent multiple 'BREAK' messages...>>                    83292000
                                                                        83294000
      IF MSGNO = SR'BREAK'SENSED THEN                                   83296000
         IF BREAK'MSG'SEEN THEN                                         83298000
            BEGIN                                                       83300000
               ENABLE'ARITHMETIC'TRAPS;                                 83302000
               RETURN;                                                  83304000
            END                                                         83306000
         ELSE                                                           83308000
            BREAK'MSG'SEEN:=TRUE;                                       83310000
                                                                        83312000
            <<send the message from the STORE catalog (if               83314000
              open, otherwise from the system catalog...>>              83316000
      IF TELL'TO'OP THEN                                                83318000
         BEGIN                                                          83320000
            IF STORE'CATALOG > 0 THEN                                   83322000
               BEGIN                                                    83324000
                  LEN := GENMESSAGE (STORE'CATALOG, SR'MESSAGE'SET,     83326000
                                     MSGNO, SCRATCH, 132, %011333,      83328000
                                     PARMS'TEMPI'1, PARMS'TEMPI'2,      83330000
                                     <<parm3>>,<<parm4>>,<<parm5>>);    83332000
                  SCRATCH' (LEN) := 0;                                  83334000
                  GENMSG (-1 <<in string>>, @SCRATCH', %133333,         83336000
                          <<parm1>>,<<parm2>>,<<parm3>>,<<parm4>>,      83338000
                          <<parm5>>, 0 <<operator>>);                   83340000
               END                                                      83342000
            ELSE                                                        83344000
               BEGIN                                                    83346000
                  GENMSG (SR'MESSAGE'SET, MSGNO, %011333,               83348000
                          PARMS'TEMPI'1, PARMS'TEMPI'2,                 83350000
                          <<parm3>>, <<parm4>>, <<parm5>>,              83352000
                          0 <<operator>> );                             83354000
               END;                                                     83356000
                                                                        83358000
         END                                                            83360000
      ELSE IF PUT'IN'STRING THEN                               <<LB.RS>>83360100
         BEGIN                                                 <<LB.RS>>83360200
         IF STORE'CATALOG > 0 THEN                             <<LB.RS>>83360300
            BEGIN                                              <<LB.RS>>83360400
            LEN := GENMESSAGE (STORE'CATALOG, SR'MESSAGE'SET,  <<LB.RS>>83360500
                               MSGNO, STRING, 132, %011333,    <<LB.RS>>83360600
                               PARMS'TEMPI'1, PARMS'TEMPI'2,   <<LB.RS>>83360700
                               <<parm3>>,<<parm4>>,<<parm5>>); <<LB.RS>>83360800
            STRING (LEN) := 0;                                 <<LB.RS>>83360900
            END                                                <<LB.RS>>83361000
         ELSE                                                  <<LB.RS>>83361100
            BEGIN                                              <<LB.RS>>83361200
            TEXT1' := 0;                                       <<LB.RS>>83361210
            FORMSG (TEXT1',SR'MESSAGE'SET, MSGNO, %011333,     <<LB.RS>>83361300
                    PARMS'TEMPI'1, PARMS'TEMPI'2,              <<LB.RS>>83361400
                    0, 0, 0,                                   <<LB.RS>>83361500
                    STRING, 72, LEN, -1, 0);                   <<LB.RS>>83361600
            STRING (LEN) := 0;                                 <<LB.RS>>83361700
            END;                                               <<LB.RS>>83361900
         END                                                   <<LB.RS>>83361920
                                                                        83362000
      ELSE IF STORE'CATALOG > 0 THEN                                    83364000
         BEGIN                                                          83366000
                                                                        83368000
         IF SYSLISTNUM <> 0 THEN                                        83370000
            GENMESSAGE (STORE'CATALOG, SR'MESSAGE'SET, MSGNO,           83372000
                        <<buf>>,  <<bufsize>>, %133333,                 83374000
                        SYSLISTNUM);                                    83376000
                                                                        83378000
         IF OFFLINE'NUM <> 0 THEN                                       83380000
            GENMESSAGE (STORE'CATALOG, SR'MESSAGE'SET, MSGNO,           83382000
                        <<buf>>, <<bufsize>>, %133333,                  83384000
                        PARMS'TEMPI'1, PARMS'TEMPI'2,                   83386000
                        <<parm3>>, <<parm4>>, <<parm5>>,                83388000
                        OFFLINE'NUM);                                   83390000
         END                                                            83392000
                                                                        83394000
      ELSE                                                              83396000
         BEGIN                                                          83398000
                                                                        83400000
         IF SYSLISTNUM <> 0 THEN                                        83402000
            GENMSG (SR'MESSAGE'SET, MSGNO,                              83404000
                    %011333,                                   <<LB.RS>>83406000
                    PARMS'TEMPI'1, PARMS'TEMPI'2,                       83408000
                    <<parm3>>, <<parm4>>, <<parm5>>,                    83410000
                    -SYSLISTNUM);                                       83412000
                                                                        83414000
         IF OFFLINE'NUM <> 0 THEN                                       83416000
            GENMSG (SR'MESSAGE'SET, MSGNO,                              83418000
                    %011333,                                   <<LB.RS>>83420000
                    PARMS'TEMPI'1, PARMS'TEMPI'2,                       83422000
                    <<parm3>>, <<parm4>>, <<parm5>>,                    83424000
                    -OFFLINE'NUM);                                      83426000
         END;                                                           83428000
      ENABLE'ARITHMETIC'TRAPS;                                          83430000
      RETURN;                                                           83432000
      END;                                                              83434000
                                                                        83436000
   IF NOT SHOW'FLAG THEN                                                83438000
      IF MSGNO = M'STORED  OR  MSGNO = M'RESTORED THEN                  83440000
         BEGIN                                                          83442000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        83444000
         IF DEBUGGING THEN                                              83446000
            BEGIN                                                       83448000
            SAY "NOT SHOW'FLAG...DON'T SEND MSG# " ENDSAY;              83450000
            SAYNUM(MSGNO);                                              83452000
            SEND;                                                       83454000
            END;                                                        83456000
$IF                           <<DEBUGGING CODE>>                        83458000
         ENABLE'ARITHMETIC'TRAPS;                                       83460000
         RETURN;                                                        83462000
         END;                                                           83464000
                                                                        83466000
         <<go thru the following code 1 or 2 times, depending           83468000
           upon: if OFFLINE exists and is not the same size             83470000
           as SYSLIST, do code twice (once per file) otherwise          83472000
           do the code only one. >>                                     83474000
                                                                        83476000
   FID:=SYSLISTNUM;                                                     83478000
   SIZE'FLAGS:=0;                                                       83480000
   RECSIZE:=SYSLIST'RECSIZE;                                            83482000
   SHOWSHORTFLAG:=SHOW'SHORT'FLAG;   <<changed for OFFLINE later>>      83484000
                                                                        83486000
   LOOPS:=1;                                                            83488000
                                                                        83490000
   IF OFFLINE'NUM <> 0 THEN                                             83492000
      LOOPS:=2;                                                         83494000
                                                                        83496000
   WHILE (LOOPS:=LOOPS-1) >= 0 DO                                       83498000
      BEGIN                                                             83500000
                                                                        83502000
      INITIALIZE'SENDMESSAGE;                                           83504000
                                                                        83506000
$IF X1=ON THEN                <<DEBUGGING CODE>>                        83508000
      IF DEBUG'SENDMESSAGE THEN                                         83510000
         BEGIN                                                          83512000
         SAY "   LOOPS = " ENDSAY; SAYNUM (LOOPS);                      83514000
         SAY ", FID=" ENDSAY; SAYNUM (FID);                             83516000
         SAY ", RECSIZE=" ENDSAY; SAYNUM (RECSIZE);                     83518000
         IF SHORT'line THEN SAY " SHORT" ENDSAY;                        83520000
         IF MEDIUM'line THEN SAY " MEDIUM" ENDSAY;                      83522000
         IF BIG'line THEN SAY " BIG" ENDSAY;                            83524000
         IF SHOWSHORTFLAG THEN                                          83526000
            SAY " (SHOWSHORT)" ENDSAY;                                  83528000
         SEND;                                                          83530000
         END;                                                           83532000
$IF                           <<DEBUGGING CODE>>                        83534000
                                                                        83536000
      FIND'MSG'TEMPLATE;                                                83538000
                                                                        83540000
      INTERPRET'TEMPLATE;                                               83542000
                                                                        83544000
      WRITE'MSG (FID);                                                  83546000
                                                                        83548000
      FID:=OFFLINE'NUM;                                                 83550000
      RECSIZE:=OFFLINE'RECSIZE;                                         83552000
      SIZE'FLAGS:=0;                                                    83554000
      SHOWSHORTFLAG:=FALSE;  <<OFFLINE is never SHORT>>                 83556000
                                                                        83558000
      END;                                                              83560000
                                                                        83562000
ENABLE'ARITHMETIC'TRAPS;                                                83564000
   END <<SENDMESSAGE PROC>>;                                            83566000
$PAGE "TRUE OUTER BLOCK"                                                90000000
$CONTROL SEGMENT=MAIN                                                   90002000
   IF SIZE'OF'LPDT'ENTRY <> LPDT'ENTRY'SIZE THEN               <<LB.RS>>90002100
      QUIT (1);                                                <<LB.RS>>90002300
                                                                        90004000
IF INFO'LENGTH < 0 THEN                                                 90006000
   INFO'LENGTH := 0;                                                    90008000
                                                                        90010000
OUTER'BLOCK (PARM, INFO'LENGTH, INFO'ADDRESS);                          90012000
                                                                        90014000
END.                                                                    90016000
