Computing.Net > Forums > OpenVMS > OpenVMS parameters in procedures

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

OpenVMS parameters in procedures

Reply to Message Icon

Name: paredondo
Date: August 6, 2009 at 03:47:55 Pacific
OS: OpenVMS
Subcategory: Software Problems
Tags: Parameters OpenVMS
Comment:

Hello,

I am not a VMS user, but I need to change this procedure, in order to instead of reading the 2 prompts userID and Password, I want to pass them by parameter inside the procedure.

The procedure is the following:

$ set noon
$ set nocontrol=(T,Y)
$ $erro == 18 ! "%SYSTEM-E-BADPARAM, bad parameter value"
$ if f$mode() .nes. "INTERACTIVE" then exit $erro
$ n = 1
$ call get_input
$ if $erro .eq. 20 then exit $erro
$ if $erro then call check
$ if .not. $erro then write sys$output "User authorization failure"
$ loop:
$ if ($erro .or. (n .gt. 2)) then goto end_loop
$ call get_input
$ if $erro .eq. 20 then exit $erro
$ if $erro then call check
$ if .not. $erro then write sys$output "User authorization failure"
$ n = n + 1
$ goto loop
$ end_loop:
$ exit $erro
$!
$ get_input: subroutine
$ $erro == 18 ! "%SYSTEM-E-BADPARAM, bad parameter value"
$ set noon
$ set nocontrol=(T,Y)
$ nu = 1
$ loop_usr:
$ if nu .gt. 14 then exit $erro
$ read/end_of_file=doStop/prompt="Username : " sys$output uuu
$ nu = nu + 1
$ if f$length(uuu) .le. 0 then goto loop_usr
$ end_loop_usr:
$ set term/noecho
$ read/end_of_file=doStop/prompt="Password : " sys$output ppp
$ !set term/echo
$ usr == uuu
$ pwd == ppp
$ $erro == 1
$ exit
$ doStop:
$ set term/echo
$ $erro == 20
$ exit
$ endsubroutine
$!
$ check: subroutine
$ $erro == 1
$ set noon
$ set nocontrol=(T,Y)
$ define/nolog sys$output nl:
$ define/nolog sys$error nl:
$ dir/out=nl: sys$node"''usr' ''pwd'"::sys$login:login.com
$ $erro == $status
$ deassign sys$output
$ deassign sys$error
$ exit
$ endsubroutine

Any help please?
Regards,
Pedro Redondo



Sponsored Link
Ads by Google

Response Number 1
Name: SKStewart
Date: August 6, 2009 at 06:58:19 Pacific
Reply:

Pedro,

It appears that this command procedure checks for the existence of the file "login.com" on a remote node.

The simplest change would be to change the two lines:

$ n = 1
$ call get_input

to:

$ if ((p1 .nes. "") and (p2 .nes. ""))
$    then
$    usr == p1
$    pwd == p2
$    $errno == 1
$ else
$   n = 1
$   call get_input
$ endif

You would then run this procedure with the username and password as the first and second parameter:

$@procedure username password

This command automatically assigns "username" to symbol P1 and "password" to symbol P3.

I have not tested this!

Kelly


0

Response Number 2
Name: paredondo
Date: August 6, 2009 at 07:53:47 Pacific
Reply:

Hi Kelly,

Thanks for the tip, but I think there's something missing...

on the VMS prompt I do:
uid="xdt001"
pwd="123456"
@check_password uid pwd

Afther this an error message is returned:
%DCL-W-UNDSYM, undefined symbol - check validity and spelling

And the procedure is asking me the Username.

So it doesn't care of the parameters passed and is generating an erro message...

Regards,
Pedro


0

Response Number 3
Name: Joseph.Huber
Date: August 6, 2009 at 10:33:24 Pacific
Reply:

Do a SET VERIFY before invoking the procedure for debugging.

My suspicion is that the variable n is the undefined symbol.
Put n=1 in front of the "if" statement instead after the "else".

Joseph Huber, http://www.huber-joseph.de
ITRC


0

Response Number 4
Name: SKStewart
Date: August 6, 2009 at 13:39:45 Pacific
Reply:

Oops!

I did say I didn't test it :)

The problem is a typo in my suggested change. Change "and" to ".and." in the IF statement.

As Joseph said, you can enter "$ set verify" before you run the procedure. This will show you each line in the procedure as it executes, and may help you find the command that failed. You can enter "$ set noverify" to turn off the display of the individual lines.

Kelly


0

Response Number 5
Name: amuir
Date: August 8, 2009 at 14:05:45 Pacific
Reply:

Also note:

uid="xdt001"
pwd="123456"
@check_password uid pwd

The above steps would lead to the the procedure receiving P1 as "UID" and P2 as "PWD". If you want to pass the VALUES of uid and pwd into the procedure, you would need to put single quotes around those variable names to force symbol substitution (as follows):

uid="xdt001"
pwd="123456"
@check_password 'uid' 'pwd'

P.S. If you want to maintain the case of the parameters, you would need to enclose them in double quotes as follows:

@check_password "''uid'" "''pwd'"


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon





Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: OpenVMS parameters in procedures

About command Procedures in openvms www.computing.net/answers/openvms/about-command-procedures-in-openvms/570.html

saving openvms files in DOS format www.computing.net/answers/openvms/saving-openvms-files-in-dos-format/148.html

by_name parameter in the backup command www.computing.net/answers/openvms/byname-parameter-in-the-backup-command/56.html