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

OpenVMS - DTR Command Inside COM File?

SOLVED
Go to solution
Shuey
Occasional Visitor

OpenVMS - DTR Command Inside COM File?

We currently have a short set of commands that we execute at the DCL prompt that enable us to attempt to unlock patient accounts/medical records that are "in use/locked".

Here are the two lines of text we enter at the DCL prompt:

cd RMH$ALLGPDS
dtr @RMH_UNLOCK_ACCOUNT

This prompts for "enter patient account number:"

Here are the contents of the "RMH_UNLOCK_ACCOUNT" file:

! RMH_UNLOCK_ACCOUNT.COM
!
! ROUTINE TO UNLOCK LOCK ACCOUNT RECORDS - KDILLER/SANDERSON 02/99
SET DICTIONARY PD_CDD
SET LOCK_WAIT
READY PDIACCMAS SHARED WRITE
READY PDImpinme SHARED WRITE
!
!DEFINE VARIABLE TO COLLECT ACCT AND QUERY USER FOR ACCT
DECLARE INPUT_ACCT PIC 9(12).
INPUT_ACCT = *."ENTER ACCOUNT NUMBER TO UNLOCK "
!
!MOVE ACCT THAT THE USER INPUT AND STORE IN THE REQUIRED FORMAT
!DECLARE WK_ACCT PIC X(12) COMPUTED BY FORMAT INPUT_ACCT USING 9(12).
!FIND LOCKED RECORD
FIND PDIACCMAS cross pdimpinme WITH CH_PNO_KEY = INPUT_ACCT and
ch_enrollment_no_key = mpi_enrollment_no and
MPI_RECORD_TYPE = "00"
!LIST THE RECORD BEFORE IT IS MODIFIED
FOR CURRENT LIST CH_SOFT_LOCK, ch_cds_soft_lock, mpi_soft_lock, CH_PT_LAST_NAMEE
MODIFY CURRENT USING CH_SOFT_LOCK = 0
MODIFY CURRENT USING CH_cds_SOFT_LOCK = 0
MODIFY CURRENT USING mpi_SOFT_LOCK = 0
!LIST THE RECORD AFTER IT IS MODIFIED
FOR CURRENT LIST CH_SOFT_LOCK, ch_cds_soft_lock, mpi_soft_lock, CH_PT_LAST_NAMEE

----------------
Ok, this is what I'd like to do: I'd like to write a script that will enable me to perform this same set of functions with a simple command like "ulpa" (script for 'unlock patient account'). I've tried creating a com file for this, as well as a symbol, but I don't know enough about OpenVMS do get it to work, and I've not been able to find any information online to help me.

If anyone can help me create this, what I think should be a fairly simple script, it would be greatly appreciated.

Thank you :)
9 REPLIES
Volker Halle
Honored Contributor
Solution

Re: OpenVMS - DTR Command Inside COM File?

Shuey,

welcome to the OpenVMS ITRC forum.

Something like this may work:

$ CREATE ULPA.COM
$ cd RMH$ALLGPDS
$ DEFINE/USER SYS$INPUT SYS$COMMAND ! read from terminal
$ dtr @RMH_UNLOCK_ACCOUNT

$ ULPA:=="@SYS$DISK:[]ULPA.COM"
$ ULPA
...

You may need to replace SYS$DISK:[] with a valid device and directory on your system.

They key here is to re-define SYS$INPUT before invoking DTR. This will cause the prompt for input to be done from the terminal, instead of from the .COM procedure itself.

Hope this helps,

Volker.
EdgarZamora_1
Respected Contributor

Re: OpenVMS - DTR Command Inside COM File?


Actually just add the two commands:

$ cd RMH$ALLGPD8
$ dtr

to the beginning of your RMH_UNLOCK_ACCOUNT.COM (right above the SET DICTIONARY command)

then (maybe in your LOGIN.COM) add the symbol definition:

