Tuesday | 21 MAY 2024
[ previous ]
[ next ]

Juggling SELECTS in NSH

Title:
Date: 2023-04-20
Tags:  

A pain point in NSH was that select statements get re-run if you chain together multiple selects.

For example:

> SELECT INVOICE-FILE WITH DATE < 01JAN
> SELECT INVOICE-FILE WITH DATE > 01JAN2019

This would result in the first query getting run. The second query would then re-run the first query before running the second query. This is because of the way I execute commands. SELECT statements are a series verb and so I keep them in the stack and then re-run them if someone is chaining things together.

This means that if the first query is expensive you are stuck always waiting for it to run. I dealt with this by switching to TCL when the first query is expensive. Rarely do I know it is expensive until I actually run it though. By that point I'm annoyed because now I need to break to TCL and run the same query and wait for it again.

I resolve the issue now by running a SAVE-LIST anytime a series verb is hit. This way I can replace the first query with a GET-LIST and the problem is sorted! This works beautifully and was a simple change to NSH.

I'll need to use it for a bit to make sure everything is working but on the surface it looks like a very good change.