#41985 - 2003-06-23 07:36 PM
Subnet/Sub-subnet detection question
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Running into a bit of a snag here. Hope this is not too lame, but I am going cross-eyed.
Running the following test code -
code:
cls break on $1st=ltrim(split(@ipaddress0,'.')[0]) $2nd=ltrim(split(@ipaddress0,'.')[1]) $3rd=ltrim(split(@ipaddress0,'.')[2]) $4th=ltrim(split(@ipaddress0,'.')[3]) $ipadr='$1ST.$2ND.$3RD.$4TH' SELECT CASE $2nd=13 MIGRATE SCRIPT CASE $2nd=53 OR $2nd=110 OR $2nd=38 OR $2nd=126 GOTO SCRIPT CASE $2nd=50 $subnetname=Split('0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 23 195') FOR EACH $element IN $subnetname ?$element IF $element=$3rd MIGRATE SCRIPT ELSE SCRIPT ENDIF NEXT ;CASE 1 ; GOTO SCRIPT ENDSELECT get $ ?"Stop here"
FUNCTION MIGRATE() ?"MIGRATE" get $ ENDFUNCTION
FUNCTION SCRIPT() ?"SCRIPT" ENDFUNCTION
get $
So.. What is going on? If I am at the 195 sub-subnet, it wants to run all of the others first. What I really need is to evaluate the whole array and then go on.
Kent
|
|
Top
|
|
|
|
#41990 - 2003-06-23 08:04 PM
Re: Subnet/Sub-subnet detection question
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Here is the code and works fine. Thanks for the suggestions and setting me straight.
Note: The uncommented and commented out code.
code:
cls break on $1st=ltrim(split(@ipaddress0,'.')[0]) $2nd=ltrim(split(@ipaddress0,'.')[1]) $3rd=ltrim(split(@ipaddress0,'.')[2]) $4th=ltrim(split(@ipaddress0,'.')[3]) $ipadr=''+$1ST+'.'+$2ND+'.'+$3RD+'.'+$4TH SELECT CASE $2nd='13' MIGRATE SCRIPT CASE $2nd='53' OR $2nd='110' OR $2nd='38' OR $2nd='126' GOTO SCRIPT CASE $2nd='50' $subnetname=Split('0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 23 195') FOR EACH $element IN $subnetname ?$element IF $3rd=$element MIGRATE SCRIPT ;ELSE ; SCRIPT ENDIF NEXT CASE 1 GOTO SCRIPT ENDSELECT get $ ?"Stop here"
FUNCTION MIGRATE() ?"MIGRATE" get $ ENDFUNCTION
FUNCTION SCRIPT() ?"SCRIPT" ENDFUNCTION
get $
Thanks,
Kent [ 25. June 2003, 16:59: Message edited by: kdyer ]
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|