Table of Contents

DMSBRD Abstract

Statistics

Type ASSEMBLE
Source Lines : 994
Fixes Applied : 5
Most Recent Version : Tuesday, December 12, 1978
Last Fix ID : [R14460DS]

Synopsis

Module

     DMSBRD   (RDBUF)

Function

       TO READ ONE OR MORE SUCCESSIVE ITEMS FROM A SPECIFIED
       FILE.

Attributes

       RESIDENT,  REENTRANT, CALLED  VIA  EITHER  AN SVC  OR
       BALR.

Operation

       AFTER  PERFORMING  SOME  ERROR  CHECKS,  RDBUF  CALLS
       ACTLKP  TO DETERMINE  IF  THE GIVEN  FILE  IS IN  THE
       ACTIVE FILE TABLE.   IF IT IS FOUND BUT  IS AN ACTIVE
       WRITE, AN ERROR 9 IS GIVEN.   IF AN ACTIVE READ, THEN
       PROCESSING PROCEEDS AS DESCRIBED UNDER "FILE ACTIVE".
       IF THE FILE IS ACTIVE BUT NEITHER A READ NOR A WRITE,
       THEN IT MUST HAVE BEEN PLACED  IN THE ACTIVE TABLE BY
       A  POINT  FUNCTION  CALL;   PROCESSING  CONTINUES  AS
       DESCRIBED  BELOW AT  THE  POINT  AFTER THE  ENTRY  IS
       PLACED IN THE ACTIVE FILE TABLE BY ACTFREE.

       FILE NOT ACTIVE:

       IF THE FILE IS NOT FOUND BY ACTLKP IN THE ACTIVE FILE
       TABLE, RDBUF CHECKS TO SEE  IF THE FILE REFERENCED AT
       STATEFST  (LEFT BY  THE MOST  RECENT  CALL TO  STATE)
       MATCHES  THE  CALLER'S  PARAMETER   LIST.   (AS  MANY
       COMMANDS  STATE A  FILE  TO  FIND ITS  EXISTENCE  AND
       CHARACTERISTICS AND THEN IMMEDIATELY  RDBUF THE FIRST
       RECORD, THERE IS A GOOD  CHANCE THIS WILL OCCUR--THUS
       SAVING A NEEDLESS SEARCH OF THE FST TABLES). IF FOUND
       AT STATEFST, THE  ADDRESSES OF THE ACTIVE  DISK TABLE
       AND THE FST ENTRY ITSELF  ARE OBTAINED FROM THE EIGHT
       BYTES IMMEDIATELY  FOLLOWING THE  STATEFST COPY,  AND
       FSTLKP IS  NOT CALLED.  (IF  NOT FOUND BY  FSTLKP, AN
       ERROR 1  OCCURS).  IF  FOUND BY  FSTLKP, OR  FOUND IN
       STATEFST AS ABOVE, THEN ACTFREE  IS CALLED TO FIND OR
       CREATE AN ENTRY  IN THE ACTIVE FILE  TABLE AND INSERT
       THE 40-BYTE FST ENTRY THEREIN.

       WHEN  THE FILE  HAS BEEN  PLACED IN  THE ACTIVE  FILE
       TABLE (OR WAS ALREADY THERE  FROM A POINT FUNCTION AS
       MENTIONED  ABOVE),  RDBUF  MARKS THE  FILE  AS  BEING
       ACTIVE.  NEXT, RDBUF OBTAINS  BUFFER SPACE INTO WHICH
       TO READ  THE DATA BLOCKS AND  INTO WHICH TO  READ THE
       FIRST CHAIN  LINK.  IT THEN  CALLS THE  RDTK FUNCTION
       PROGRAM  TO  READ  THE FIRST  CHAIN  LINK  INTO  MAIN
       STORAGE.  RDBUF NEXT MOVES THE  FIRST 80 BYTES OF THE
       FIRST CHAIN LINK INTO THE CHAIN LINK DIRECTORY IN THE
       ACTIVE FILE  TABLE ENTRY.   THEN RDBUF  DETERMINES IF
       THE ITEM(S)  TO BE READ  IS/ARE OF FIXED  OR VARIABLE
       LENGTH.  IF  OF VARIABLE LENGTH,  PROCESSING PROCEEDS
       AS  DESCRIBED UNDER  "VARIABLE-LENGTH  ITEM" IN  THIS
       SECTION. IF  OF FIXED LENGTH, PROCESSING  PROCEEDS AS
       DESCRIBED BELOW.

       FIXED-LENGTH ITEM:  RDBUF  CALCULATES THE  NUMBER  OF
       BYTES TO BE  READ.  THIS IS EQUAL TO  THE ITEM LENGTH
       MULTIPLIED BY  THE NUMBER  OF ITEMS  TO BE  READ.  IT
       THEN CALCULATES (FROM THE ITEM NUMBER SUPPLIED IN THE
       PARAMETER LIST) THE DATA BLOCK FROM WHICH THE ITEM(S)
       IS/ARE TO BE READ.  THIS  CALCULATION ALSO YIELDS THE
       DISPLACEMENT FROM THE START OF  THE DATA BLOCK OF THE
       FIRST  BYTE  TO  BE  READ.   NEXT,  RDBUF  DETERMINES
       WHETHER THE AFFECTED  DATA BLOCK IS IN  MAIN STORAGE.
       IF IT IS NOT, RDBUF DETERMINES WHETHER THE CHAIN LINK
       REQUIRED TO ACCESS  THE NEEDED DATA BLOCK  IS IN MAIN
       STORAGE.  IF THE  REQUIRED CHAIN LINK IS  NOT IN MAIN
       STORAGE,  RDBUF CALLS  THE RDTK  FUNCTION PROGRAM  TO
       READ IT INTO MAIN STORAGE.   AFTER THE REQUIRED CHAIN
       LINK HAS  BEEN READ  INTO MAIN STORAGE,  OR IF  IT IS
       ALREADY IN MAIN STORAGE, RDBUF DETERMINES WHETHER THE
       AFFECTED  DATA   BLOCK  EXISTS.   (IT  WILL   IF  ITS
       CORRESPONDING ENTRY IN THE CHAIN LINK THAT IS IN MAIN
       STORAGE  CONTAINS  A  VALID DISK  ADDRESS.)   IF  THE
       AFFECTED DATA BLOCK  DOES NOT EXIST, RDBUF  FILLS THE
       INPUT BUFFER WITH  ZEROES AND RETURNS TO  THE CALLING
       PROGRAM.  IF IT  DOES EXIST, RDBUF READS  IT INTO THE
       DATA BLOCK BUFFER.

       IF THE  AFFECTED DATA BLOCK  IS IN MAIN  STORAGE WHEN
       RDBUF IS CALLED,  OR IF IT IS NOT, AFTER  IT HAS BEEN
       READ  INTO   MAIN  STORAGE   (IF  NECESSARY),   RDBUF
       DETERMINES WHETHER IT CONTAINS ALL OF THE BYTES TO BE
       READ.   (IT  WILL IF  THE  RESULT  OF 800  MINUS  THE
       PREVIOUSLY CALCULATED DISPLACEMENT IS GREATER THAN OR
       EQUAL TO  THE NUMBER  OF BYTES TO  BE READ.)   IF THE
       DATA  BLOCK CONTAINS  ALL OF  THE BYTES  TO BE  READ,
       RDBUF MOVES  THEM FROM THE  DATA BLOCK  BUFFER (WHERE
       THE  DATA BLOCK  RESIDES)  TO  THE INPUT  BUFFER  AND
       RETURNS TO  THE CALLING PROGRAM.   IF THE  DATA BLOCK
       DOES NOT CONTAIN  ALL OF THE BYTES TO  BE READ, RDBUF
       MOVES THE PERTINENT BYTES FROM  THE DATA BLOCK BUFFER
       TO THE  INPUT BUFFER.   IT THEN  READS THE  NEXT DATA
       BLOCK INTO MAIN STORAGE,  OBTAINS THE REMAINING BYTES
       TO BE READ  FROM IT, MOVES THEM TO  THE INPUT BUFFER,
       AND  RETURNS TO  THE CALLING  PROGRAM.   (IF THE  800
       BYTES IN  THE NEXT DATA  BLOCK ARE NOT  SUFFICIENT TO
       SATISFY THE READ, RDBUF MOVES THE ENTIRE 800 BYTES TO
       THE INPUT BUFFER AND READS THE NEXT DATA BLOCK TO GET
       THE REMAINING  BYTES.  RDBUF  REPEATS THIS  PROCEDURE
       UNTIL THE NUMBER OF BYTES  IN THE INPUT BUFFER EQUALS
       THE NUMBER OF  BYTES TO BE READ.  IT  THEN RETURNS TO
       THE CALLING PROGRAM.)

       VARIABLE-LENGTH RECORD: RDBUF  READS SUCCESSIVE  DATA
       BLOCKS (STARTING WITH THE FIRST) UNTIL IT LOCATES THE
       ONE THAT  CONTAINS THE  START OF  THE VARIABLE-LENGTH
       ITEM TO BE READ. IT THEN MOVES THE ITEM LENGTH TO THE
       START OF  THE INPUT BUFFER.  IF THE FIRST  DATA BLOCK
       CONTAINS  THE  ENTIRE  ITEM,  RDBUF  RETURNS  TO  THE
       CALLING PROGRAM.  IF THE  FIRST DATA  BLOCK DOES  NOT
       CONTAIN THE ENTIRE  ITEM, RDBUF MOVES THE  DATA BLOCK
       TO THE  INPUT BUFFER  AND READS  THE NEXT  DATA BLOCK
       INTO THE  DATA BLOCK BUFFER,  MOVES THE  REMAINDER OF
       THE  ITEM TO  THE INPUT  BUFFER, AND  RETURNS TO  THE
       CALLING   PROGRAM.    IF   THE   REMAINDER   OF   THE
       VARIABLE-LENGTH ITEM IS NOT COMPLETELY CONTAINED WITH
       THE 800 BYTES  OF THE SECOND DATA  BLOCK, RDBUF READS
       THE  NEXT DATA  BLOCK  TO  GET THE  REMAINING  BYTES.
       RDBUF  REPEATS   THIS  PROCEDURE  UNTIL   THE  ENTIRE
       VARIABLE-LENGTH  ITEM HAS  BEEN PLACED  IN THE  INPUT
       BUFFER.  IT THEN RETURNS TO THE CALLING PROGRAM.

       FILE ACTIVE:

       IF THE FILE  IS ACTIVE, RDBUF DETERMINES  WHETHER THE
       ITEM TO BE  READ IS OF FIXED OR  VARIABLE LENGTH.  IF
       OF  FIXED  LENGTH,  IT   PROCEEDS  AS  DESCRIBED  FOR
       FIXED-LENGTH ITEMS  UNDER "FILE  NOT ACTIVE".   IF OF
       VARIABLE LENGTH AND  THE ITEM TO BE  READ IMMEDIATELY
       FOLLOWS   THE  ONE   JUST  READ,   RDBUF  MOVES   THE
       VARIABLE-LENGTH  ITEM INTO  THE INPUT  BUFFER IN  THE
       PREVIOUSLY DESCRIBED MANNER.   IF THE VARIABLE-LENGTH
       ITEM TO  BE READ  PRECEDES THE  ONE JUST  READ, RDBUF
       PROCEEDS  AS  DESCRIBED FOR  VARIABLE-LENGTH  RECORDS
       UNDER "FILE NOT ACTIVE".  IF THE VARIABLE-LENGTH ITEM
       TO BE READ FOLLOWS, BUT NOT IMMEDIATELY, THE ONE JUST
       READ, RDBUF  READS FORWARD FROM THE  CURRENT LOCATION
       IN  THE  FILE   UNTIL  IT  LOCATES  THE   DATA  BLOCK
       CONTAINING THE  START OF THE  DESIRED ITEM.   IT THEN
       MOVES THAT  ITEM TO  THE INPUT  BUFFER AS  PREVIOUSLY
       DESCRIBED.

Calls to Other Routines

       ACTFREE, ACTLKP, DMSFREE, DMSFRET, FSTLKP, RDTK