<< LINES .001/.009 ARE RESERVED FOR SYSTEMS INTEGRATION>>               00000001
$EDIT VOID=00028000                                                     00028000
$EDIT VOID=00086000                                                     00082000
      filled (FILLBUFFERS).  This procedure also checks the last        00600000
      the location of the FCB is unknown.  The FILLBUFFERS call is      00612000
$PAGE "PROLOGUE.  DISC AND BUFFER NOTES."                               00936100
Disc and Buffer Notes                                                   00936200
---------------------                                                   00936300
                                                                        00936400
10/1/85 -Lars                                                           00936500
                                                                        00936600
First, item 5a under Design Highlights is now wrong, and may            00936700
have always been wrong.  All disc I/O is "no wait" I/O.                 00936800
                                                                        00936900
Except for IPC files that contain less than one full block, all         00937000
reads are done from a read buffer, and all writes are done to a         00937100
write buffer.  If a user asks for less than 2 buffers, he is given      00937200
2 anyway (see procedure SETACB in Module 50/FileAccess).                00937300
                                                                        00937400
Coupled Mode                                                            00937500
                                                                        00937600
In coupled mode, there are as many or more buffers as blocks in         00937700
the file, so that the file is contained completely in memory.           00937800
                                                                        00937900
When a block is completely read, the list of buffer pointers is         00938000
rotated so that the second buffer becomes the first, and the first      00938100
buffer becomes the last buffer.  Readers will continue to use the       00938200
first buffer pointer (now pointing to what was the second buffer).      00938300
The write buffer index is decremented by one, so that it will point     00938400
to the same buffer as it did before the rotate.                         00938500
                                                                        00938600
When a block is filled by a writer, and it is not the first block,      00938700
the write to disc is started.  If it is the first block, it will        00938800
be kept around in a buffer until it is read or forced to disc (by       00938900
an FCLOSE or FCONTROL 6).  If there is another unused buffer avail-     00939000
able, it will be the next used.  If all buffers are now in use,         00939100
uncoupled mode is entered.                                              00939200
                                                                        00939300
Uncoupled Mode                                                          00939400
                                                                        00939500
In uncoupled mode there are more blocks than buffers.  Some of the      00939600
IPC file resides only on disc, and the read and write buffer pools      00939700
are managed separately.                                                 00939800
                                                                        00939900
User output data is always transferred into the buffer pointed          00940000
to by the last (right most) buffer pointer.  When the block is          00940100
filled, the disc I/O is started, the buffer pointers are rotated        00940200
1 to the left (first becomes last), and any I/O pending on the          00940300
new last buffer is finished.                                            00940400
                                                                        00940500
Read buffers have a similar management scheme BUT the number of         00940600
read buffers is "hard coded" to ONE (procedure FCINITACB), so           00940700
that the rotate becomes a no-op.                                        00940800
                                                                        00940900
Procedures Performing Disc I/O                                          00941000
                                                                        00941100
Fillbuffers                                                             00941200
-called from the first read or write to the file.                       00941300
-subroutine Readisc starts I/O then finishes it.                        00941400
-no-op if empty file.                                                   00941500
-if coupled mode, read in entire file, last buffers may be unused.      00941600
-if uncoupled mode, first block is read into first buffer, last n       00941700
 blocks read into write buffers.                                        00941800
                                                                        00941900
Indexrecord                                                             00942000
-called from the read path                                              00942100
-calls subroutine Indexblock if a new block is needed.                  00942200
-finishes any output on new block, if pending.                          00942300
-if coupled mode, rotate all buffers to bring in next block.            00942400
-if uncoupled mode, start read, do "no-op" rotate, finish I/O if        00942500
 user did a read w/ wait.                                               00942600
                                                                        00942700
Putrecord                                                               00942800
-called from write path.                                                00942900
-subroutine Indexblock called if new block is needed.                   00943000
-start write I/O if not already started.                                00943100
-if coupled mode, use the next buffer.                                  00943200
-if uncoupled mode, rotate buffers and finish I/O (see above).          00943300
-after data move, if buffer is completely filled, start I/O.            00943400
                                                                        00943500
Writeof                                                                 00943600
-called from close and fcontrol 6.                                      00943700
-nothing done if copy mode or buffers never filled.                     00943800
-if read/first buffer partially read, then remove read records          00943900
 and start write I/O.                                                   00944000
-if write I/O pending on the last write buffer, finish it.              00944100
-set EOF flag in the last buffer and start write I/O.                   00944200
-loop through all buffers:                                              00944300
   -if buffer was updated but I/O never started, start and finish       00944400
    I/O (only possible on first buffer, if it was written and           00944500
    never read).                                                        00944600
   -if I/O pending, finish it.                                          00944700
                                                                        00944800
$PAGE "PROLOGUE.  FILE STRUCTURES."                                     00945600
File Structure                                                          00945700
--------------                                                          00945800
                                                                        00945900
: C:LC:EU:    :  Header Type: 0                                         01130000
C (0:1)  - Cash: Set on if this was the last record written             01140000
           before the system crashed.  This bit is set on by            01142000
           the first open on the file after the crash.                  01144000
LC (1:1) - Last Close: Valid only for close headers.  Set to            01148000
           one if this is the last writer to close the file.            01150000
                                                                        01150100
EU (2:1) - EOF Updated: Set in the last record (open, close, or         01150200
           data) written before the file label EOF was updated.         01150300
           The file label EOF is updated when either readers or         01150400
           writers do an FCLOSE or FCONTROL 6.  If there is a           01150500
           crash before a 'Last Close' record can be written,           01150600
           this is where the file label says the EOF is, and            01150700
           this is where writing will resume.  Records that             01150800
           followed this one were not included in the file label        01150900
           EOF and will be ignored (as per the rest of the file         01151000
           system).                                                     01151100
    z                                                  z       <<02237>>01234000
    ....................................................       <<02237>>01236000
