FNDBLK Jan72

Order Number: XX-F2420-25

This document, "SYSTEM PROGRAMMING TECHNIQUES FNDBLK," dated January 5, 1972, describes a procedure to determine the physical disk block address of a relative block (R) within a disk file for a non-privileged program.

The process involves three main steps:

  1. Reading the HOME Block: The procedure first accesses and reads the file's HOME block (e.g., HOME.SYS[1,4]). This block contains critical file structure information, including the logical unit number (HOMLUN), count and address pointers for retrieval information (HOMCNP, HOMCLP), and the number of blocks per cluster (HOMBPC).

  2. Reading the First Retrieval Information Block (RIB): Next, the first RIB for the target file is read. The document notes that if a file is being written to, it must be in UPDATE mode for its RIB to be properly written to disk.

  3. Scanning RIBs for the Relative Block:

    • The core of the algorithm involves scanning retrieval pointers within the RIBs, starting with the first.
    • Unit-Change Pointers: The first pointer in an RIB is typically a "unit-change-pointer" (XWD 0,400000+n), indicating the logical unit for the subsequent blocks it describes.
    • Data Block Pointers: For each actual data block pointer (identified by a non-zero left half), the procedure calculates the range of relative blocks it covers (L = HOMBPC*K).
      • If the target relative block R falls within this range, the physical address is found by R - BASE + J (where BASE tracks the start of the current range, and J is derived from HOMCNP and HOMBPC), and the physical unit is obtained from the last unit-change-pointer.
      • If R is not in the current range, BASE is updated, and the scan continues to the next pointer.
    • Next RIB Pointers: If a pointer (XWD 0,-1) indicates that the block is not in the current RIB, the procedure reads the next RIB (e.g., USETI -n, INPUT), updates BASE from the new RIB's word 33, and continues the scanning process.
    • A pointer value of 0 signifies an error.

The document concludes with an assembly language program snippet demonstrating how to implement this FNDBLK technique.

XX-F2420-25
January 1972
6 pages
Quality

Original
0.2MB

Site structure and layout ©2025 Majenko Technologies