PRMOPE.PAS/-AU= {$E+ External procedure} {$C .TITLE PRMOPE .IDENT "810812" } { Change Status: DATE BY DESCRIPTION 07-JUL-81 KGT Check to see if the User Specified Recordsize is the same as the file record size. If not, the user may not have specified enough buffer space. 08-JUL-81 KGT If the file is not properly open or connected, set the FAB.Ctx field to a -1. All record operations check for the Ctx = +1 which is set if open and connect success. 29-JUL-81 KGT The unlock feature did not function properly. It was after the $open, it has to be before the open. 29-JUL-81 KGT Default for program access to the opened file is changed to read only. This access will not lock buckets and therefore allow other users to access records without fear of bucket lock errors. 03-AUG-81 KGT Clear the rab and fab before the open. Problem discovered when trying to overlay prm and open a file in the overlay segment. Previous opens had been done initially and the assumption of the rab and fab being clear was true. Not so when overlaying the code. This also takes care of the new version of OMSI Pascal V1.2H which will init. to 1's. 08-AUG-81 KGT Prm record size type error was destroying the fab error. For example, if the file was not found the record size would be incorrect the the record size error would be loaded in status word 1. The error is loaded only if the file opens properly. } @[300,47]prmconst.pas CONST @RMSCONST.PAS TYPE @RMSTYPE.PAS @Fab.pas @rab.Pas @PRMTYPE.PAS { open the file described by the RmsFileDesc buffer } PROCEDURE PRMOpe (VAR FileBuf : RmsFileDesc ; VAR Status : RmsStatus ) ; { status of Sts and Stv } VAR i,j : integer ; BEGIN WITH FileBuf DO BEGIN { clear rab & fab, get rid of any garbage resulting from overlays } FOR i := 1 TO 40 DO BEGIN { clear by using integer definitions } Rab.AllRab[i] := 0 ; Fab.AllFab[i] := 0 ; END ; FOR i := 1 TO NameSize DO IF FileName[i] = ' ' THEN EXIT ; FOR j := 1 TO i DO IF FileName[j] >= 'a' { make all caps } THEN FileName[j] := chr(ord(FileName[j]) - 40B) ; Fab.Fns := chr(i - 1) ; { name size if one less than blank } Fab.Fna := @FileName ; Fab.Lch := chr(LogChan) ; { logical channel number } IF ((Allow = Share) AND (Org <> SEQ)) { no share on sequential } THEN Fab.Shr := chr(FbWri) ; { allow others to write } CASE Access OF PBoth : Fab.Fac := chr(FbGet OR FbPut OR FbDel OR FbUpd) ; PRead : Fab.Fac := chr(FbGet) ; PWrite : Fab.Fac := chr(FbGet OR FbPut) ; END ; { CASE Access } Fab.Rtv := chr(Windows) ; { set window size } fab.bid := chr(3B); { Set buffer identification field } fab.bln := chr(120B); { Set rab length field } fab.bpa := 0; { Set buffer pool for GSA routine } IF Org = IDX THEN IF DeferWrite = 'Y' THEN Fab.Fop := (FbDfw OR Fab.Fop) ; IF Org <> SEQ { refer to notes on FOP field, macro rms man. } THEN IF UnLock = 'Y' THEN Fab.Fop := ((Fab.Fop) OR (FbDlk)) ; Fab.Ctx := 1 ; { assume fail, set to success below } {$C .mcall $open mov filebuf(sp), r0 ; addr of filebuf add #fab, r0 ; calc addr of the fab in filebuf $open r0 ; Open the file } IF Fab.Sts >= 1 THEN IF RecordSize <> Fab.Mrs THEN BEGIN Fab.Ctx := -1 ; { inhibit all record operations } Status[1] := PrRne ; { record size mis-match } Status[2] := LogChan ; { logical channel no. used } END { IF RecordSize <> Fab.Mrs } ELSE BEGIN Rab.Fab := @Fab ; { set up record options } IF ObeyFill = 'Y' THEN Rab.Rop := Rab.Rop OR RbLoa ; IF MassInsert = 'Y' THEN Rab.Rop := Rab.Rop OR RbMas ; IF FileEnd = 'Y' THEN Rab.Rop := Rab.Rop OR RbEof ; IF Org = REL THEN Rab.Ksz := chr(4) ; { key size always } rab.bid := chr(1B); { Set buffer identification field } rab.bln := chr(120B); { Set rab length field } {$C .mcall $connect mov filebuf(sp), r0 ; address of filebuf from stack add #rab, r0 ; calc addr. of rab in filebuf $connect r0 ; Connect to the file } IF Rab.Sts < 1 { did connect fail? } THEN Fab.Ctx := -1 ; { indication to other PRM routines } { load status with the success or fail code of the connect } Status[1] := Rab.Sts ; Status[2] := Rab.Stv ; END { IF Fab.Sts >= 1 } ELSE { we have a fab type rms error } BEGIN Fab.Ctx := -1 ; Status[1] := Fab.Sts ; Status[2] := Fab.Stv ; END ; END ; { WITH } END ; /