deltanovember
deltanovember

Reputation: 44041

How do I save a program in kdb/q?

Most of the examples seem to be run in REPL mode. Is it possible to load myprog.q from disk?

Upvotes: 3

Views: 869

Answers (2)

Aaron Davies
Aaron Davies

Reputation: 41

Alternatively, from inside a running REPL,

\l myprog.q

will load the script.

Also note that you can persist the root workspace to disk and resume later:

$ q
q)a:1
q)`:workspace set get`.
`:workspace
q)\\
$ q workspace
q)a
1

Upvotes: 4

mollmerx
mollmerx

Reputation: 648

Sure, you just need to provide the name of the .q script as an argument to the q process:

/opt/app/KX/q2.7/q /opt/app/path/to/script/myprog.q -p 5000

would start a q process on port 5000. On startup it will execute the contents of your script.

Upvotes: 2

Related Questions