Title: Access Record From Another Product Line
bosbeck - June 14, 2007 08:36 PM (GMT)
Hi, I'm writing a program to run over the HR Employee table to generate input records for another program. I did a 'find' to access each employee id in another product line's table so that I could skip writing anyone found to my program's output file and found out that programs can't access tables in other product lines. Has anyone found a way around this? I was looking into dumping the other product line's table and somehow using an indexed sequential workfile for the dumped data with an appropriate key, but I can't find how to do this and have no experience using indexed seq files. Thanks in advance for assistance.
ssun - June 14, 2007 11:25 PM (GMT)
Are you trying to access a table in the LOGAN productline? Why would you have a table that exist in one productline but not the other?
You define a index sequetial file in workdef. Then you need to open the file for input to populate the file first in your program. Then you can open the file again in your program to do lookups. Look at HR511. The PRSWORK is an example of an ISAM file
schroncd - June 15, 2007 06:56 AM (GMT)
You can open files in other productlines (for reading) if you define them as VIEWS. See your Enterprise Database Administration manual for more information. :cof:
bosbeck - June 19, 2007 05:59 PM (GMT)
Thanks to both of you. Was out sick, will look at ref and hr511.
Milo - June 20, 2007 12:58 PM (GMT)
bosbeck:
It's possible, if you need to, to spawn a UNIX shell command via the "CALL SYSTEM" command. For instance, you could:
-- start program
-- CALL SYSTEM to execute a RNGDBDUMP command,
from that table in the other product line,
to a file in your $HOME directory
-- Open work file
-- Input data from file in $HOME directory
-- close work file
-- reopen work file for reading
There you go! I've actually seen a version of this done, and it works just fine. Complicated as anything, so document it well or it becomes a real head-banger to maintain.
Let me know if you want to see code examples.
-- Milo --
bosbeck - June 20, 2007 04:25 PM (GMT)
Hi Milo, I'd appreciate seeing code since I don't know how to prepare and access the dumped table to check for the existence of an employee whose record I'm processing in my program in the other prod line. Each time I run my program I'd first need to dump the table.
Thanks,
Bert
bosbeck - July 10, 2007 06:05 PM (GMT)
Another programmer and I put together a solution like Milo's and it works. Thanks to all.
Bert