dbTalk Databases Forums  

Communicating with phantoms

comp.databases.pick comp.databases.pick


Discuss Communicating with phantoms in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
eppick77
 
Posts: n/a

Default Communicating with phantoms - 06-22-2010 , 11:36 AM






25 years ago I wrote a system to run reports in the background at a
client site. It was on a GA system and I could have sworn that I
wrote the responses into a record and then did an execute of the
program and passed the data via data statements.

Since it was so long ago and just a memory, it is also possible that I
wrote the data out as a proc and put all the responses into the proc
and then deleted itself - I just can not remember.

Does anyone know if you can pass data into a phantom on D3?

Thanks

Eugene

Reply With Quote
  #2  
Old   
Cox Subscriber
 
Posts: n/a

Default Re: Communicating with phantoms - 06-22-2010 , 12:39 PM






My memory has faded of GA Zebra but your post reminds me of some
special functionality that R91 had. Maybe you're thinking of same?

I'm also reminded of an incredibly cool inter-process communications
function in D3 which would allow you to pass data among running D3
processes including phantoms. I was looking for something like this
for years. But I was told by TigerLogic that this great functionality
was never really supported and should not be used. Dang, that was a
major tease. I'm just saying, sometimes they build in functionality
and then when no one uses it they decide it probably wasn't a good
idea ... oh well, old topic.

There are still a few ways to skin this cat.

1) Check out the Z command. IIRC this is a BASIC wrapper around
something else so you can see how they accept a stack of data and then
send that to the phantom.

2) I think most people (including myself) would put the phantom into a
Read loop with a periodic sleep, where the phantom wakes up, reads a
file for new command, then goes to sleep for some seconds when there's
nothing there. The above IPC would eliminate the resource hit of
polling a file. RIP

3) To eliminate the pain of polling, in *nix you can do what the D3
docs call sychronization. Search the D3 Ref for SIGUSR1 or PIPE.

4) Finally, I haven't done anything like this in a while but you could
put your phantom into an input loop something like this:
prompt ""
loop
stack = ""
loop
input cmd
until cmd = "exec" or cmd = "exit" do
stack<-1> = cmd
repeat
until stack<1> = "exit" do
* execute commands in stack
repeat

And then from another process:

do.comms: * this pattern ensures port is closed
gosub get.required.phantom.port
success = 0
execute "dev-att "ort
gosub issue.command
execute "dev-det "ort
* success may be 0 or 1
return
issue.command: *
if done then
send 'exit' to port else null
return
end
send 'some command' to port else return
send 'another instruction' to port else return
send 'exec' to port else return
success = 1
return


HTH
T


eppick77 wrote:

Quote:
25 years ago I wrote a system to run reports in the background at a
client site. It was on a GA system and I could have sworn that I
wrote the responses into a record and then did an execute of the
program and passed the data via data statements.

Since it was so long ago and just a memory, it is also possible that I
wrote the data out as a proc and put all the responses into the proc
and then deleted itself - I just can not remember.

Does anyone know if you can pass data into a phantom on D3?

Thanks

Eugene

Reply With Quote
  #3  
Old   
Ed Sheehan
 
Posts: n/a

Default Re: Communicating with phantoms - 06-22-2010 , 02:09 PM



I remember that R91 had a 1000 element array which could be seen across all
ports. We were considering using it for credit card processing - have some
elements populated, then interrogate them from the modem port, then write
the result back into other elements which could be read by the front-end
register. But, alas, it was available only on R91, so we had to abandon it
in favor of other methods (write to files) supported by all platforms.
Another example of LCD programming (Lowest Common Denominator).

Ed

"Cox Subscriber" <cox (AT) users (DOT) invalid> wrote

Quote:
My memory has faded of GA Zebra but your post reminds me of some
special functionality that R91 had. Maybe you're thinking of same?

I'm also reminded of an incredibly cool inter-process communications
function in D3 which would allow you to pass data among running D3
processes including phantoms. I was looking for something like this
for years. But I was told by TigerLogic that this great functionality
was never really supported and should not be used. Dang, that was a
major tease. I'm just saying, sometimes they build in functionality
and then when no one uses it they decide it probably wasn't a good
idea ... oh well, old topic.

There are still a few ways to skin this cat.

1) Check out the Z command. IIRC this is a BASIC wrapper around
something else so you can see how they accept a stack of data and then
send that to the phantom.

2) I think most people (including myself) would put the phantom into a
Read loop with a periodic sleep, where the phantom wakes up, reads a
file for new command, then goes to sleep for some seconds when there's
nothing there. The above IPC would eliminate the resource hit of
polling a file. RIP

3) To eliminate the pain of polling, in *nix you can do what the D3
docs call sychronization. Search the D3 Ref for SIGUSR1 or PIPE.

4) Finally, I haven't done anything like this in a while but you could
put your phantom into an input loop something like this:
prompt ""
loop
stack = ""
loop
input cmd
until cmd = "exec" or cmd = "exit" do
stack<-1> = cmd
repeat
until stack<1> = "exit" do
* execute commands in stack
repeat

And then from another process:

do.comms: * this pattern ensures port is closed
gosub get.required.phantom.port
success = 0
execute "dev-att "ort
gosub issue.command
execute "dev-det "ort
* success may be 0 or 1
return
issue.command: *
if done then
send 'exit' to port else null
return
end
send 'some command' to port else return
send 'another instruction' to port else return
send 'exec' to port else return
success = 1
return


HTH
T


eppick77 wrote:

25 years ago I wrote a system to run reports in the background at a
client site. It was on a GA system and I could have sworn that I
wrote the responses into a record and then did an execute of the
program and passed the data via data statements.

