123B ReleaseResource¶
Validated MON 123B (83 decimal) · Mnemonic RELES · Group: File Operations (manual section 2.4)
Available from: All programs (manual compatibility box)
Emulation source: src/handlers/mon_123B_ReleaseResource.c
Description¶
Releases a reserved device or file. The resource can then be used by another program. You reserve a device or opened file with ReserveResource. Some devices, e.g. terminals, have both an input and output part. You can only release one part with each ReleaseResource.
- A normal termination of an RT program release all resources.
- Reserve the device with ReserveResource or ForceReserve.
- CloseFile or @CLOSE-FILE releases reserved files.
Parameters¶
| Name | Type | Direction | Description |
|---|---|---|---|
DeviceNumber |
INTEGER | In | Logical device number. See appendix B. |
IOFlag |
INTEGER | In | Input or output flag. Use 0 for the input part and 1 for the output part. |
Direction: In = the program supplies the value, Out = the call returns it, In/Out = both.
See also¶
ForceRelease, ReserveResource, ReleaseDir, @RESRV, @RELEASE-FILE, and @RELEASE-DEVICE-UNIT
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 : DeviceNumber, IOFlag
...
Monitor_Call('ReleaseResource', DeviceNumber, IOFlag)
INTEGER DeviceNumber, IOFlag
...
Monitor_Call('ReleaseResource', DeviceNumber, IOFlag)
DeviceNumber, IOFlag : INTEGER2;
...
ReleaseResource(DeviceNumber, IOFlag);
01 DeviceNumber COMP.
01 IOFlag COMP.
...
MONITOR-CALL "ReleaseResource" USING DeviceNumber, IOFlag.
DeviceNumber : W BLOCK 1
IOFlag : W BLOCK 1
ReleaseResource : EQU 3789 + 123B
...
CALLG ReleaseResource, 2, DeviceNumber, IOFlag
LDA (PAR %Load register A with address of parameter list.
MON 123 %Monitor call ReleaseResource.
...
PAR, DEVNO %Logical device number.
IOF %Input/output flag.
DEVNO, ...
IOF, ...
ndmonlib implementation¶
Validated Registered MON_STATUS_VALIDATED in src/core/mon_registry.c: implemented, tested and working.
| Handler | mon_123B_ReleaseResource |
| Code lines | 35 (non-blank, non-comment lines in the file) |
Notes from the handler source¶
src/handlers/mon_123B_ReleaseResource.c line 44
Call release API. Return codes: 0 = released, -2 = valid device but not
reserved, -1 = invalid device number, -52 = invalid io_flag.
src/handlers/mon_123B_ReleaseResource.c line 49
Carved L07 RELES: releasing an unreserved (but valid) resource is an
idempotent SUCCESS no-op - error 005B belongs to the I/O operations
that REQUIRE a reservation, never to RELES itself.
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_123B_ReleaseResource.c |
| Last updated | 2026-07-17 |
Note¶
Real bookkeeping against the nd500x device-reservation table (mon_release_device in src/libmon/mon_file_table.c). The one hard-won fact: RELEASING AN UNRESERVED RESOURCE IS A SUCCESS, NOT AN ERROR.
Parameter notes¶
| Name | Note | Verified |
|---|---|---|
| DeviceNumber / IOFlag | On ND-500 both INTEGER parameters are 32-bit words (W BLOCK), read with mon_read_param_word. IOFlag: 0 = input part, 1 = output part; one part per call. | Yes |
| (none) | This call has NO out parameter - the result is only the K flag. Contrast 122B RESRV, which does have a conditional Status output. | Yes |
Return contract¶
- Success: K flag cleared. Also returned for an idempotent release of a valid but unreserved resource.
-
Errors
Code Octal Meaning 111 157B Missing parameter (fewer than 2 arguments supplied) 124 174B Illegal parameter - genuinely bad input only (invalid device number, or an io_flag that is neither 0 nor 1).
Verified¶
1. MON 123B dispatches via MCTAB to the L07 worker RELES in segment 003-S3CP.
| Field | Value |
|---|---|
| Evidence | Carve L-VSX-500 123B-ReleaseResource/README.md: MCTAB slot (segment 044-S3IDPIT, byte offset 1990) = 037156B = RELES; RELES worker body carved at 037156B-037162B in 003-S3CP (byte offset 7388). Reproduced: dd if=044-S3IDPIT.bin bs=1 skip=1990 count=2 -> 3e 6e. |
2. Releasing an unreserved (but valid) resource is an idempotent SUCCESS no-op, NOT error 005B.
| Field | Value |
|---|---|
| Evidence | Carved L07 RELES worker. Recorded in the handler: "error 005B belongs to the I/O operations that REQUIRE a reservation, never to RELES itself." nd500x maps mon_release_device()'s -2 ("valid device, not reserved") to success. |
Unverified¶
- The RELES worker body is only 5 words (037156B-037162B) and was not decoded instruction by instruction for this note; the idempotent-success claim is carried from the handler's citation of that carve, not re-derived here.
- nd500x's internal return codes (0 released, -2 valid-but-unreserved, -1 invalid device number, -52 invalid io_flag) are emulator-internal. -52 in particular is NOT a SINTRAN code - it is mapped to 124 (174B) before it reaches the guest. Whether real SINTRAN raises an error at all for a bad io_flag is unknown.
- "CloseFile or @CLOSE-FILE releases reserved files" and "a normal termination of an RT program releases all resources" are not modelled.
- Not yet audited against the carve - listed under "NOT yet audited vs carve" in nd500x/docs/HANDOFF_MON_COMPLETENESS.md.
Discrepancies¶
1. nd500x previously returned error 5 (005B "Device not reserved") when a program released something it had not reserved. Commit 6b57202 lists RELES among the calls given "correct codes ... (device not reserved 5)".
| Field | Value |
|---|---|
| Is | RELES itself returns SUCCESS for that case. 005B is raised by the I/O operations that REQUIRE a reservation, never by RELES. |
| Evidence | Carved L07 RELES worker, cited in nd500x/src/libmon/handlers/mon_123B_ReleaseResource.c lines 48-56. |
Sources¶
| Doc | Note |
|---|---|
| NDInsight/tools/sintran-segment-carver/versions/L-VSX-500/re/mon-analysis/123B-ReleaseResource/README.md | MCTAB[123B] = RELES = 037156B, worker carved in 003-S3CP. |
| nd500x/docs/MON_CSHARP_SYNC_HANDOFF.md | Cross-emulator sync notes. |
Source¶
SINTRAN III Monitor Calls (ND-860228.2 EN), page 411.