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!

INVALID NUMBER ERROR IN DACS SCRIPT 1

Status
Not open for further replies.

teletubby5e

Technical User
Oct 31, 2002
147
US
I AM CERTAIN THAT I AM MISSING SOMETHING BASIC HERE ... BUT I CAN'T GET THIS SCRIPT TO COMPILE. IT ERRORS OUT ON LINE 23 SAYING "INVALID NUM". AS I AM NOT A PROGRAMMER, ANY HELP WILL BE GREATLY APPRECIATED ... THANKS! JEFF

PROC MAIN

STRING STARTNUM
STRING ENDNUM
STRING XCONN
STRING STSNUM
STRING FACTYPE
INTEGER NUM1
INTEGER NUM2

ERRORLOOP:
SDLGINPUT "ENTER" "STS OR DS3 NUMBER (i.e. 17 OR 160, etc.)" STSNUM
SDLGINPUT "ENTER" "FACILITY TYPE (T1 or VT1)" FACTYPE
SDLGINPUT "ENTER" "STARTING VT NUMBER (i.e. 1)" STARTNUM
SDLGINPUT "ENTER" "ENDING VT NUMBER (i.e. 28)" ENDNUM

;ATOI STARTNUM NUM1 ; CONVERT TO INTEGER SO WE CAN INCREMENT
;ATOI ENDNUM NUM2


MAINLOOP:
;===BEGIN SUBROUTINE
IF FACTYPE="VT1"
STRFMT XCONN "ENT-CRS-VT1::VT1-%s-%s,VT1-%s-%s:CTAG::1WAY::;" STSNUM STARTNUM STSNUM STARTNUM
ELSE
;IF FACTYPE="T1"
STRFMT XCONN "ENT-CRS-T1::%s-%s,%s-%s:CTAG::1WAY:::;" STSNUM STARTNUM STSNUM STARTNUM
ENDIF

TRANSMIT XCONN
WAITFOR "COMPL" FOREVER

STATMSG "BUILDING XCONN %s-%s-%s" STSNUM FACTYPE NUM1
MSPAUSE 250 ; PAUSES A QRTR OF A SEC

;===END SUBROUTINE

ATOI STARTNUM NUM1 ; CONVERT TO INTEGER SO WE CAN INCREMENT
ATOI ENDNUM NUM2

IF NUM2<NUM1
USERMSG &quot;FIRST NUMBER MUST BE LESS THAN ENDING NUMBER&quot;
GOTO ERRORLOOP
ELSE
ENDIF

NUM1++ ; ADDS 1

ITOA NUM1 STARTNUM ; CONVERT TO STRING
ITOA NUM2 ENDNUM


IF NUM1==NUM2+1 ; CK TO SEE IF COMPLETE
TRANSMIT &quot;;&quot;
USERMSG &quot;COMPLETED&quot;
HALT
ELSE
GOTO MAINLOOP
ENDIF

ENDPROC
 
Since FACTYPE is a string instead of an integer, you should use the strcmp command to compare it to VT1. Here is how the command should look:

IF STRCMP FACTYPE &quot;VT1&quot;

aspect@aspectscripting.com
 
aaaaRRGGGGHHH!!!

Many thanks. Works great. I ended up learning a new command &quot;STRCIMP&quot; in case someone types in lowercase as well. My hat is off to you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top