PQLServer
The SIR/XS PQLServer is an executable that allows another standard SIR/XS session to connect to it as a client and to transmit commands to the server, execute those commands remotely and retrieve output. This is done with a set of VisualPQL functions. The PQLServer must be started to enable clients to communicate to it across the network. The client processes do not require any access to files or databases that are local to the server and the two processes (client/server) may be using different hardware/operating systems e.g. client on windows, server on Unix.
From the client point of view processing is as follows:
- Client logs on to server and establishes a connection. This is the current connection used by all subsequent server functions until another logon/logoff.
- Client sends any number of lines of text including SIR/XS commands. Control usually passes back without any actual transmission taking place - transmission only happens when maximum message size is reached.
- Client starts execution of previously sent commands. Any commands not yet sent to the server are transmitted, any settings or output from a previous execution from the same client are re-initialised, the commands are run and a completion code is returned at which point any output is waiting on the server. Commands can include all SIR/XS commands and can use procedures, etc. Note that commands must include connecting any databases/tabfiles/procedure files needed each time commands are submitted and executed. There are no saved settings between executions.
The process may read/write files, update databases and generally do anything that a batch run of SIR/XS could do.
- The client may choose to wait for the execution to finish or to carry on processing locally and subsequently test to find if the execution has completed successfully.
- Client gets count of number of lines of output and can then get each text line or skip over unwanted lines. Lines are physically passed by the server in groups. If skipping lines and the lines have not yet been transmitted, they are skipped on the server. Lines once returned or skipped are no longer available. The client can get a count of the number of lines available at any point.
- Client can repeat the process.
- Client logs off (specify a blank server) when finished.
e.g.
program
compute rc = serlog ('TONYDELL:4000','')
write rc
compute x = sersend ('PROGRAM')
compute x = sersend ('WRITE "HELLO WORLD"')
compute x = sersend ('END PROGRAM')
compute rc = serexec (1)
write 'rc = ' rc
compute olines = serlines(x)
write 'lines ' olines
for i=1,olines
. compute line = serget (0)
. write line
end for
compute rc = serlog ('','')
end program
See the