Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing along value of string variables ....

Status
Not open for further replies.

teletubby5e

Technical User
Oct 31, 2002
147
US
alright,
another bonehead question for the forum ......
I am trying to write a quick script to enter numbers into my switch to change or enter their hunting sequence. basically you have a telephone number "hunted from" (called num1) and the telephone number "hunted to" called (num2), and then it repeats for as long as there is not a null fileld in the "hunted to" (num2) string. i have it working now, but you have to input num1 and num2, then re-type num2 in the num1 field when it runs again. i would like to be prompted for the 1st number once, then the second number once, then have procomm pass the string value of num2 to become the value for num1, then prompt you for the new value of num2. so that when processing a list of 10 numbers in a hunt group, i only have to eenter in a total of 10 telephone numbers once each, instead of having to enter in 10 unique numbers (9 twice) for a total of 19 entries. many thanks for any help in this ....

PROC MAIN

STRING NUM1
STRING NUMHUNT
INTEGER ANSWER

STRING NUM2
STRING NUMHUNT2

TRANSMIT "RCV:APPTEXT!"
WAITFOR ": "

ANSWER = 1
WHILE ANSWER > 0

SDLGINPUT "TN" "ENTER NUMBER TO HUNT FROM:" NUM1
STRLEN NUM1 ANSWER

REPEET:
STRFMT NUMHUNT "TN=%.10s!" NUM1

SDLGINPUT "HUNT TO" "NUMBER YOU WANT IT TO HUNT TO:" NUM2
STRLEN NUM2 ANSWER
STRFMT NUMHUNT2 "SET=`"SERHLN`"&`"%s`"!" NUM2
IF STRCMP NUM2 ""
HALT
ELSE NUM1 = NUM2
GOTO REPEET
ENDIF

TRANSMIT "FORM=1V6&CHG!"
WAITFOR ": "

TRANSMIT NUMHUNT
WAITFOR ": "

TRANSMIT NUMHUNT2
WAITFOR ": "

TRANSMIT "CHG!"
WAITFOR ": "

ENDWHILE
 
What is happening is that you are never breaking out of the if statement, so none of your transmit statements below are being executed. You may want to move the waitfor/transmit statements under the else clause of the if statement and see if that gives you the results you expect.
aspect@aspectscripting.com
 
thanks for the tip.
i did that and just restated the num1=num2, then restated the value of the string leadnum.
the following works great.
thanks again!


PROC MAIN

STRING NUM1
STRING leadnum
INTEGER ANSWER

STRING num2
STRING nextnum

TRANSMIT "RCV:APPTEXT!"
WAITFOR ": "

ANSWER = 1
WHILE ANSWER > 0

SDLGINPUT "TN" "ENTER NUMBER TO HUNT FROM:" NUM1
STRLEN NUM1 ANSWER
STRFMT leadnum "TN=%.10s!" NUM1

getnext:
SDLGINPUT "HUNT TO" "NUMBER YOU WANT IT TO HUNT TO:" num2
STRLEN num2 ANSWER
STRFMT nextnum "SET=`"SERHLN`"&`"%s`"!" num2
if nullstr num2
halt
else

TRANSMIT "FORM=1V6&CHG!"
WAITFOR ": "
TRANSMIT leadnum
WAITFOR ": "

TRANSMIT nextnum
WAITFOR ": "

TRANSMIT "CHG!"
WAITFOR ": "
endif
num1=num2
STRFMT leadnum "TN=%.10s!" NUM1
goto getnext

ENDWHILE
ENDPROC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top