// Collection of code snippets by Arne Vajhøj 
// (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
import dk.vajhoej.isam.*
import dk.vajhoej.isam.local.*

oisqf = new LocalIsamSource("orders.isq", "dk.vajhoej.vms.rms.IndexSequential", false)
olisqf = new LocalIsamSource("orderlines.isq", "dk.vajhoej.vms.rms.IndexSequential", false)
ors = oisqf.readStart(OrdersISAM.class)
while(ors.read()) {
    o = ors.current()
    println("${o.id} ${o.customer} ${o.status}:")
    olrs = olisqf.readGE(OrderLinesISAM.class, new Key(1, o.id))
    while(olrs.read()) {
        ol = olrs.current()
        if(ol.orderId != o.id) break
        println("  ${ol.id} ${ol.item} ${ol.qty} ${ol.price}")
    }
}
oisqf.close()
olisqf.close()
