# Collection of code snippets by Arne Vajhøj 
# (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
from construct import *
from vms.rms.IndexedFile import IndexedFile

class DataFil(IndexedFile):
    def __init__(self, fnm):
        IndexedFile.__init__(self, fnm, Struct('data', SNInt32('f1'), SNInt32('f2')))
    def primary_keynum(self):
        return 1 # <---- note this

db = DataFil('demo.isq')
for d in db:
    print('%d %d' % (d.f1, d.f2))
