Passing values to the read prompts via cache routine?
Hi Developers
Is there any way that we can pass the values to the read prompts via cache routine.
For example, we have a couple of reports/routine in our system which accepts some inputs and after taking the inputs it generates some data. Right now it has proper UI and where User enters the value and in routines we have Read statements which accepts those inputs for further processing.
Now we want to schedule all these reports on a task manager on cache and don't want to modify the existing routines so wanted to check is there any way to pass the values to those "Read statement" via cache routine ?
To make it more clear, following is a test routine, if we run on terminal it accepts for two inputs, now if we want to trigger the same via a routine, then how to supply these "Read" command values ?
W !,"Enter First Variable Name" R a
W !,"Enter Second Variable Name" R b
s ^zparas=a_" "_b
quit
Thanks in Advance.
The most simple way is to redirect your I/O to a TCPport where another job provides you with the expected input:
#1) have a listener: (any port, I use 7777 for the example)
open listen:(:7777):0 if '$test write "port busy",! quit
use listen read request
while request'="/* your end condition */" {
/* match request for correct reply */
write reply,!
}
close listen
#2) at your report side all you have to do is
open server:("127.0.0.1":7777):0
if '$test write "port busy",! /* termination sequence */ quit
use server
/* launch your program */
here the listener sits on the same machine but it could be any reachable IP-address.
the only critical point is if your program fiddles around changing $IO
Hi Bob
Thanks for the reply, as you said this approach has a drawback if we change $IO changed with in the process it self, and in our routines we are generating files after accepting the input.
Thanks
Paras
On Windows with cterm.exe you can write special terminal scripts.
on Linux, as I know terminal scripts not available, so, you just prepare the list of answers, if it's fixed. and just send it to stdin.
or
Hi Dmitriy
Thanks for the reply, problem is that we can run any shell script on UNIX because our application is migrating to IRIS on Ubuntu, where we will have very minimal OS related features and we cant run anything on shell. and aim to make code OS independent.
So i am looking for the same thing if that can achieved within Cahe itself.
I did explore JOB command where I can give principal IO device in the process params, but I am not sure whether it's a right approach for this or not.
Thanks
Paras
The Job way also possible just a bit more complex.
Yes, I agree, to accomplish the same via JOB is complex but I am unable to explore / find another way within cache to achieve the same. If you have other suggestion that can help me in this direction then please do let me know.
Thanks
Paras
As I don't know your version of Caché, I'll suggest that it's quite new. So, I got this code working for IRIS in docker(Ubuntu). Did not check Windows.
And The output like this
Social networks
InterSystems resources
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue