Skip to content

76B SetBlockSize

Validated   MON 76B (62 decimal) · Mnemonic SETBS · Group: File Operations (manual section 2.4)

Available from: All programs (manual compatibility box)

Emulation source: src/handlers/mon_76B_SetBlockSize.c

Description

Sets the block size of an opened file. Monitor calls which read randomly from, or write randomly to a file, operate on blocks. See ReadFromFile and WriteToFile.

  • The standard block size is 512 bytes. This block size is set when the file is opened.
  • The block size is reset when the file is closed.
  • Factors of 2048 bytes are the most efficient block sizes.

Parameters

Name Type Direction Description
FileNumber INTEGER2 In File number. See OpenFile.
BlockSize LONGINT In Block size in bytes. Must be an even number. Factors of 2048 are most efficient.

Direction: In = the program supplies the value, Out = the call returns it, In/Out = both.

See also

SetStartBlock, ReadFromFile, WriteToFile, and @SET-BLOCK-SIZE

Compatibility

Machines Users Programs
ND-100 and ND-500 All users All programs

The manual's compatibility box for this call, word for word.

Yes/no fields from the YAML extraction (not in the manual's words):

ND-100 ND-500 User programs RT programs System programs
Yes Yes No No No

Examples

From the manual (OCR text, not corrected).

INTEGER : FileNumber
INTEGER : BlockSize
...
ON ROUTINEERROR DO
  IF ErrCode > 0 THEN ...
ENDON
Monitor_Call('SetBlockSize', FileNumber, BlockSize)
INTEGER FileNumber
INTEGER*4 BlockSize
...
Monitor_Call('SetBlockSize', FileNumber, BlockSize)
IF (ErrCode .NE. 0) THEN ...
FileNumber : INTEGER2;
BlockSize : LONGINT;
...
SetBlockSize(FileNumber, BlockSize);
If ErrCode <> 0 THEN ...
01 FileNumber COMP.
01 BlockSize COMP PIC S9(10).
01 ErrCode COMP.
...
MONITOR-CALL "SetBlockSize" USING FileNumber, BlockSize.
CALL "CbError" USING ErrCode.
IF ErrCode NOT = 0 GO ...
FileNumber : W BLOCK 1
BlockSize : W BLOCK 1
ErrCode : W BLOCK 1
SetBlockSize : EQU 37B9 + 76B
...
CALLG SetBlockSize, 2, FileNumber, BlockSize
IF K GO ERROR
...
ERROR : W1 =: ErrCode       %ErrorCode in W1 register.
LDT FILNO       %File number returned from earlier open.
LDA SIZE        %Block size in words.
MON 76          %Monitor call SetBlockSize.
JMP ERROR       %Error return from monitor call.
...             %Normal return.
ERROR, ...      %Error number in register A.

FILNO, ...
SIZE, ...       %New block size.

ndmonlib implementation

Validated Registered MON_STATUS_VALIDATED in src/core/mon_registry.c: implemented, tested and working.

Handler mon_76B_SetBlockSize
Code lines 40 (non-blank, non-comment lines in the file)

Emulation research

Source

This section comes from the emulation: block of the call's YAML file in the NDInsight repo. It records what was learned while implementing the call in nd500x; its status is nd500x's, not ndmonlib's.

Status (nd500x) implemented
nd500x handler nd500x/src/libmon/handlers/mon_76B_SetBlockSize.c
Last updated 2026-07-17

Parameter notes

1. BlockSize

Field Value
Note The block size recorded here is what 117B RFILE and 120B WFILE multiply BlockNo by to compute the file offset. With no SETBS the default is 512 bytes, matching the manual.
Verified Yes

Return contract

  • Success: K flag cleared; the block size is recorded on the open-file entry.
  • Errors

    Code Octal Meaning
    87 127B File number out of range
    90 132B No file opened with this number
    111 157B Missing parameter
    124 174B Illegal parameter (block size 0, or above the emulator cap)

Observed calls

1. ND linker (linker-b01.dom), startup

Field Value
Params Blocksize: 0
Expectation Observed in a FAILURE cascade only: when the linker's first 50B OPEN (empty file name) fails, the following 76B SETBS arrives with block size 0 and errors. That is a SYMPTOM of the OPEN failure, not a SETBS defect.

Verified

1. The default block size is 512 bytes and is applied when SETBS never ran.

Field Value
Evidence Manual: "The standard block size is 512 bytes. This block size is set when the file is opened." Both mon_117B_ReadFromFile.c and mon_120B_WriteToFile.c fall back to DEFAULT_BLOCK_SIZE 512 when entry->block_size is 0.

Unverified

  • "The block size is reset when the file is closed" - nd500x clears the whole entry at close, so the effect matches, but the reset is not an explicit modelled step.
  • The manual says the block size "must be an even number". nd500x does NOT enforce evenness; it accepts any value in 1..65536.
  • The 65536 upper cap is an emulator invention, not a documented SINTRAN limit.
  • Access code D (direct transfer) requires the block size to be a multiple of the page size (2048 bytes). That constraint is not enforced here or in 117B/120B.

Sources

Doc Note
SINTRAN III Monitor Calls (ND-860228.2 EN) The manual page this YAML was extracted from.
nd500x/docs/MON_COMPLETENESS_MATRIX.md Row 76B SETBS - MATCH (prior).

Source

SINTRAN III Monitor Calls (ND-860228.2 EN), page 433.