Since it was so long ago and just a memory, it is also possible that I
wrote the data out as a proc and put all the responses into the proc
and then deleted itself - I just can not remember.

Does anyone know if you can pass data into a phantom on D3?

Thanks

Eugene

Reply With Quote
  #4  
Old   
JJCSR
 
Posts: n/a

Default Re: Communicating with phantoms - 06-22-2010 , 04:01 PM



Quote:
Does anyone know if you can pass data into a phantom on D3?

Thanks

Eugene

Eugene:

I don't know if I am referencing the same issue that you speak of
here, but we have two different phantoms that are used for printing
purposes, both of which involve Visual Basic applications. Handing
of printed matter, directly from VB to PICK, through a "rule-
module" (a PICK subroutine called into VB) does not work very well.
To get around this problem, we write the Order number being addressed
in the VB app to a work file, one file for each of the VB apps. A
phantom wakes up every 15-30 seconds to see if there are order numbers
present. If so, the phantom executes the PICK program that selects/
prints the order to the desired printer. As soon as the order number
is read from the work file, it is deleted from same. Once the print
task is complete, the phantom goes back to sleep.

If you have information that varys from one process to another,
perhaps you could do a similar fiunction, whereby your phantom
searches a file for something to do; upon finding "something", rather
than an empty file, your phantom could read the necessary information
from the work file, purge the work file, complete the phantom task,
and go back to sleep.

Sorry if I have misinterpreted your request.

Best regards, and good luck.

Jim Cronin
Director MIS
Kittery Trading Post

Reply With Quote
  #5  
Old   
Kevin Powick
 
Posts: n/a

Default Re: Communicating with phantoms - 06-22-2010 , 04:04 PM



On 2010-06-22 11:36:11 -0400, eppick77 <eppick77 (AT) yahoo (DOT) com> said:

Quote:
Does anyone know if you can pass data into a phantom on D3?
Yes. Use the Z command and you'll see where in the process you have
the opportunity to stack input data.

--
Kevin Powick

Reply With Quote
  #6  
Old   
Gee
 
Posts: n/a

Default Re: Communicating with phantoms - 06-22-2010 , 04:27 PM



I have achieved something similar using two techniques -

a) Implemented a FIFO queue in a file that the phantom reads
periodically - this has the added bonus that you can see how many
requests to the phantom there are.

b) For a more busy phantom I use a socket. This has the advantage that
other hosts can send requests, and can be implemented in any language
that takes your fancy ( provided it will talk to a socket that is)..
Socket programming is a doddle using D3/Pickbasic.

Gee Goodrich

On 22 June, 21:04, Kevin Powick <nos... (AT) spamless (DOT) com> wrote:
Quote:
On 2010-06-22 11:36:11 -0400, eppick77 <eppic... (AT) yahoo (DOT) com> said:

Does anyone know if you can pass data into a phantom on D3?

Yes. *Use the Z command and you'll see where in the process you have
the opportunity to stack input data.

--
Kevin Powick

Reply With Quote
  #7  
Old   
wjhonson
 
Posts: n/a

Default Re: Communicating with phantoms - 06-23-2010 , 05:20 AM



By the date of the Sequoia implementation, a good Poke command had
been installed.

Poke allows you to push a keystroke into the input stream of any
running process.

So instead of a phantom sleeping and waking, you merely set that
phantom at an INPUT type command or some equivalent single-char input
command, and your "activating" process as part of its routine Pokes
the phantom process.

This causes the input to fall through and be acted upon, right that
moment.

No need to loop and read, its instant, and uses minimal cycles.

W.J.

Reply With Quote
  #8  
Old   
Martin Phillips
 
Posts: n/a

Default Re: Communicating with phantoms - 06-23-2010 , 06:43 AM



Hi all,

QM 2.10-4 will add an optional keyword to the PHANTOM command to
transfer the DATA queue of the parent into the phantom process.
PHANTOM DATA RUN MYPROG

A patch is available for 2.10-3. [Ross: Does this put us ahead of D3
again for responsiveness?]


Martin Phillips, Ladybridge Systems

Reply With Quote
  #9  
Old   
Ed Sheehan
 
Posts: n/a

Default Re: Communicating with phantoms - 06-23-2010 , 09:57 AM



Now if you could just issue patches BEFORE you become aware of issues, that
would be AWESOME! :-)

Ed

"Martin Phillips" <MartinPhillips (AT) ladybridge (DOT) com> wrote

Quote:
Hi all,

QM 2.10-4 will add an optional keyword to the PHANTOM command to
transfer the DATA queue of the parent into the phantom process.
PHANTOM DATA RUN MYPROG

A patch is available for 2.10-3. [Ross: Does this put us ahead of D3
again for responsiveness?]


Martin Phillips, Ladybridge Systems

Reply With Quote
  #10  
Old   
Tony Gravagno
 
Posts: n/a

Default Re: Communicating with phantoms - 06-23-2010 , 02:31 PM



Cox Subscriber <cox (AT) users (DOT) invalid> wrote:

BTW, that post was from me - as if people couldn't tell. I recently
posted anonymously to Cox cable usenet forums, which are set to go
away in a couple days.

Tony Gravagno
Nebula Research and Development
TG@ remove.pleaseNebula-RnD.com
Nebula R&D sells mv.NET and other Pick/MultiValue products
worldwide, and provides related development services
remove.pleaseNebula-RnD.com/blog (Latest blogs on Web Services for MV)
Visit PickWiki.com! Contribute!
http://Twitter.com/TonyGravagno

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.