$EDIT VOID=01237000                                            <<02237>>01236001
 26 : FCB control block vector - DST                   : 32             01286000
 27 : FCB control block vector - Offset                : 33             01290000
 28 : Total number of accessors (number of lacb's)     : 34             01294000
 29 : Status                                           : 35             01298000
 30 : Ldev                                             : 36             01302000
 31 :          :Wrt buf indx:              : # buf - 1 : 37             01306000
 34 : Spare                                            : 42             01316100
    ....................................................                01316200
 35 : FMAVT Index                                      : 43             01316300
    ....................................................                01316400
 36 : Number of readers                                : 44             01316500
    ....................................................                01316600
 37 : Name Type             : File Disposition         : 45             01316700
    ....................................................                01316800
 38 : Access Mask           : Records per block        : 46             01318000
 39 : Spare                 : State flags              : 47             01322000
 40 :0:# rd buf  : # wt buf   :er :qw :wm :rm :d :s :f : 50    <<02237>>01326000
 41 : Number of free words in the current free record  : 51             01329000
    ....................................................                01329100
 42 : Number of max sized free records                 : 52             01330000
    ..................               ...................                01332000
 43 :                                                  : 53             01334000
$EDIT VOID=01340000                                                     01338000
$EDIT VOID=01344000                                                     01342000
    ..................               ...................                01348000
 46 : Address of the next write record                 : 56    <<02237>>01354000
 47 : Pending Opens       : Pending Reads              : 57             01358000
 48 : Last read error     : Last write error           : 60             01362000
 49 : Head record's record type                        : 61    <<02237>>01366000
 50 : Head record's writer ID                          : 62    <<02237>>01370000
 51 : Head record's header type and flags              : 63    <<02237>>01374000
 52 : Pacb Address         / Writer ID map (PACB only) : 64    <<02237>>01378000
 53 : Lacb Address         / (16 words long)           : 65    <<02237>>01382000
 54 : Acb Address                                      : 66             01386000
 55 : Caller's Db Offset                               : 67    <<02237>>01390000
 56 : Caller's Db DST number                           : 70    <<02237>>01394000
    ................                         ...........                01415000
 62 :                                                  : 76             01416000
    ................                         ...........                01417000
 63 :                                                  : 77             01418000
 66 :jo:ex:nd:vr:bt:im:i :w : Carriage control         : 102*  <<02163>>01432000
 69 : Nowait writer record buffer Address              : 105*           01444000
 70 : Nowait writer record buffer DST                  : 106*           01448000
 71 : Nowait writer record buffer Entry                : 107*           01451000
    ....................................................                01451100
 72 : No wait I/O Completion Message - Error code      : 110*  <<02237>>01452000
 73 : No wait I/O Completion Message - Transfer length : 111*  <<02237>>01456000
 74 : No wait I/O FREAD Target DST                     : 112*  <<02237>>01460000
 75 : No wait I/O FREAD Target Address                 : 113*  <<02237>>01464000
 76 : Write wait queue (basic IPC port)                : 114   <<02237>>01468000
 77 : Read wait queue (basic IPC port)                 : 115   <<02237>>01472000
 78 : Max size record plus its overhead (words)        : 116   <<02237>>01476000
 79 : Head record's length (bytes)                     : 117   <<02237>>01480000
 80 : Wait Message - Waiter's writer Id, 0 if reader   : 120   <<02237>>01484000
 81 : Wait Message - Local flags                       : 121   <<02237>>01488000
    ..................               ...................                01490000
 82 : Wait Message - Target DST (waiting writers only) : 122   <<02237>>01492000
    ..................               ...................                01494000
 83 : Wait Message - Target (waiting writers only)     : 123   <<02237>>01496000
    ..................               ...................                01498000
 84 : Wait Message - Transfer length                   : 124   <<02237>>01500000
    ....................................................       <<02237>>01502000
 85 : Wait Message - Reply port, 0 if using ACB        : 125   <<02237>>01504000
 86 : Wait Message - Waiter's Process Id Number        : 126   <<02237>>01508000
    ..................               ...................       <<02237>>01510000
$EDIT VOID=01518000                                                     01512000
 87 : Wait Message - File number                       : 127   <<02237>>01520000
    ..................               ...................       <<02237>>01522000
 88 : Wait Message - Soft interrupt plabel             : 130   <<02237>>01524000
 89 : Reply Message - Error code                       : 131   <<02237>>01528000
    ..................               ...................       <<02237>>01530000
 90 : Reply Message - Transfer length                  : 132   <<02237>>01530100
    ..................               ...................                01530200
 91 : Reply Message - Completion writer's Id           : 133   <<02237>>01530300
    ..................               ...................       <<02237>>01530400
 92 : DST rel address of buffer one                    : 134   <<02237>>01532000
 93 : DST rel address of buffer two                    : 135   <<02237>>01536000
 94 : Etc.                                             : 136   <<02237>>01540000
40                                                                      01558000
       (11:1)  wm 1 - Wait message is in the ACB.              <<02237>>01566000
       (12:1)  rm 1 - Reply message is in the ACB.             <<02237>>01568000
66             Accessor's local flags.                                  01578000
       (0:1)   jo 1 - have not yet issued an FREAD/FWRITE against       01580000
       (5:1)   im 0 - Priv and user mode code can be soft interrupted.  01596000
                  1 - Only user mode code can be soft interrupted.      01598000
       (6:1)   i  1 -  No wait I/O finished at initiation      <<02237>>01600000
                       time.  Completion message is in ACB.    <<02237>>01601000
       (7:1)   w  1 -  Extended Wait disabled, but    <<04139>><<02237>>01602000
                       file was just opened.          <<04139>><<02237>>01604000
$EDIT VOID=01642000                                                     01614000
     end of file, and the (writers) ID.                                 01720000
$EDIT VOID=01790000                                            <<02237>>01780000
  Q14=Q+14,Q15=Q+15,Q16=Q+16,Q17=Q+17,Q18=Q+18,                <<02237>>01826000
  QM7=Q-7,QM13=Q-13,QM14=Q-14,QM15=Q-15,QM16=Q-16,             <<02237>>01828000
  QM17=Q-17,QM20=Q-20,QM22=Q-22,QM23=Q-23,                     <<06736>>01830000
  QM27=Q-27,                                                   <<06736>>01831000
  QM55=Q-55,QM62=Q-62,QM63=Q-63;                               <<06736>>01840000
  LQ3=Q+3,LQ15=Q+15,LQ16=Q+16,LQ18=Q+18,                       <<02237>>01844000
  LQM12=Q-12,LQM23=Q-23,LQM24=Q-24,LQM56=Q-56,LQM57=Q-57;      <<02237>>01846000
  DQM3=Q-3,DQM2=Q-2,DQM1=Q-0,DQ0=Q-0,QDM47=Q-47,QD7=Q+7;       <<06736>>01850000
INTEGER POINTER SYSGLOBEXT=%377;                               <<06736>>01891000
$include inclpcb5                                              <<06736>>01943000
$edit void=01982000                                            <<06736>>01944000
$EDIT VOID=01988000                                            <<02237>>01984000
$edit void=02126000                                            <<06736>>01992000
$EDIT VOID=02126000                                            <<06736>>01992001
                                                               <<06736>>02127000
$INCLUDE INCLFLAB                                              <<06736>>02127010
<<* * * ADDITIONAL FLAB DEFINES * * *>>                        <<06736>>02127100
                                                               <<06736>>02127200
define                                                         <<06736>>02127300
  FlNumOpenClsRecs = FlHdRecs#;                                <<06736>>02127400
                                                               <<06736>>02127500
define                                                         <<06736>>02127600
  FLABSTRUCTURE =                                              <<06736>>02127700
              INTEGER ARRAY FLAB(0:127);                       <<06736>>02127800
              DOUBLE POINTER FLABDBL=FLAB#;                    <<06736>>02127900
                                                               <<06736>>02127910
                                                               <<06736>>02127920
define                                                         <<m1277>>02186000
HDCrash        =Header.(0:1)#, <<Last record before a crash.>> <<m1277>>02188000
HDLastClose    =Header.(1:1)#, <<Last writer's close record.>> <<m1277>>02192000
last'close'bit =(1:1)#,                                        <<m1277>>02192500
HDEofUpdated   =Header.(2:1)#, <<Last record included in EOF.>><<m1277>>02193000
eof'updated'bit=(2:1)#,  <<Reader & Writer,FClose & FCntrl 6.>><<m1277>>02193500
HDType         =Header.(8:8)#, <<Data, Open, Close, or Xport.>><<m1277>>02194000
rec'type       =(8:8)#,                                        <<m1277>>02195000
MsgExtendWait  =lmsg1.(1:1)#,   <<Wait on boundary condition >><<02237>>02258000
                                <<if no symbiotic process.   >><<02237>>02260000
MsgVirgin      =lmsg1.(3:1)#,   <<writer has not written>>     <<02237>>02262000
MsgJustOpenWD  =lmsg1.(7:1)#,   << JustOpenDisabled flag >>    <<01018>>02265000
MsgRErrorCode  =msg#,           <<Resultant error code>>       <<02237>>02278000
MsgRTlog       =msg(1)#;        <<Resultant transmission log>> <<02237>>02280000
                                                               <<02237>>02282000
                                                               <<02237>>02284000
                                                               <<02237>>02286000
$include inclpxfl                                              <<06736>>02407000
wake'on'port   = 0,     <<for PORTs>>                          <<02060>>02419000
wake'user'int  = 1,     <<for PORTs>>                          <<02060>>02420000
user'int       = 0,     <<for CAUSESOFTINT>>                   <<02060>>02421000
file'soft'int  = 1,     <<for PORTs and CAUSESOFTINT>>         <<02060>>02422000
$EDIT VOID=02448000                                            <<06736>>02448000
$EDIT VOID=02456000                                            <<06736>>02452000
sizeACB         = 52,                                          <<06736>>02502000
lacb'only'size  = 16,                                          <<01903>>02504000
pacb'only'size  = sizeACB-lacb'only'size,                      <<01903>>02506000
pacbx'loc       = 76,                                          <<02237>>02508000
pacbx'size      = 16,                                          <<02237>>02510000
pointers'size   = 5, <<Pacb,Lacb,Acb Addrs,Db Offset,Db DST>>  <<02237>>02512000
lacbx'size      = 12,                                          <<02237>>02518000
stack'data'size = 7,<<procedure params (3) + stack marker (4)>><<02237>>02521000
acb'msg'size    = 12,<<IPC part of stndrd acb,from AbMsgStart>><<02237>>02523000
acb'buf'size    = sizeACB + pointers'size + stack'data'size +  <<02237>>02524000
                  lacbx'size + pacbx'size + max'buf,           <<02237>>02525000
pacbIDloc       = 52,                                          <<m8451>>02526000
pacb'msg'size   = acb'msg'size + pointers'size +               <<02237>>02530000
                  stack'data'size + lacbx'size + pacbx'size;   <<02237>>02531000
AbPacbDst      =Acb(-5)#,       <<DST num of physical ACB>>    <<06736>>02565100
AbPacbCbTabAddr=Acb(-4)#,       <<Pacb control blk vec tab addr<<06736>>02565200
AbLacbDst      =Acb(-3)#,       <<DST num of logigal ACB>>     <<06736>>02565300
AbFNum         =Acb(1)#,        <<File number>>                <<06736>>02568000
$EDIT VOID=02604000                                            <<02237>>02590000
$edit void=02630000                                                     02630000
AbFcbDST       =Acb(26)#,       <<FCB DST number>>             <<06736>>02632000
AbFcbCBTabAddr =Acb(27)#,       <<Vector tab offset>>          <<06736>>02634000
AbFcbVector    =Acbd(13)#,      <<complete CB vector>>         <<06736>>02635000
$EDIT VOID=02640000                                            <<06736>>02638000
AbShCnt        =Acb(28)#,       <<# of LAcb(s>>                         02642000
AbDAddr        =Acb(30)#,       <<Logical device number>>      <<06736>>02666100
                                                               <<06736>>02666200
$edit void=02682000                                            <<06736>>02667000
AbFree4        =Acb(34)#,       <<Spare>>                               02700000
AbShCntIn      =Acb(36)#,       << # read LACB's   >>          <<06736>>02704000
AbBlkFact      =Acb(38).(8:8)#, <<Records per block>>          <<06736>>02716000
                                                               <<06736>>02717100
AbMstW         =Acb(39)#,       <<global state flags>>         <<06736>>02717200
AbNoWaitEOF    =ACb(39).(8:1)#, <<EOF advanced?>>              <<06736>>02717300
AbNoWaitMode   =Acb(39).(9:1)#, <<last I/O:0=read,1=write>>    <<06736>>02717400
AbAbortRead    =Acb(39).(10:1)#,<<Abort broken re-read?>>      <<06736>>02717500
AbNewEOF       =Acb(39).(11:1)#,<<EOF advanced - tape file>>   <<06736>>02717600
AbSaveEOFs     =Acb(39).(12:2)#,<<For saving abeofs>>          <<06736>>02717700
AbEOFs         =Acb(39).(14:2)#,<<EOF flags - :EOD/:>>         <<06736>>02717800
AbMsgStart     =Acb(40)#,                                      <<06736>>02724000
AbZero         =acb(40).(0:1)#, <<Must be zero (spoolfile)>>   <<06736>>02730000
AbNumReadBuf   =acb(40).(1:4)#, <<Number of read buffers>>     <<06736>>02732000
AbNumWriteBuf  =acb(40).(5:4)#, <<Number of write buffers>>    <<06736>>02734000
AbExtendRead   =Lacb(40).(9:1)#,<<Read open/close records>>    <<06736>>02736000
AbWaitWriters  =Lacb(40).(10:1)#,<<Queued writer requests>>    <<06736>>02738000
AbAcbWaitMsg   =Lacb(40).(11:1)#,<<1 - ACB wait msg>> <<06736>><<02237>>02740000
AbAcbReplyMsg  =Lacb(40).(12:1)#,<<1 - ACB reply msg>><<06736>><<02237>>02742000
AbDirtyBlock   =Lacb(40).(13:1)#,<<1, the current write          cb.01  02744000
AbNonZeroOrigin=Lacb(40).(14:1)#,<<0 -start file=block zero>>  <<06736>>02750000
AbBufFilled    =Lacb(40).(15:1)#,<<0 -buffers not been filled>><<06736>>02752000
AbBufNotFilled =(not Lacb(40))#,                               <<06736>>02754000
AbFreeWords    =Acb(41)#,       <<Num of available words in  >><<06736>>02760000
                                <<current record including   >><<06736>>02762000
                                <<record overhead            >><<06736>>02763000
AbFreeRecords  =Acbd(21)#,      <<Number of free records>>     <<06736>>02764000
AbFreeRecLSW   =Acb(43)#,       <<lst significant of free rec>><<06736>>02766000
AbNumOpenClsRec=Acbd(22)#,      <<# of non data records >>     <<06736>>02768000
AbWriteAddr    =Acb(46)#,       <<DST rel addr of   >><<06736>><<02237>>02772000
                                <<next write record.>><<06736>><<02237>>02774000
AbNumPendOpens =Acb(47).(0:8)#, <<#of open records w/o closes>><<06736>>02776000
AbNumReadsPend =Acb(47).(8:8)#, <<# of outstanding read reqs     cb.01  02780000
AbReadError    =Acb(48).(0:8)#, <<Last read access error>>     <<06736>>02790000
AbWriteError   =Acb(48).(8:8)#, <<Last write access error>>    <<06736>>02792000
                                                               <<02237>>02793000
<<Head Record Descriptors - needs to remain in this order>>    <<02237>>02793100
AbHeader       =Acb(49)#,       <<Header type: data,opn,cls>>  <<02237>>02793200
AbHeaderId     =Acb(50)#,       <<Record's writer ID>>         <<02237>>02793300
AbHeaderType   =Acb(51).(8:8)#, <<Bits (0:8) contain flags>>   <<02237>>02793400
AbIDMap        =Acb(52)#,       <<ID map (only in PACB)>>      <<06736>>02796000
$edit void=02804000                                            <<06736>>02804000
AbPacbAddr     =Acb(52)#,       <<DST rel addr of PACB>>       <<06736>>02806000
$edit void=02808000                                            <<06736>>02808000
AbLacbAddr     =Acb(53)#,       <<DST rel addr of logical ACB>><<06736>>02810000
AbAcbAddr      =Acb(54)#,       <<DST rel addr of stack ACB>>  <<06736>>02812000
AbDbOffset     =Acb(55)#,       <<Stack DST rel addr of DB>>   <<06736>>02814000
$edit void=02820000                                            <<06736>>02816000
AbCallerDbDST  =Acb(56)#,       <<Caller's Db DST # >>         <<02237>>02822000
                                                               <<02237>>02846000
AbSoftIntMode  =Lacb(66).(5:1)#,<<Soft Interrupt mode       >> <<02163>>02872000
                                <<0 -Can interrupt priv mode>> <<02163>>02874000
                                <<1 -Can only interrupt user>> <<02163>>02876000
                                <<   mode code.             >> <<02163>>02878000
AbAcbComplMsg  =Lacb(66).(6:1)#,<<Compltn msg in LACB>>        <<02237>>02880000
AbJustOpenedWaitDisabled                                                02880500
               =Lacb(66).(7:1)#,<< Wait disabled    >>                  02881000
                                << but just opened. >>                  02881500
AbWriteCBAddr  =Acb(69)#,       <<DST addr of writer rec buf>>          02889000
AbWriteCB      =Acbd(35)#,      <<CB vect for writer rec buf>>          02890000
AbWriteCBDST   =Acb(70)#,       <<DST # for writer's rec buf>>          02892000
                                                               <<02237>>02894000
<<No wait/soft interrupt return status.  Used when the >>      <<02237>>02896000
<<completion occurs at initiation time.                >>      <<02237>>02898000
AbCmplError    =Acb(72)#,       <<Resultant error code>>       <<02237>>02900000
AbCmplTlog     =Acb(73)#,       <<Resultant transmission log>> <<02237>>02902000
                                                               <<02237>>02904000
<<FREAD Target param, used when Target omitted from IOWAIT.>>  <<02237>>02906000
AbFreadDST     =Acb(74)#,       <<DST of user's Target array>> <<02237>>02908000
AbFreadTarget  =Acb(75)#,       <<Address of Target array   >> <<02237>>02910000
AbPacbExtension=Acb(76)#,       <<Start of PACB extension>>    <<02237>>02918000
AbWriteQueue   =Acb(76)#,       <<Port # of write queue.>>     <<02237>>02920000
AbReadQueue    =Acb(77)#,       <<Port # of read queue.>>      <<02237>>02922000
$EDIT VOID=02958000                                            <<02237>>02924000
AbFullRecSizew =Acb(78)#,       <<Size of rec + count +header>><<02237>>02960000
AbRecLengthb   =Acb(79)#,       <<Length of record in bytes>>  <<02237>>02962000
                                                               <<02237>>02972000
AbMWaitMsg     =Acb(80)#,                                      <<02237>>02974000
AbMID          =Acb(80)#,       <<Waiter's writer ID>>         <<02237>>02976000
AbMLocalFlags  =Acb(81)#,       <<Flags - see AbLocalFlags>>   <<02237>>02978000
AbMExtendWait  =Lacb(81).(1:1)#,                               <<02237>>02980000
AbMSoftIntMode =Acb(81).(5:1)#,                       <<02163>><<02237>>02981000
AbMDST         =Acb(82)#,       <<Target DST number>>          <<02237>>02982000
AbMTarget      =Acb(83)#,       <<DST rel addr of target area>><<02237>>02984000
AbMLength      =Acb(84)#,       <<Length of target area>>      <<02237>>02986000
AbMReplyPort   =Acb(85)#,       <<Waiter's reply port, 0 if  >><<02237>>02988000
                                <<using ACB completion area. >><<02237>>02990000
AbMPin         =Acb(86)#,       <<Waiting process's pin>>      <<02237>>02992000
AbMFNum        =Acb(87)#,       <<Waiter's file number>>       <<02237>>02994000
AbMSoftIntPlabel=Acb(88)#,      <<Waiter's soft intrpt plabel>><<02237>>02996000
AbRError       =Acb(89)#,       <<Resultant error code>>       <<02237>>03002000
AbRTlog        =Acb(90)#,       <<Resultant transmission log>> <<02237>>03004000
AbRID          =Acb(91)#,       <<ID of original waiter>>      <<02237>>03006000
AbFirstBuf     =Acb(92)#,       <<DST rel addr of 1st buffer>> <<02237>>03012000
AbSecondBuf    =Acb(93)#;       <<DST rel addr of 2nd buffer>> <<02237>>03014000
AaFNum         =qm62#,        <<File number>>                  <<06736>>03030000
$EDIT                                                          <<06736>>03052000
AaShCnt        =qm35#,        <<# of Opens>>                   <<06736>>03054000
$EDIT VOID=03058000                                            <<06736>>03056000
AaShCntIn      =qm27#,        <<# of Read Opens>>              <<06736>>03063000
AaExtendRead   =lqm23.(9:1)#, <<Read open/close records>>      <<06736>>03064000
AaWaitWriters  =lqm23.(10:1)#,<<Queued writer requests>>       <<06736>>03066000
AaBufNotFilled =(not lqm23)#,                                  <<06736>>03068000
AaFreeRecLSW   =qm20#,        <<Lst sig word of free records>> <<06736>>03072000
                                                               <<06736>>03073000
AaNumReaders   =AaShCntIn#,   <<Number of open readers>>       <<06736>>03073200
AaNumWriters   =(AaShCnt-AaShCntIn)#,                          <<06736>>03073300
AaNumReadsPend =qm16.(8:8)#,  <<# of outstanding read reqs       cb.01  03076000
AaReadError    =qm15.(0:8)#,  <<Last read access error>>       <<06736>>03086000
AaWriteError   =qm15.(8:8)#,  <<Last write access error>>      <<06736>>03088000
AaHeader       =qm14#,        <<Record type: data,opn,cls>>    <<02237>>03091000
AaHeaderId     =qm13#,        <<Record's writer ID>>           <<02237>>03092000
AaHeaderCrash  =lqm12.(0:1)#, <<SystemCrash before last close>><<02237>>03093000
AaCallerDbDST  =qm7#,         <<Caller's DB DST #>>            <<02237>>03094000
AaSoftIntMode  =lq3.(5:1)#,   <<Interrupt mode: 0-priv,1-user>><<02163>>03115000
AaWriteCBAddr  =q6#,          <<DST addr of writers rec buf>>  <<06736>>03127000
AaWriteCb      =qd7#,         <<CB vector for writers rec buf>><<06736>>03128000
AaWriteCBDST   =q7#,          <<DST # for writer's rec buf>>            03130000
                                                               <<02237>>03132000
AaFreadDST     =q11#,                                          <<02237>>03134000
AaFreadTarget  =q12#,                                          <<02237>>03136000
                                                               <<02237>>03138000
AaWriteQueue   =q13#,         <<Port # of write queue.>>       <<02237>>03140000
AaReadQueue    =q14#,         <<Port # of read queue.>>        <<02237>>03142000
                                                               <<02237>>03144000
AaRecLengthb   =q16#;                                          <<02237>>03146000
                                                               <<02237>>03148000
$EDIT VOID=03158000                                            <<02237>>03150000
AcLacbDST      =Aq0(AcbLoc-3)#,                                <<06736>>03163000
AcFcbDST       =aq0(AcbLoc+26)#,                               <<06736>>03174000
AcFcbCBTabAddr =(aq0(AcbLoc+27))#,                             <<06736>>03176000
AcExtendRead   =(Aq0(AcbLoc+40).(9:1)=1)#,                     <<06736>>03178000
$EDIT                                                          <<06736>>03184000
AcLacbAddr     =Aq0(AcbLoc+53)#;                               <<06736>>03186000
soft'plabel'loc=16;             <<Used by FCGETINFO to index into LACB>>03192000
LxSoftIntMode  =Lacbx(2).(5:1)#,<<Soft Interrupt Mode        >><<02163>>03218000
                                <<0 -Can interrupt priv mode.>><<02163>>03220000
                                <<1 -Can only interrupt user >><<02163>>03222000
                                <<   mode code.              >><<02163>>03224000
LxWriteCBAddr  =Lacbx(5)#,       <<DST rel address of writer's rec buf>>03234000
LxWriteCBDST   =Lacbx(6)#,       << Writer's rec buf DST number.    >>  03236000
LxWriteCBEntry =Lacbx(7)#,       << Other half of WriteCB vector.   >>  03238000
LxComplError   =Lacbx(8)#,       <<Nowait IO completion error code>>    03240000
LxComplTlog    =Lacbx(9)#,       <<Nowait IO completion lngth>><<02237>>03241000
LxFreadDST     =Lacbx(10)#,      <<DST of user's FREAD target>><<02237>>03242000
LxFreadTarget  =Lacbx(11)#;      <<Address of user's target  >><<02237>>03243000
$include inclfcb                                               <<06736>>03345000
$edit void=03374000                                            <<06736>>03360000
FCBNUMOPENCLSRECS = FCBHDRECS#;   <<Num of non data records>>  <<06736>>03394000
$edit void=03488000                                            <<06736>>03395000
$EDIT VOID=03496000                                            <<02237>>03492000
integer cb,strategy,size,type;                                 <<06736>>03710000
double vector;                                                 <<06736>>03711000
double vector;                                                 <<06736>>03720000
$EDIT VOID=03760000                                            <<06736>>03752000
procedure LOCK'CB(flags,stackdst,stk'target,cbvector);         <<06736>>03824000
value flags,stackdst,stk'target,cbvector;                      <<06736>>03826000
integer flags,stackdst,stk'target;                             <<06736>>03828000
double  cbvector;                                              <<06736>>03829000
procedure MMSTAT'(entrie,p0,p1,p2,p3,p4,p5);                   <<07359>>03834000
value entrie,p0,p1,p2,p3,p4,p5;                                <<07359>>03836000
integer entrie,p0,p1,p2,p3,p4,p5;                              <<07359>>03838000
procedure UNLOCK'CB(flags,cbvector);                           <<06736>>03892000
value flags,cbvector;                                          <<06736>>03894000
integer flags;                                                 <<06736>>03896000
double  cbvector;                                              <<06736>>03897000
logical procedure CHECKRECSPACE(Acb,JustOpened,                <<01018>>03934000
                                JustOpenFcontrol,              <<01018>>03935000
                                RecLength);                    <<01018>>03935100
value Acb,JustOpened,JustOpenFcontrol,RecLength;               <<01018>>03936000
logical JustOpened,                                            <<01018>>03940000
        JustOpenFcontrol;                                      <<01018>>03941000
                                                               <<T9344>>03978010
double procedure FCHECKMSGBLOCK(Target,Length);                <<T9344>>03978020
value Target,Length;                                           <<T9344>>03978030
integer pointer Target;                                        <<T9344>>03978040
integer Length;                                                <<T9344>>03978050
option forward;                                                <<T9344>>03978060
                                                               <<T9344>>03978070
$EDIT VOID=03984000                                            <<02237>>03980000
                                                                        04090100
option privileged, uncallable;                                 <<02279>>04090200
  MMSTAT'(Event,Flags,Word1,Word2,0,0,0);                      <<07359>>04156000
<<Function                                                  >> <<02237>>04251000
<<If user was in split stack mode, set DB DST to stack.  If >> <<02237>>04252000
<<user was not in split stack mode, change the Target from  >> <<02237>>04253000
<<DB relative to (stack) DST relative.  Always fill in the  >> <<02237>>04254000
<<Q+ area of the caller with the msg file acb extensions.   >> <<02237>>04255000
  Acb,Pcb=SysPcbIndex;                                         <<06736>>04284000
