Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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
$ endsubroutineAny help please?
Regards,
Pedro Redondo

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_inputto:
$ if ((p1 .nes. "") and (p2 .nes. "")) $ then $ usr == p1 $ pwd == p2 $ $errno == 1 $ else $ n = 1 $ call get_input $ endifYou 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

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 pwdAfther this an error message is returned:
%DCL-W-UNDSYM, undefined symbol - check validity and spellingAnd the procedure is asking me the Username.
So it doesn't care of the parameters passed and is generating an erro message...
Regards,
Pedro

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

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

Also note:
uid="xdt001"
pwd="123456"
@check_password uid pwdThe 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'"

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |