Skip to content

62B GetBytesInFile

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

Available from: All programs (manual compatibility box)

Emulation source: src/handlers/mon_62B_GetBytesInFile.c

Description

Gets the number of bytes in a file. Only the bytes containing data are counted.

Notes

  • The file must be open.
  • The number of bytes are only relevant to sequentially accessed files.

Parameters

Name Type Direction Description
FileNumber INTEGER In File number. See OpenFile.
NoOfBytes INTEGER4 Out Number of bytes in the file (32-bit value).

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

See also

SetMaxBytes, GetBytesInFile, @FILE-STATISTICS

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 Yes Yes No

Examples

From the manual (OCR text, not corrected).

INTEGER FileNumber
INTEGER4: NoOfBytes
...
ON ROUTINEERROR DO
    IF ErrCode > 0 THEN ...
ENDON
Monitor_Call('GetBytesInFile', FileNumber, NoOfBytes)
INTEGER FileNumber
INTEGER*4 NoOfBytes
...
Monitor Call('GetBytesInFile', FileNumber, NoOfBytes)
IF (ErrCode .NE. 0) THEN ...
FileNumber : INTEGER2;
NoOfBytes : LONGINT;
...
GetBytesInFile(FileNumber, NoOfBytes);
IF ErrCode <> 0 THEN ...
01 FileNumber COMP.
01 NoOfBytes COMP PIC S9(10).
01 ErrCode COMP.
...
MONITOR-CALL "GetBytesInFile" USING FileNumber, NoOfBytes.
CALL "CbError" USING ErrCode.
IF ErrCode NOT = 0 GO ...
FileNumber: W BLOCK 1
NoofBytes: W BLOCK 1
ErrCode: W BLOCK 1
GetBytesInFile: EQU 37B9 + 62B
...
CALLG GetBytesInFile, 2, FileNumber, NoOfBytes
    IF K GO ERROR
...
ERROR: W1 := ErrCode              %ErrorCode in W1 register.
LDT FILNO      %File number returned from earlier open.
MON 62         %Monitor call GetBytesInFile.
JMP ERROR      %Error return from monitor call.
STD BYTES      %Normal return, store the number of bytes obtained.
...
ERROR,         %Error number in register A.
...
FILNO,
...
BYTES, O       %A double word
0              %

ndmonlib implementation

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

Handler mon_62B_GetBytesInFile
Code lines 42 (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_62B_GetBytesInFile.c
Last updated 2026-07-17

Parameter notes

1. NoOfBytes

Field Value
Note This is a real OUT PARAMETER and must be WRITTEN. nd500x writes the size into arg 1 with a word write. (The OUT-parameter defect class - a handler computing the right value and never writing the caller's slot - is what broke 412B FSCNT and 511B DVIO; do not repeat it here.)
Verified Yes

2. NoOfBytes

Field Value
Note INTEGER4 on the ND-500 = a single 32-bit word, and the handler writes one word. Note the contrast with 11B TIME, where the carve shows a DOUBLE word return - so "INTEGER4 = one word" is NOT a safe blanket rule across MON calls.
Verified Yes

Return contract

  • Success: K flag cleared; the byte count written to NoOfBytes (arg 1) when the caller supplied it.
  • Errors

    Code Octal Meaning
    87 127B File number out of range
    90 132B No file opened with this number
    111 157B Missing parameter

Verified

1. The size reported is the live host file size, not a cached value.

Field Value
Evidence The handler seeks the host file to END, takes ftell, and restores the previous position; the cached object_entry.bytes_in_file is only the fallback when there is no host handle.

Unverified

  • The manual says "Only the bytes containing data are counted". nd500x reports the whole host file length. For a file that was pre-allocated by 221B CreateFile (NoOfPages > 0) these differ - the pre-allocated tail would be counted. Not proven either way against the carve.
  • Whether the real RMAX also returns the count in W1 (in addition to the OUT parameter) is not established; nd500x writes only the parameter slot.
  • 62B has not been re-audited against the carve in the current pass; the completeness matrix marks it "(prior audit)".

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 62B RMAX.

Source

SINTRAN III Monitor Calls (ND-860228.2 EN).