integer                                                        <<06736>>04285100
  PcbPt;                                                       <<06736>>04285200
  PcbPt:=CurPrc; <<Set pointer for PCB incluge file>>          <<06736>>04309100
  AbCallerDbDST:=SpcbStkDst; <<DST from the PCB>>              <<02237>>04310000
tos:=@AbLacbExtension;                                         <<02237>>04320000
  the LACB, and sets DB back to the way it was. >>             <<02237>>04356000
integer pointer                                                <<06736>>04379100
  pcb=SysPcbIndex;                                             <<06736>>04379200
integer                                                        <<06736>>04379300
  Pcbpt;                                                       <<06736>>04379400
PcbPt:=CurPrc;                                                 <<06736>>04417000
if AbCallerDbDST <> SpcbStkDst then                            <<02237>>04418000
  EXCHANGEDB(AbCallerDbDST)                                    <<02237>>04420000
  AbCallerDbDST:=0;                                            <<02237>>04424000
procedure FCPREPAFT(FileNum,AftContents);                      <<06736>>04428000
value FileNum,AftContents;                                     <<06736>>04430000
  Changes the contents of the fle's AFT entry, ord three                04436000
    AftContents;       <<Desired value.>>                               04448000
integer pointer                                                <<06736>>04463000
   Aft;                                                        <<06736>>04463100
                                                               <<06736>>04463200
if Global'FileNum then                                         <<06736>>04463300
   begin                    << Global AFT, go to xtra DST.  >> <<06736>>04463400
   EXCHANGEDB(Global'Aft'DSTN);                                <<06736>>04463500
   @Aft := \Filenum\*AftEntry;                                 <<06736>>04463600
   end                                                         <<06736>>04463700
else                                                           <<06736>>04463800
   begin                                                       <<06736>>04463900
   SetAft;                  <<Init the AFT pointer>>           <<06736>>04464000
   end;                                                        <<06736>>04465000
AftIoqx:=AftContents;                                          <<06736>>04466000
if Global'Filenum                                              <<06736>>04467000
   then EXCHANGEDB(0);  << Set DB back from Global AFT DST. >> <<06736>>04468000
  if AbWriteCB <> 0d then FDELETECB(AbWriteCB);                <<06736>>04658000
  AbAcbWaitMsg:=1;                                             <<02237>>04810000
    AbMPin:=CurPrc/PcbSize;                                    <<06736>>04828000
    GETWAITQUEUE          > 0 - reply port                              04874000
    (valid if cce)        = 0 - use ACB instead of port                 04875000
                                                                        04876000
    condition code        =   - message found                           04876500
                          >   - no message outstanding >>      <<02059>>04877000
                                                                        04877500