$ ulpa :== @dev:[dir]RMH_UNLOCK_ACCOUNT.COM

and you should be set.
Volker Halle
Honored Contributor

Re: OpenVMS - DTR Command Inside COM File?

Edgar,

note that there is an INPUT statement in the DTR script. Without re-assigning SYS$INPUT to read from the terminal (i.e. SYS$COMMAND), it will fail.

So building upon your suggestion, adding

$ CD RMH$ALLGPDS
$ DEFINE/USER SYS$INPUT SYS$COMMAND
$ DTR

at the beginning of that script should also work. But then users, who still follow the old habit of invoking those commands seperately, will fail...

Volker.
Steven Schweda
Honored Contributor

Re: OpenVMS - DTR Command Inside COM File?

> $ cd RMH$ALLGPDS

In general, I'd advise against using a symbol
like this "cd" in a DCL procedure, unless
you're sure that every user of the procedure
has (and always will have) the same
definition for that symbol.

I've seen too many DCL procedures fail like:

%DCL-W-IVVERB, unrecognized command verb - check validity and spelling
\SAY\

because its author had "say" defined:

say == "write sys$output"

and I didn't.
EdgarZamora_1
Respected Contributor

Re: OpenVMS - DTR Command Inside COM File?

I missed that one, Volker!
Shuey
Occasional Visitor

Re: OpenVMS - DTR Command Inside COM File?

Thank you to everyone who replied, I really appreciate it! :)

Volker: I will use the info you gave me to try and create this script within the next week. I'll reply back to let you know how it goes ;)
Shuey
Occasional Visitor

Re: OpenVMS - DTR Command Inside COM File?

Big thanks to Volker for the help!!

Here is what we came up with:

We created a file ulpa.com

$ set def RMH$ALLGPDS
$ DEFINE/USER SYS$INPUT SYS$COMMAND
$ dtr @RMH_UNLOCK_ACCOUNT
$ set def sys$login

and we added these lines to our login.com file:

$ ulpa :== @DISK$SMSUSER1:[PRDOPER]ulpa.com
$ ulmr :== @DISK$SMSUSER1:[PRDOPER]ulmr.com

These scripts work great now

Thank you again to everyone, but especially thanks to Volker!!
Hein van den Heuvel
Honored Contributor

Re: OpenVMS - DTR Command Inside COM File?

>> Big thanks to Volker for the help!!

I'm glad you are happy, but pease realize that it is a total BS solution, which SUBTRACTS value from the system instead of adding.

- It adds a file --> more dependencies
- It has the side effect of forcing a users back to SYS$LOGIN on exit


Why not just use:

$ ulpa :== "dtr @RMH$ALLGPDS:RMH_UNLOCK_ACCOUNT"

That does not change the default directory.
Consequently it requires the data files to be in a well defined place. If this simpler setup fails with a file open problem then you need to look at the two domain definitions.
Go into datatrieve and issues:
DTR> SHOW PD_CDD.PDIACCMAS
:
This will show how it uses a record definition on a file. Check the file specification. Add RMH$ALLGPDS: if need be, or make sure a logical name for the file is in place.

But skipping the negative value intermediate procedure probably is still not the optimal solution. You should probably consider storing the all the command from RMH_UNLOCK_ACCOUNT into the datatrieve dictionary as a procedure. That way everything lives together.
DTR> DEFINE PROCEDURE PD_CDD.RMH_UNLOCK_ACCOUNT
:
DTR> END_PROCEDURE

Now define your dcl command as:

$ ulpa :== "dtr :PD_CDD.RMH_UNLOCK_ACCOUNT"

Good luck!
Hein
Shuey
Occasional Visitor

Re: OpenVMS - DTR Command Inside COM File?

Thanks for the reply. You're right, I had the script running fine yesterday but now it's broken...

I don't know enough about OpenVMS and the info you gave me, so I'm going to have one of our admins or analysts help me with this.

Thank you for the info. I'll reply back once I have a correct, working script :)