Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Perl and DATATRIEVE

Iris_8
Occasional Visitor

Perl and DATATRIEVE

Hi all...

Can I run a DTR directly from a perl (not running a DCL containing DTR)?


Thanks,

Iris

7 REPLIES
Mobeen_1
Esteemed Contributor

Re: Perl and DATATRIEVE

Iris,
Could you give us some additional details please on what you are trying to accomplish.

regards
Mobeen
Hein van den Heuvel
Honored Contributor

Re: Perl and DATATRIEVE


Yes of course. But the perl must create the same 'environment' as the DCL wrapper would have. Some logical names might be needede. but otherwise you can just fork, or use backticks or 'open' the command and read or write its results.
Did you not just try? Was there a problem?

Hein.
Iris_8
Occasional Visitor

Re: Perl and DATATRIEVE

Well,,,

I have a perl script that convert long text file to a csv.
For every line i need to query an RMS database via DTR, by using some values from a perl hash. I could - off course - create a DCL that contain the DTR query for each line, run it grab the result into the perl, but I hoped maybe via Perl library (as for RDB), I could DTR directly.

Thanks,

Iris
Ian Miller.
Honored Contributor

Re: Perl and DATATRIEVE

you can access RMS indexed files directly from perl. I'm unaware of a perl to DTR interface module. Parhaps you could keep DTR running in a subprocess and feed it commands?
____________________
Purely Personal Opinion
Hein van den Heuvel
Honored Contributor

Re: Perl and DATATRIEVE


What 'value' does DTR add? Does it just return a record for a given key or is is doing some joins, table-lookups, blah blah?

Many ways to skin that cat.

- As Ian mentions... check out the IDX access module for perl.

- As Ian also mentions... just keep DTR alive in a (forked/opened) subprocess and feed it new commands, retrieving each result from an other mailbox (sys$output for dtr).

- Or keep a DCL process alive to do READ/KEY from.

- Or (my prefence probably) have that perl script spit out an intermediate file, use that in the request to DTR (to do a 'cross' with it).

- Have DTR call perl or anhy other language to do the CSV.

- Have DTR do the CSV?

Hein.




Craig A Berry
Honored Contributor

Re: Perl and DATATRIEVE

The cleanest way to do this, as some have indicated, is to use the Perl extension designed specifically for accessing RMS indexed files via a tied hash. You will find it here:

http://search.cpan.org/~bhughes/VMS-IndexedFile-0_02/

If you don't have a C compiler, there is a prebuilt Perl 5.6.1 here that has the extension in it:

http://www.sidhe.org/misc/perl-5_6_1-vmsaxp-7_2-1.zip

and I believe the Freeware 6.0 CD has a Perl 5.8.3 kit that also includes VMS::IndexedFile.
Martin P.J. Zinser
Honored Contributor

Re: Perl and DATATRIEVE

Hi,

as the person who did the kit for the freeware V6 I can confirm that VMS::IndexedFile is on the CD. I do use it fairly regularly and it does work nicely for me.

Greetings, Martin