Table of Contents

5.4.5.12 Get Statement

Note

This section describes the implementation of MS-VBAL §5.4.5.12 Get Statement.

Syntax

AST node Instruction kind(s) Notes
KeywordStatementNode Simple Token: Get.

See RD-VBAL §3.4.3 File Statements.

Runtime Semantics

Get reads through the record surface of a file channel, which it shares with Put (RD-VBAL §5.4.5 File Statements).

Get resolves its target with the same target resolution the Let assignment statement uses (RD-VBAL §5.4.3.8 Let Statement). It Let-assigns what it reads to its target, as MS-VBAL §5.4.5.12 specifies.

Record Format

Get reads the record format Put writes: MS-VBAL §5.4.5.11 Put Statement's Variant type descriptors and binary widths. The format is a wire format rather than a behaviour, and follows MS-VBA's so that a file RD-VBA writes is a file MS-VBA reads. See RD-VBAL §5.4.5.11 Put Statement for the format.

Get reads each member of a UDT in declaration order, recursively through a nested UDT. Get moves the serialized size of a UDT. Put #1, , myRecord and Get #1, , myRecord serialize and deserialize a whole UDT in one statement.

Record Positioning

Get positions records as Put does (RD-VBAL §5.4.5.11 Put Statement):

  • Record number 1 is byte 0 of the file. The record number and the file-pointer-position are one quantity, and Seek and Get must agree on it (RD-VBAL §5.4.5.3 Seek Statement).
  • A Random channel whose Open statement declared no Len clause counts positions in 128-byte records.

Implementation

Name Role
IFileChannel A file channel. Its record surface is the one Put and Get use.
RecordDataFormat Implements the Put/Get record format.
LetAssignmentEvaluator.TryResolveTarget Resolves the target: the same target resolution Input #, Line Input # and the Let assignment statement use.

⏮️ RD-VBAL §5.4.5.11 Put Statement | ⏭️ RD-VBAL §5.4.5.13 Name Statement