<< The "A and not (B xor C)" test below says: there must be  >><<02547>>04896000
<< an ACB wait message and, either we want a waiting reader  >><<02547>>04897000
<< and have a reader message or we want a waiting writer and >><<02547>>04898000
<< have a writer message.                                    >><<02547>>04899000
if AbAcbWaitMsg and not    <<AbAcbWaitMsg - Wait msg in ACB. >><<02547>>04900000
 ((Port = AbReadQueue) xor <<Port - Type of msg wanted (R/W).>><<02547>>04901000
  (AbMID = 0)) then        <<AbMID - Type msg found (0=read).>><<02547>>04902000
  begin  <<Use ACB wait message>>                              <<02547>>04903000
  if DeleteFlag = delete'msg then AbAcbWaitMsg:=0;             <<02547>>04904000
  GETWAITQUEUE:=AbMReplyPort;                                  <<02547>>04905000
  move Msg:=AbMWaitMsg,(msg'lengthw);                          <<02237>>04906000
integer mode'subtype;                                          <<06736>>04968100
AbAcbComplMsg:=1;                                              <<02237>>04974000
  mode'subtype := file'soft'int;                               <<06736>>04986100
  mode'subtype.(0:1) := AbSoftIntMode;                <<06736>><<02163>>04986200
  CAUSESOFTINT(0,user'int,mode'subtype,AbSoftIntPlabel,2,0);   <<06736>>04988000
integer mode'subtype;                                          <<06736>>05058500
  mode'subtype := file'soft'int;                               <<06736>>05090300
  mode'subtype.(0:1) := AbMSoftIntMode;               <<06736>><<02163>>05090600
  CAUSESOFTINT(AbMPin,user'int,mode'subtype,AbMSoftIntPlabel,  <<06736>>05092000
  AbAcbReplyMsg:=1;                                            <<02237>>05132000
  AbRID:=ID;                                                   <<02237>>05136000
  AbRError:=Error;                                             <<02237>>05138000
  AbRTlog:=Tlog;                                               <<02237>>05140000
      AWAKE(AbMPin*pcbSize,port'wake,remain'active);           <<06736>>05152000
                                                                        05191000
<<Output                                                                05192000
    GETCOMPLTNMSG        > 0  - reply port                              05193000
    (valid if cce)       = 0  - use ACB instead of port                 05194000
                                                                        05195000
    condition code       =   - message found                            05196000
                         <   - timeout                                  05197000
                         >   - empty port    >>                <<02059>>05198000
                                                                        05199000
AbAcbComplMsg:=0;                                              <<02237>>05220000
  MsgRErrorCode:=AbCmplError;                                  <<02237>>05226000
  MsgRTlog:=AbCmplTlog;                                        <<02237>>05228000
else if AbAcbReplyMsg and AbRID = AbID then                    <<02237>>05234000
  AbAcbReplyMsg:=0;                                            <<02237>>05238000
  MsgRErrorCode:=AbRError;                                     <<02237>>05240000
  MsgRTlog:=AbRTlog;                                           <<02237>>05242000
  if > then CondCode:=ccg;                                     <<02059>>05255000
                                                                        05311000
  Note that the PACB is rolled out and back, because other accessors    05312000
  can update it, and we want to see those changes.  The LACB is not,    05313000
  because it is private to this accessor, and will not change.          05314000
>>                                                                      05315000
double                                                         <<06736>>05337000
  CbVector;                                                    <<06736>>05337100
logical                                                        <<06736>>05337200
  Cbvector1 = CbVector,                                        <<06736>>05337300
  CbVevtor2 = CbVector + 1;                                    <<06736>>05337400
     if AbAcbReplyMsg and (AbRID = AbID) then                  <<02237>>05362000
  tos:=AbPacbDST; tos:=AbPacbAddr+lacb'only'size;              <<01903>>05388000
  tos:=@AbStart+lacb'only'size; tos:=pacb'only'size;           <<01903>>05390000
  CbVector1 := AbPacbDST;      <<build CB vector for the>>     <<06736>>05411000
  CbVevtor2 := AbPacbCbTabAddr;<<call to UNLOCKCB       >>     <<06736>>05411100
  UNLOCK'CB(0,CbVector);                                       <<06736>>05412000
  LOCK'CB(0,0,QRelativeAcb+lacb'only'size,CbVector);           <<01903>>05428000
                                                               <<01903>>05428500
  <<Move the standard Pacb into the acb area>>                 <<01903>>05429000
  tos:=tos+lacb'only'size;                                     <<01903>>05430000
  tos:=pacb'only'size;                                         <<01903>>05432000
if AbAcbReplyMsg and (AbRID = AbID) or <<if reply in acb, or >><<02237>>05540000
   AbAcbComplMsg or                    <<compl msg in acb, or>><<02237>>05541000
  (FCPORTSTATUS(AbReplyPort,num'msgs) > 0) then  <<port reply>><<02237>>05542000
  if AbAcbWaitMsg and AbMID = AbID then                        <<02237>>05552000
    AbAcbWaitMsg:=0;                                           <<02237>>05556000
<< The variable "MsgJustOpenWD" in the following call is >>    <<01018>>06139000
<< part of a KLUDGEy fix -- See more complete description>>    <<01018>>06139100
<< in the procedure "CHECKRECSPACE".                     >>    <<01018>>06139200
                                                               <<01018>>06139300
    if CHECKRECSPACE(Acb,MsgVirgin,                            <<01018>>06140000
                     MsgJustOpenWD,RecordLength) then          <<01018>>06141000
if (AbReadAddr = AbFirstBuf) and        << -new block (1st rec) >>      06228000
  (AbWriteBlock >= dbl(AbNumBufs)) then << -uncoupled mode      >>      06229000
  begin <<New block on disc rather than in buffer, complete I/O.>>      06230000
                                                               <<01018>>06316010
<< In the following procedure "CHECKRECSPACE" I had to add >>  <<01018>>06316020
<< a KLUDGEy fix with the Variable "JustOpenFcontrol".     >>  <<01018>>06316030
<< This is a fix to a fix.  The procedure used to check the>>  <<01018>>06316040
<< variable "JustOpenedWaitDisabled" in the ACB, but since >>  <<01018>>06316050
<< this procedure is called by the reader (FREEWRITERS is  >>  <<01018>>06316060
<< where called from) the ACB is NOT THE CORRECT ONE!!  It >>  <<01018>>06316070
<< needed to look in the ACB of the WRITER.  To get around >>  <<01018>>06316080
<< this problem, I have the value that would have come from>>  <<01018>>06316090
<< the ACB, come in as a parameter.  It will be the correct>>  <<01018>>06316100
<< value in all cases that way.  This KLUDGE is a fix to   >>  <<01018>>06316110
<< the problem of the reader(s) thinking the file is empty >>  <<01018>>06316120
<< and the writer(s) thinking the file is full, so both are>>  <<01018>>06316130
<< hung on a WAIT call.                                    >>  <<01018>>06316140
                                                               <<01018>>06316150
logical procedure CHECKRECSPACE(Acb,JustOpened,                <<01018>>06318000
                                JustOpenFcontrol,              <<01018>>06318100
                                RecLength);                    <<01018>>06318200
value Acb,JustOpened,JustOpenFcontrol,RecLength;               <<01018>>06320000
    JustOpened,<<True if this is the writer's first write req>><<01018>>06338000
    JustOpenFcontrol;  << True=FCONTROL before 1st write>>     <<01018>>06339000
if JustOpened or JustOpenFcontrol then                         <<01018>>06380000
  Rec,Header,LastGoodRec,LastGoodHeader,Blk;                   <<m1277>>06454000
  I,J,BlkLength;                                               <<T9344>>06458000
  Di,WriteBlock,NumWriteBuf,BlkInfo;                           <<T9344>>06462000
  LastRecWasGood,GoodRecFound:=false,DSTFlag:=1;               <<m1277>>06466000
  @Blk:=@Rec-buf'prefix'size;                                  <<m1277>>06605000
  @Header:=@Rec+AbBSize-1;                                     <<m1277>>06606000
  BlkLength:=AbBSize;                                          <<T9344>>06607000
    BlkInfo:=FCHECKMSGBLOCK(Rec,BlkLength);                    <<T9344>>06612001
    if < then                                                  <<T9344>>06612010
      begin                                                    <<T9344>>06612020
      FILLEXIT(badvarblk);                                     <<T9344>>06612040
      end                                                      <<T9344>>06612050
    else if BlkInfo = 0d then                                  <<T9344>>06612060
      begin                                                    <<T9344>>06612070
      FILLEXIT(badvarblk);                                     <<T9344>>06612090
      end;                                                     <<T9344>>06612100
                                                               <<m1277>>06613000
  << Loop through every record in the last block. >>           <<m1277>>06613100
    begin                                                      <<m1277>>06616000
    if ((@Rec+block'overheadw) > @Header) or                   <<m1277>>06618000
       (HDType > max'header'type)         then <<bad block>>   <<m1277>>06619000
    if log(HDEofUpdated) or (HDType = close'record) then       <<m1277>>06621000
      begin                     << File label EOF has been   >><<m1277>>06621100
      @LastGoodRec:=@Rec;       << updated, by FControl 6 or >><<m1277>>06621200
      @LastGoodHeader:=@Header; << FClose, to include this   >><<m1277>>06621300
      GoodRecFound:=true;       << record.                   >><<m1277>>06621400
      LastRecWasGood:=true;   << Current record updated EOF. >><<m1277>>06621500
      end                                                      <<m1277>>06621600
    else                                                       <<m1277>>06621700
      LastRecWasGood:=false;  << This rec didn't update EOF. >><<m1277>>06621800
    << Increment to next header and record. >>                 <<m1277>>06622000
    @Header:=@Header-header'sizew;                             <<m1277>>06626000
    end;                                                       <<m1277>>06627000
                                                               <<m1277>>06628000
  if GoodRecFound and not LastRecWasGood then                  <<m1277>>06628100
    begin                                                      <<m1277>>06628200
    << EOF was updated, but does not include last record(s). >><<m1277>>06628250
    << Assume that the records that follow are not included  >><<m1277>>06628300
    << in the file label EOF because a crash occurred        >><<m1277>>06628400
    << before another FControl 6 or Close could be done.     >><<m1277>>06628500
    << Those records not included in the EOF will be ignored.>><<m1277>>06628600
    << Set Rec and Header to next available space.           >><<m1277>>06628700
    if LastGoodHeader.rec'type = data'record then              <<m1277>>06628800
      @Rec:=@LastGoodRec+(LastGoodRec+1)&lsr(1)+1              <<m1277>>06628850
    else                                                       <<m1277>>06628860
      @Rec:=@LastGoodRec;                                      <<m1277>>06628870
    @Header:=@LastGoodHeader-header'sizew;                     <<m1277>>06628900
    << Insert block delimiters. >>                             <<m1277>>06628910
    Rec:=record'delim;                                         <<m1277>>06628920
    HDType:=header'delim;                                      <<m1277>>06628930
    end                                                        <<m1277>>06629000
  else                                                         <<m1277>>06629100
    << Either the last record of the block is included in    >><<m1277>>06629200
    << the file label EOF (and everything is fine) or, no    >><<m1277>>06629300
    << FControl 6 or Close records were found.  If none were >><<m1277>>06629400
    << found, assume an FControl 6 updated the file label    >><<m1277>>06629500
    << block pointer to point to this block, prior to this   >><<m1277>>06629600
    << fix, and then a crash prevented an FClose.            >><<m1277>>06629700
    << Set LastGoodHeader to point to the previous header.   >><<m1277>>06629800
    if not GoodRecFound then                                   <<m1277>>06629900
      @LastGoodHeader:=@Header+header'sizew;                   <<m1277>>06630000
                                                               <<m1277>>06630100
  << If a 'good' record was found, and it was the last       >><<m1277>>06630200
  << record, and it was a 'last close' record, then no crash >><<m1277>>06630300
  << occurred.                                               >><<m1277>>06630400
  if not GoodRecFound or                                       <<m1277>>06630500
     not LastRecWasGood or                                     <<m1277>>06630600
     not log(LastGoodHeader.last'close'bit) then               <<m1277>>06631000
    begin                                                      <<m1277>>06631100
    LastGoodHeader.crash'bit:=1;                               <<m1277>>06631200
    BlkDirty:=1; << If crash, then we fixed up this block. >>  <<m1277>>06631300
    end;                                                       <<m1277>>06631400
  LOCK'CB(0,0,QRelativeFcb,AbFcbVector);                       <<06736>>06752000
  UNLOCK'CB(0,AbFcbVector);                                    <<06736>>06778000
if emptyfile and AbNumRecords <> 0d then                       <<09464>>06796020
  SUDDENDEATH(6601);                                           <<09464>>06796030
  if AbNumRecords <= 0d then SUDDENDEATH(6602);                <<09464>>06819000
  IF AbWriteBlock < 0d then SUDDENDEATH(6603);                 <<09464>>06821000
    begin               <<Output was started, finish it.>>              07044000
  if WaitType then GETRECORDETAILS(Acb);  <<Finishes read I/O>>         07136000
    begin <a new block needs to be started>                             07417000
    Ensure there is disc space for the new block                        07418000
    If the old block is in a write buffer then                          07422000
                                                               <<01361>>07604100
                                                               <<01361>>07604200
subroutine CHECKDISCSPACE;                                     <<01361>>07604300
<< FCONV'BLK checks to see if this block is in a currently   >><<01361>>07604400
<< allocated extent.  If it is not, it will try to allocate a>><<01361>>07604500
<< new extent.  If that fails (due to no more disc space), we>><<01361>>07604600
<< need to back out of this write.  Record and block pointers>><<01361>>07604700
<< should be left as if this write never happened so that EOF>><<01361>>07604800
<< does not point to an unallocated extent.                  >><<01361>>07604900
  begin                                                        <<01361>>07605000
  << Pass in the new block number  >>                          <<01361>>07605100
  << and a Q relative ACB address. >>                          <<01361>>07605200
  FCONV'BLK(AbWriteBlock+1d,@Acb-@Q0,WriteIo,0,0d,0d,0);       <<01361>>07605300
  << Ignore all returned parameters except for ErrorCode. >>   <<01361>>07605400
  del;   << sectors in extent >>                               <<01361>>07605500
  ddel;  << extent base address >>                             <<01361>>07605600
  ddel;  << EOF record number >>                               <<01361>>07605700
  del;   << sectors available >>                               <<01361>>07605800
  if S0 > 2 then                   << Check Error Code >>      <<01361>>07605900
    PUTEXIT(*) << greater than 2 - error or no disc space >>   <<01361>>07606000
  else         << 0 - ok, 1 - write beyond EOF (which is ok) >><<01361>>07606100
    if S0 = 2 then     << 2 - write beyond file limit,     >>  <<01361>>07606200
      UGLYMSGACCESS;   << should have been caught earlier. >>  <<01361>>07606300
  del;   << error code >>                                      <<01361>>07606400
  del;   << ldev containing extent >>                          <<01361>>07606500
  ddel;  << sector address of block >>                         <<01361>>07606600
  end;  <<CHECKDISCSPACE>>                                     <<01361>>07606700
                                                               <<01361>>07609000
  CHECKDISCSPACE;<< Is there room on disc for the new block? >><<01361>>07623000
    <<The following lines rotate the write buffer pointers 1 left>>     07636500
    <<and could be rewritten in a HLL as follows:                >>     07636700
    <<    FirstWrtBufPtr := MOVE SecondWrtBufPtr FOR NumWrtBufs-1>>     07637000
    <<    LastWrtBufPtr := @FirstWrtBuf                          >>     07637500
    <<Finish I/O on the least recently used write buffer (ie.>>         07649000
    <<the buffer we are about to re-use for the next write). >>         07649500
      if  abwriteblock < 0d then                               <<09464>>07663410
        begin                                                  <<09464>>07663420
        suddendeath(6604);                                     <<09464>>07663520
        end;                                                   <<09464>>07663530
LOCEXTENDACB(acb'loc,AaCallerDbDST,0);                         <<02237>>07956000
<<Called only from IOMOVE for Messages files openned with    >><<02101>>07979000
<<COPY and NOBUF (hence the blocks are treated like records).>><<02101>>07979100
<<NOTE: FcbEnd is the relative block number of the End-Of-   >><<02101>>07979200
<<File.  It can be zero for either of two reasons: the file  >><<02101>>07979300
<<is contained in one block, or the file is empty.  The check>><<02101>>07979400
<<to see if the number of data records plus the number of    >><<02101>>07979500
<<open/close records is greater than zero, determines which. >><<02101>>07979600
double                                                         <<06736>>08011000
   CbVector;                                                   <<06736>>08012000
logical                                                        <<06736>>08013000
   CbVector1 = CbVector,                                       <<06736>>08014000
   CbVector2 = CbVector + 1;                                   <<06736>>08014100
AcbLoc:=AcbLoc-DeltaQ;                                         <<m8220>>08014200
CbVector1 := AcFcbDST;       <<build CbVector for the call>>   <<06736>>08015000
CbVector2 := AcFcbCbTabAddr; <<to LOCK'CB                 >>   <<06736>>08015100
                                                               <<06736>>08015200
LOCK'CB(0,0,1,CbVector);                                       <<06736>>08016000
if (BlockNum <= FcbEnd) and                                    <<02101>>08021000
   ((FcbEof + FcbNumOpenClsRecs) > 0d)                         <<02101>>08022000
   then FCCHECKFILEND:=true;                                   <<02101>>08023000
UNLOCK'CB(0,CbVector);                                         <<06736>>08024000
PCBPtr:=Pin*pcbSize;                                           <<06736>>08322000
  If RW = 1 then                                               <<01019>>08515000
    RW:=-1;  << Force SERIAL QUEUE for the LABEL >>            <<01019>>08515100
  Rec,Header,BufferAddress,Blk;                                <<m1277>>08654000
    UNLOCK'CB(0,AbFcbVector);                                  <<06736>>08730000
    Alloc'D'Fcb;                                               <<06736>>08816000
    LOCK'CB(0,0,QRelativeFcb,AbFcbVector);                     <<06736>>08826000
    tos:=1;         << Get the size of the FCB entry >>        <<T9503>>08830000
    asmb(mds 1);    << go get it, then get rid of trans cnt >> <<T9503>>08832000
    tos:=FcbSize-1; << Trans cnt = size - wrd already transf >><<T9503>>08832100
    asmb(mds 6);    << get the rest of the entry >>            <<T9503>>08832200
    LOCK'CB(0,0,QRelativeFcb+ext'map'loc,AbFcbVector);         <<06736>>08850000
    UNLOCK'CB(0,AbFcbVector);                                  <<06736>>08864000
                                                               <<m1277>>08964100
                                                               <<m1277>>08964200
                                                               <<m1277>>08964300
subroutine MARKLASTHEADER;                                     <<m1277>>08964400
                                                               <<m1277>>08964500
<<Sets the eof'updated'bit in the last write header.>>         <<m1277>>08964600
begin                                                          <<m1277>>08964700
<< Set up addresses. >>                                        <<01443>>08964800
@Header:=AbWriteHeader+header'sizew; <<Address of last header>><<01443>>08964900
@BufferAddress:=@AbFirstBuf+AbWriteBufx; <<Buf pointr address>><<01443>>08965000
@Blk:=BufferAddress-buf'prefix'size; <<Address of buffer info>><<01443>>08965100
<< If IO has been started for this block, >>                   <<01443>>08965200
<< finish it before starting a new write. >>                   <<01443>>08965300
EXCHANGEDB(AbPacbDST);                                         <<01443>>08965400
if log(BlkIoPend) then                                         <<01443>>08965500
  begin                                                        <<01443>>08965600
  EXCHANGEDB(0);                                               <<01443>>08965700
  KWIESCEIO(BufferAddress);                                    <<01443>>08965800
  EXCHANGEDB(AbPacbDST);                                       <<01443>>08965900
  end;                                                         <<01443>>08966000
<< Update buffer. >>                                           <<01443>>08966100
HDEofUpdated:=1;      << Update the header in the buffer. >>   <<01443>>08966200
BlkDirty:=1;          << Mark this buffer as updated. >>       <<01443>>08966300
EXCHANGEDB(0);                                                 <<01443>>08966400
AbDirtyBlock:=1;      << Mark that a block has been updated. >><<01443>>08966500
<< Start the IO to disc. >>                                    <<01443>>08966600
DISKIO(AbWriteBlock,writeIO,BufferAddress);                    <<01443>>08966700
end;  <<MARKLASTHEADER>>                                       <<01443>>08966800
                                                               <<01443>>08966900
                                                               <<01443>>08967000
  if AbCopy and (AbWriteBlock <> 0d) then             <<06077>><<02101>>08977000
     FcbEnd := AbWriteBlock - 1d                      <<06077>><<02101>>08978000
$EDIT VOID=08978400                                                     08978100
$EDIT VOID=08978600                                                     08978600
     FcbEnd := AbWriteBlock;                          <<06077>><<02101>>08979000
if AbBufFilled and not AbCopy then                             <<01414>>08994000
  << If filled and native mode, modify and write buffers. >>   <<01414>>08995000
                                                               <<m1277>>09001000
  <<Mark last header as included in the file label EOF.>>      <<m1277>>09002000
  MARKLASTHEADER;                                              <<m1277>>09003000
                                                               <<m1277>>09003500
procedure FCCLOSE(FileNum,Fcb,Flab,Disp,Domain);               <<F1141>>09044000
value FileNum,Fcb,Flab,Disp,Domain;                            <<F1141>>09046000
    FileNum,            <<File's file number.>>                <<F1141>>09059000
    Disp,               <<File's close disposition.>>          <<F1141>>09060000
    Domain;             <<File's domain.>>                     <<F1141>>09061000
  AcbLoc        = @AcbArray-@q0#;                              <<06736>>09158000
$EDIT VOID=09162000                                            <<06736>>09160000
logical                                                        <<02059>>09169000
  port'not'empty;                                              <<02059>>09169500
  Timeout,ULabelExtents;                                       <<02163>>09174000
  Aft(0:AftEntry-1)=q,                                         <<06736>>09186000
  AcbArray(0:Acb'buf'size)=q;  <<Must be last Q rel dec>>      <<06736>>09187000
  if AbAcbWaitMsg then                                         <<02237>>09224000
    if FCBLBL > 0 then                                         <<T9344>>09304100
      begin                                                    <<T9344>>09304200
<<    Calc the number of extents required to hold the user >>  <<T9344>>09304300
<<    labels and the file label. DON'T remove these extents >> <<T9344>>09304400
<<    when pitching the extents at close time                >><<T9344>>09304500
                                                               <<T9344>>09304600
      ULabelExtents:=(FcbSectOff+FcbExtSize-1)/                <<T9344>>09305000
                      FcbExtSize; << Whole extents >>          <<T9344>>09305010
      ULabelExtents:=(if ULabelExtents > 0 then                <<T9344>>09305210
        (ULabelExtents - 1) else 0); << conv to 0 rel >>       <<T9344>>09305220
       end                                                     <<T9344>>09305300
     else                                                      <<T9344>>09305400
       ULabelExtents:=0;  << NO USER LABELS >>                 <<T9344>>09305500
    if (WriteExtent <> ReadExtent) or (AbWriteblock = dbl(0))  <<m7678>>09314000
      then                                                     <<m7678>>09315000
        if I > ULabelExtents and ExtentMap(I) <> 0d then       <<T9344>>09320000
      if Domain = 1 and (0<= Disp.(13:3) <=1) then             <<F1141>>09348005
        << call only if file was perm and is staying perm. >>  <<F1141>>09348006
AbCallerDbDST:=tos;                                            <<02237>>09366000
if not AbCopy then                                             <<07358>>09367000
  LOCEXTENDACB(AcbLoc,AbCallerDbDST,0);                        <<02237>>09368000
    port'not'empty := true;                                    <<02059>>09393000
    while port'not'empty do                                    <<02059>>09394000
      begin                                                    <<02059>>09395000
      GETCOMPLTNMSG(Acb,Msg);                                  <<02059>>09396000
      if > then  <<Port IS empty.>>                            <<02059>>09397000
        port'not'empty := false                                <<02059>>09398000
      else                                                     <<02059>>09399000
        begin                                                  <<02059>>09400000
        if MsgRErrorCode = successful then                     <<02237>>09401000
          begin                                                <<02059>>09402000
          if AbRead then                                       <<02059>>09403000
            begin  <<Give back the record>>                    <<02059>>09404000
            AbNumReadsPend:=AbNumReadsPend-1;                  <<02059>>09406000
            FREEREADER(Acb);                                   <<02059>>09408000
            end                                                <<02059>>09410000
          else                                                 <<02059>>09412000
            AbVirgin:=0;                                       <<02059>>09414000
          end;  <<if MsgErrorCode = successful then>>          <<02059>>09416000
        end;  <<if > then ... else>>                           <<02059>>09417000
      end;  <<while>>                                          <<02059>>09418000
    end;  <<if ABORTREQUESTS>>                                 <<02059>>09419000
$EDIT VOID=09448000                                            <<02163>>09446000
      PUTRECORD(Acb,close'record,0,0,0,no'cctl,AbID);          <<02163>>09450000
if not AbCopy then                                             <<07358>>09475000
  UNLOCEXTENDACB(Acb);                                         <<07358>>09476000
  WriteCb;                                                     <<06736>>09546000
  WriteCBAddr;                                                 <<06736>>09552000
integer                                                        <<06736>>09553100
  FileNum;                                                     <<06736>>09553200
integer pointer                                                <<06736>>09553300
  Aft;                                                         <<06736>>09553400
                                                               <<06736>>09553500
integer Mode;                                                  <<06736>>09554000
  Mode:=CHECKTRAPLABEL(Parameter,DeltaQ);                      <<06736>>09570000
    ParmArray:=wake'user'int;                                  <<02060>>09580000
    ParmArray(1):=file'soft'int;                               <<02060>>09581000
    ParmArray(1).(0:1):=mode;                         <<06736>><<02060>>09582000
    ParmArray(2):=AaFNum;                             <<06736>><<02060>>09583000
    ParmArray(3):=Parameter;                          <<06736>><<02060>>09584000
    FCPORTCONTROL(AaReplyPort,soft'int'index,ParmArray);       <<02060>>09585000
    AaSoftIntPlabel:=Parameter;                                <<06736>>09586000
    AaSoftIntMode:=Mode;                                       <<02163>>09587000
  if not AaRead and AaWriteCB = 0d then                        <<06736>>09610000
    FCREATECB(0,0d,OwnSeg,RecSize+1,LacbType);                 <<06736>>09616000
      WriteCb:=tos;       <<Save the data seg's location>>     <<06736>>09632000
      WriteCbAddr:=tos;                                        <<06736>>09633000
      UNLOCK'CB(0,WriteCb);                                    <<06736>>09634000
      AaWriteCB:=WriteCB; AaWriteCBAddr:=WriteCBAddr+1;        <<06736>>09638000
ParmAddr:=LOCEXTENDACB(acb'loc,AaCallerDbDST,Parameter);       <<02237>>09660000
  FileNum:=AaFNum;    <<To allow use of include file>>         <<06736>>09721000
  if Global'FileNum then                                       <<06736>>09721100
     begin            << Global file number.                >> <<06736>>09721200
     EXCHANGEDB(Global'Aft'DSTN);                              <<06736>>09721300
     @Aft := \FileNum\*AftEntry;                               <<06736>>09721400
     end                                                       <<06736>>09721500
  else                                                         <<06736>>09721600
     begin                                                     <<06736>>09721700
     SetAft;          <<Init the local Aft pointer.         >> <<06736>>09722000
     end;                                                      <<06736>>09723000
  if AftIoqx <> 0 then                                         <<06736>>09724000
     begin                                                     <<06736>>09725000
     if Global'FileNum then EXCHANGEDB(0);                     <<06736>>09726000
     ErrorCode:=IOPending                                      <<06736>>09728000
     end                                                       <<06736>>09729000
    if Global'FileNum then EXCHANGEDB(0);                      <<06736>>09733000
    if Parameter = 0 then                                      <<02060>>09734000
      AaSoftIntPlabel:=0;                                      <<02060>>09737000
      ParmArray:=wake'on'port;                                 <<02060>>09738000
      ParmArray(1):=0; move ParmArray(2):=ParmArray(1),(9);    <<02060>>09739000
    MMSTAT'(*,*,*,*,0,0,0);                                    <<07359>>09892000
                                                               <<01017>>09946001
<< T. Gilstrap 3/11/85 -- All the simple stuff may be the >>   <<01017>>09946002
<< understatement of the YEAR.  At this point, if anything>>   <<01017>>09946003
<< that is invalid slips by, its a certain System Failure >>   <<01017>>09946004
<< down the road sometime while accessing this file!      >>   <<01017>>09946005
                                                               <<01017>>09946006
<< Take care of any NEGATIVE counts 1st, they get in here >>   <<01017>>09946007
<< somehow, possible from some obscure section of the file>>   <<01017>>09946008
<< system??  BUT it does not have to mean the file is bad.>>   <<01017>>09946009
                                                               <<01017>>09946010
  If NumOpenClsRecs < 0D then NumOpenClsRecs:=0D;              <<01017>>09946011
  If NumBlocks      < 0D then NumBlocks     :=0D;              <<01017>>09946012
  if AbNumRecords   < 0D then AbNumRecords  :=0D;              <<01017>>09946013
                                                               <<01017>>09946014
<< Check for invalid combinations of the above three     >>    <<01017>>09946015
<< variables, and correct.  In particular, if the number >>    <<01017>>09946016
<< of open/close records is zero OR the number of records>>    <<01017>>09946017
<< in the file is zero, all three variables MUST be zero.>>    <<01017>>09946018
                                                               <<01017>>09946019
  If NumOpenClsRecs = 0D      or                               <<01017>>09946020
     AbNumRecords   = 0D      then                             <<01017>>09946021
    begin << All three should be zero! >>                      <<01017>>09946022
    NumOpenClsRecs  := 0D;                                     <<01017>>09946023
    NumBlocks       := 0D;                                     <<01017>>09946024
    AbNumRecords    := 0D;                                     <<01017>>09946025
    end;                                                       <<01017>>09946026
                                                               <<01017>>09946027
<< The easy one -- If all three of these variables are    >>   <<01017>>09946028
<< zero, we have an EMPTY file regardless of the access   >>   <<01017>>09946029
<< mode.                                                  >>   <<01017>>09946030
                                                               <<01017>>09946031
  if NumOpenClsRecs = 0D     and                               <<01017>>09946032
     NumBlocks      = 0D     and                               <<01017>>09946033
     AbNumRecords   = 0D     then                              <<01017>>09946034
    begin << EMPTY file >>                                     <<01017>>09946035
       AbNumRecords := 0D;                                     <<01017>>09946036
    AbNumOpenClsRec := 0D;                                     <<01017>>09946037
    AbWriteBlock    := 0D;                                     <<01017>>09946038
    end   << EMPTY file >>                                     <<01017>>09946039
  else                                                         <<01017>>09946040
    begin << The only other possibility >>                     <<01017>>09946041
    AbWriteBlock   := NumBlocks;                               <<01017>>09946042
    AbNumOpenClsRec:= NumOpenClsRecs;                          <<01017>>09946043
    AbNumRecords:=AbNumRecords + NumOpenClsRecs;               <<01017>>09946044
    end;  << The only other possibility >>                     <<01017>>09946045
<< Now continue with the original code to set up the other >>  <<01017>>09946046
<< portions of the ACB.                                    >>  <<01017>>09946047
                                                               <<01017>>09946048
$EDIT VOID=09946512                                            <<01017>>09946500
$EDIT VOID=09950000                                            <<01017>>09950000
$EDIT VOID=09955000                                            <<01017>>09955000
$EDIT VOID=09956000                                            <<01017>>09956000
$EDIT VOID=09961000                                            <<01017>>09961000
$EDIT VOID=09961600                                                     09961100
  if AbNumRecords = 0d then                                    <<T9344>>09962000
procedure REMOVERESOURCES(Acb,Last);                                    09982010
value Acb,Last;                                                         09982020
                                                                        09982030
<<Function                                                              09982040
  Deletes all msg file resources that belong to the process.>>          09982050
                                                                        09982060
<<Input>>                                                               09982070
  integer pointer                                                       09982080
    Acb;                <<Address of the Access Control Block.>>        09982090
  logical                                                               09982100
    Last;               <<If true then this is the last accessor.>>     09982110
                                                                        09982120
<<Output                                                                09982130
  None.>>                                                               09982140
                                                                        09982150
option privileged,internal;                                             09982160
                                                                        09982170
begin                                                                   09982180
array IDmap(0:maxIDindex');                                             09982190
AbxDataStructure;                                                       09982200
                                                                        09982210
                                                                        09982220
if AbReplyPort <> 0 then                                                09982230
  while not FCPORTCLOSE(AbReplyPort) do FCPORTRECEIVE(AbReplyPort);     09982240
                                                                        09982250
if not AbRead then                                                      09982260
  begin  <<Writer>>                                                     09982270
  if AbWriteCB <> 0d then FDELETECB(AbWriteCB);                <<09978>>09982280
                                                                        09982290
  <<Delete the writer's ID from the pacb ID map>>                       09982300
  RELID(AbID,IDMap);                                                    09982310
  end;                                                                  09982320
if Last then                                                            09982330
  begin  <<Last accessor, clean up the file>>                           09982340
  if AbReadQueue <> 0 then                                              09982350
    if not FCPORTCLOSE(AbReadQueue) then UGLYMSGACCESS;                 09982360
  if AbWriteQueue <> 0 then                                             09982370
    if not FCPORTCLOSE(AbWriteQueue) then UGLYMSGACCESS;                09982380
  end;                                                                  09982390
end;  <<REMOVERESOURCES>>                                               09982400
  double                                                       <<06736>>10006000
$edit void=10066000                                            <<06736>>10062000
  WriteCb;                                                     <<06736>>10072000
  WriteCBAddr,RecSize,I,AcbDst;                                <<06736>>10076000
    REMOVERESOURCES(Acb,(AbShCnt <= 1));                       <<09978>>10112000
  asmb(exit 3);                                                <<06736>>10116000
  <<LOCK'CB params: flags, stack DST, stack offset, cb vector>><<02237>>10133000
  LOCK'CB(0,0,lacb'q'loc,LacbV);                               <<06736>>10134000
  <<Flags, stack vector, cb vector are left on stack.>>        <<02237>>10135000
  tos:=tos+lacbx'loc; <<increment cb vector offset to lacbx>>  <<02237>>10136000
  asmb(dxch);         <<double exchange the vectors>>          <<02237>>10138000
  asmb(mds 5);        <<deletes vectors and size>>             <<02237>>10146000
  del;                <<delete flags>>                         <<02237>>10148000
  UNLOCK'CB(0,LacbV);                                          <<06736>>10150000
  if AbShCnt = 0 then                                          <<06736>>10166000
    AbShCnt:=1;                                                <<06736>>10170000
      <<This buffer is used to hold the user's write data, >>           10202500
      <<when a no wait write can not be started because the>>           10203000
      <<file is full, until space is freed. See FCWRITE.   >>           10203500
      FCREATECB(0,0d,OwnSeg,RecSize+1,LacbType);               <<06736>>10206000
      WriteCb:=tos;       <<Save the data seg's location>>     <<06736>>10218000
      WriteCbAddr:=tos;                                        <<06736>>10219000
      UNLOCK'CB(1,WriteCb);                                    <<06736>>10220000
      LxWriteCBAddr:=WriteCBAddr+1;                            <<06736>>10224000
      tos := WriteCB;         << Build CB vector in LACB.   >> <<06736>>10224100
      LxWriteCBEntry := tos;  << Get 2nd. word, entry offset>> <<06736>>10224200
      LxWriteCBDST := tos;    << Get 1st word, the DST #.   >> <<06736>>10224300
                          1 - complete a read (IOWAIT)                  10281000
                          2 - complete a read, target omitted>><<02237>>10282000
  LastDataWord,FillWord,FillLength,UserLengthb,                <<02237>>10408000
  Address,DstOffset,TargetAddr,TargetDST,                      <<02237>>10409000
  ConditionCode=Function,HeaderXferb:=0,DataXferb:=0;          <<02237>>10410000
    if ErrorCode <> successful then                            <<02237>>10480000
      PUTMYCOMPLTNMSG(Acb,ErrorCode,0);                        <<02237>>10481000
  AaJustOpenedWaitDisabled:=0;                                 <<m8452>>10487000
  UserLengthb:=tos;  <<Save positive byte count>>              <<02082>>10580500
  <<The users requested data transfer length can not be  >>    <<02082>>10581000
  <<greater than the maximum record size, or the maximum >>    <<02082>>10581500
  <<record size plus header length if extended read.     >>    <<02082>>10582000
  if AaExtendRead then                                         <<02082>>10582500
    begin                                                      <<02082>>10583000
    if UserLengthb > (AaRSize + header'sizeb) then             <<02082>>10583500
      UserLengthb:=AaRSize+header'sizeb;                       <<02082>>10584000
    end                                                        <<02082>>10584500
  else                                                         <<02082>>10585000
    begin                                                      <<02082>>10585500
    if UserLengthb > AaRSize then                              <<02082>>10586000
      UserLengthb:=AaRSize;                                    <<02082>>10586500
    end;                                                       <<02082>>10587000
  end;  <<ANALYZELENGTH>>                                      <<02082>>10587500
  tos:=TargetDST; tos:=TargetAddr;  <<Dest address for moves>> <<02237>>10646000
    tos:=AbPacbDST; <<move data from buffer to the user area>> <<06736>>10680000
$EDIT VOID=10841100                                            <<02237>>10841000
  if > then SUDDENDEATH(6606); << There has to be a msg here.>><<02059>>10853000
  if MsgRErrorCode <> successful then READEXIT(MsgRErrorCode); <<02237>>10854000
  Tcount:=MsgRTlog;                                            <<02237>>10862000
$EDIT VOID=10885100                                            <<02237>>10885000
  <<If Db at stack, convert Address from Db rel to DST rel.>>  <<02237>>10909000
  DstOffset:=LOCEXTENDACB(acb'loc,AaCallerDbDST,Address);      <<02237>>10910000
    REQINITIALIZE;                                             <<02237>>10941000
    TargetAddr:=DstOffset;    <<FREAD with WAIT, use the>>     <<02237>>10942000
    TargetDST:=AaCallerDbDST; <<passed Target parameter.>>     <<02237>>10943000
    REQINITIALIZE;              <<FREAD without WAIT, save>>   <<02237>>10971000
    AaFreadDST:=AaCallerDbDST;  <<caller's DST and the    >>   <<02237>>10972000
    AaFreadTarget:=DstOffset;   <<passed Target address.  >>   <<02237>>10973000
  TargetAddr:=DstOffset;    <<IOWAIT specifying the Target, >> <<02237>>11017000
  TargetDST:=AaCallerDbDST; <<use the passed DST and Target.>> <<02237>>11018000
  GETRECORD;                                                   <<02237>>11019000
                                                               <<02237>>11020100
  begin                  <<** Complete no-wait read,No Target>><<02237>>11020200
  PROCESSCOMPLETEDREAD;                                        <<02237>>11020300
  TargetAddr:=AaFreadTarget; <<IOWAIT without the Target,   >> <<02237>>11020400
  TargetDST:=AaFreadDST;     <<use the FREAD DST and Target.>> <<02237>>11020500
  GETRECORD;                                                   <<02237>>11020600
  end;                                                         <<02237>>11020700
                                                               <<02237>>11020800
  DstOffset,TotalRecLenw,DataLengthb,Tlog,Address,             <<02237>>11166000
  AaJustOpenedWaitDisabled:=0;                                 <<m8452>>11205000
    if ErrorCode <> successful then    << Error will be      >><<01361>>11243000
      PUTMYCOMPLTNMSG(Acb,ErrorCode,0) << returned by IOWAIT.>><<01361>>11244000
    else                                                       <<01361>>11245000
      AaVirgin:=0;          << The file has been written to. >><<01361>>11246000
    ConditionCode:=cce;                                        <<01361>>11247000
  Aaerror:=PUTRECORD(Acb,data'record,AaCallerDbDST,DstOffset,  <<02237>>11274000
  DataLengthb,AaControlByte,AaID);                             <<02237>>11276000
  if > then SUDDENDEATH(6605); << There has to be a msg here.>><<02059>>11323000
  AaError:=MsgRErrorCode;                                      <<02237>>11324000
  AaTlog:=MsgRTlog;                                            <<02237>>11325000
  if AaControl and DataLengthb > (AaRsize - 1)  or             <<T9344>>11376000
     DataLengthb > AaRsize then WRITEXIT(badtcount);           <<T9344>>11377000
<<If Db at stack, convert Address from Db rel to DST relative>><<02237>>11417000
DstOffset:=LOCEXTENDACB(acb'loc,AaCallerDbDST,Address);        <<02237>>11418000
    and CHECKRECSPACE(Acb,JustOpened,                          <<01018>>11442000
                      AaJustOpenedWaitDisabled,                <<01018>>11443000
                      totalRecLenw) then                       <<01018>>11443100
      LONGWAIT(Acb,AaWriteQueue,AaCallerDbDST,DstOffset,DataLengthb);   11458000
    and CHECKRECSPACE(Acb,JustOpened,                          <<01018>>11480000
                      AaJustOpenedWaitDisabled,                <<01018>>11481000
                      totalRecLenw) then                       <<01018>>11481100
      tos:=AaCallerDbDST;                                      <<02237>>11504000
      tos:=DstOffset;                                          <<02237>>11506000
LOCEXTENDACB(acb'loc,AaCallerDbDST,0);                         <<02237>>11598000
                                                                        11636100
option privileged, uncallable;                                 <<02279>>11636200
