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!

saveing output as to a variable

Status
Not open for further replies.

amar7312000

Technical User
Mar 11, 2003
12
US
I am trying to do a command and from output of the command. I want to same the 20 characters after the output says "LINE EQUIPMENT NUMBER:" and use it for the next command. Is there a command in Procomm that ables me to do that?
 
sorry guys...I had a typo on this so i am rewriting it....


I am trying to do a command and from output of the command. I want to save the 20 characters after the output says "LINE EQUIPMENT NUMBER:" and use it for the next command. Is there a command in Procomm that ables me to do that?
 
Hello,

Are you working with a DMS 100 Switch ? Most of the time I use the TRANSMIT Command and send a QDN Message to the Switch. I then Capture the Switch Output to a file, parse the file for the LEN Location.

Hank
 
Yes, I am working with the DMS. I am fairly new to Aspect. Do you have a script that is built that i can see? I am trying to see if I can make anything a little easier for us in servord...
 
I have been using the transmit command but I just dont know what you mean by parse the file for the LEN? Is that a command or another sub program that has to be written in the source program?
 
Amar,

I'll put a Script together and post it today.

Hank
 
Amar,

I just tested this in the Switch. Hopefully this will get you started. If you need any help with the Servord, let me know.

Hank

Proc Main
String sLine
String sTok1, sTok2, sTok3, sOutput
String sSi, sLc, sUn, sDr, sCa

set Capture Path "C:\Files"
set Capture File "QDN.txt"
set Capture Overwrite ON
set Capture Query OFF

Transmit "^M"
pause 1
Transmit "^M"
pause 1
Transmit "QDN 6536083^M"
Capture on
Waitfor ">" 10
Capture off

If Not isfile "C:\Files\QDN.txt"
Usermsg "ERROR: Capture File Missing !"
Exit
Endif

Fopen 1 "C:\Files\QDN.txt" READ
While Not Feof 1
Fgets 1 sLine
If strfind sLine "LINE EQUIPMENT"
strtok sTok1 sLine " " 1 ;* LINE
strtok sTok2 sLine " " 1 ;* EQUIPMENT
strtok sTok3 sLine " " 1 ;* NUMBER:
strtok sSi sLine " " 1 ;* SITE
strtok sLc sLine " " 1 ;* LCM
strtok sUn sLine " " 1 ;* Unit
strtok sDr sLine " " 1 ;* Drwr
strtok sCa sLine " " 1 ;* Card
Endif
Endwhile
Fclose 1

Strfmt sOutput "%s %s %s %s %s" sSi sLc sUn sDr sCa

Usermsg "LEN IS: %s" sOutput

Endproc
 
That helps a lot...thanks soo much...I am going to try to build a program that asks me for the numbers an takes them out...ofcourse, it will ask me if i am sure i want to take the number out....thanks you very much...if i have any questions I will def. let you know....do you have any other scripts built that would come in handy for me? I would apprecitate it very much.....
 
Amar,

I'll see if I can come up with a Servord Script this weekend at work. Are you going to build a File with the numbers to be removed ? Or is this a 1 Number at a Time situation ? Any additional info on the Servord script would help.

Hank
 
well, i was just going to see if i can eloborate on this script..I was going to build a script that asks for the amount of number to be deleted and then asks for each separate number...If it is too much trouble dont worry about it...you have been a great help..thanks again..
 
Amar,

What you could do is have a Dialog Box appear and enter each number in the Box. You could continue to enter numbers and when you've finished, have an Execute Button. All the Numbers entered could then be removed. That should not be too hard to do.

Hank
 
i cant get the len assignment to work in a transmit statement.....
 
Here is the script that i made to delete numbers in the switch....I wanted to make a script to delete only one before i get fancy. I am able to get all the way to the output. For some reason when i add the carriage return in the transmit statement it ereases the LEN assignment..


Proc Main
String sLine
String PhoneNum
String sTok1, sTok2, sTok3, sOutput
String sSi, sLc, sUn, sDr, sCa

integer Event ; Dialog box event.

; Define and display dialog with edit box phone number dialogbox 0 0 0 100 70 11 "Phone Number"
editbox 1 5 5 90 40 PhoneNum

pushbutton 2 25 50 50 14 "Add number you want to delete"
enddialog
while 1
dlgevent 0 Event ; Read dialog event.
switch Event ; Evaluate dialog event.
case 0 ; No event occurred.
endcase

case 1 ; Edit box was changed.
endcase
default ; Exit event selected.
exitwhile ; Exit the loop.
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL ; Destroy dialog box.



set Capture Path "C:\Files"
set Capture File "QDN.txt"
set Capture Overwrite ON
set Capture Query OFF

Transmit "Leave all ^M"
pause 1
Transmit "^M"
pause 1

transmit "servord ^M"
Transmit "QDN "
Transmit PhoneNum
transmit " ^M"
Capture on
Waitfor ">" 10
Capture off

If Not isfile "C:\Files\QDN.txt"
Usermsg "ERROR: Capture File Missing !"
Exit
Endif

Fopen 1 "C:\Files\QDN.txt" READ
While Not Feof 1
Fgets 1 sLine
If strfind sLine "LINE EQUIPMENT"
strtok sTok1 sLine " " 1 ;* LINE
strtok sTok2 sLine " " 1 ;* EQUIPMENT
strtok sTok3 sLine " " 1 ;* NUMBER:
strtok sSi sLine " " 1 ;* SITE
strtok sLc sLine " " 1 ;* LCM
strtok sUn sLine " " 1 ;* Unit
strtok sDr sLine " " 1 ;* Drwr
strtok sCa sLine " " 1 ;* Card
Endif
Endwhile
Fclose 1

transmit "out $ "
transmit PhoneNum
Transmit " "
transmit sSi
transmit " "
transmit sLc
transmit " "
transmit sUn
transmit " "
transmit sDr
transmit " "
transmit sCa
transmit " bldn $ y "
transmit "^M"




Endproc
 
Amar,

I'll look over the Script tonight and Test it in the Switch in the Morning.

Hank
 
thanks...talk to ya tomorrow..I will also try it out tonight.
 
I made some changes yesterday but just @#$% it is up even more....
 
Hank,

I am still having problems getting this script to work...it sends everything right except for the len. can you help?
 
Amar,

Have been working on E-Net Trouble; I think the LEN issue has to do to timing. Hope to resolve this week.

Hank
 
Here is the Solution I came up with. Note that there is no Error Checking !! This should get you started down the right road.


Hank


String sLine
String PhoneNum
String sTok1, sTok2, sTok3, sLen
String sSi, sLc, sUn, sDr, sCa
Integer Event ;* Dialog box event.

Proc Main

set Capture Path "C:\Files"
set Capture File "QDN.txt"
set Capture Overwrite ON
set Capture Query OFF

If isfile "C:\Files\QDN.txt"
delfile "C:\Files\QDN.txt"
Endif

Capture on
Transmit "Leave all ^M"
pause 1
Transmit "^M"
pause 1
Transmit "servord^M"
pause 1
Waitfor "SO:" 2
pause 1

; Display dialog with edit box phone number

Dialogbox 0 205 94 264 169 2 "Caption"
text 2 85 35 90 12 "SET NUMBER TO BLDN" Center
editbox 1 100 49 60 16 PhoneNum
pushbutton 3 103 74 58 16 "EXECUTE"
pushbutton 4 201 138 48 17 "EXIT"
Enddialog
while 1
yield
dlgevent 0 Event ; Read dialog event.
switch Event ; Evaluate dialog event.
case 0 ; No event occurred.
endcase
case 1 ; Edit box was changed.
endcase
case 3
Start()
endcase
case 4
Exit
endcase
default ; Exit event selected.
exitwhile ; Exit the loop.
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL ; Destroy dialog box.

Endproc

Proc Start

Transmit "QDN^M"
Waitfor "DIRECTORY" 2
Transmit PhoneNum
Transmit "^M"
Waitfor ">" 2
Pause 5
Capture off

Fopen 1 "C:\Files\QDN.txt" READ
While Not Feof 1
Fgets 1 sLine
If strfind sLine "LINE EQUIPMENT"
strtok sTok1 sLine " " 1 ;* LINE
strtok sTok2 sLine " " 1 ;* EQUIPMENT
strtok sTok3 sLine " " 1 ;* NUMBER:
strtok sSi sLine " " 1 ;* SITE
strtok sLc sLine " " 1 ;* LCM
strtok sUn sLine " " 1 ;* Unit
strtok sDr sLine " " 1 ;* Drwr
strtok sCa sLine " " 1 ;* Card
Strfmt sLen "%s %s %s %s %s" sSi sLc sUn sDr sCa
Endif
Endwhile
Fclose 1
Transmit "OUT^M"
Waitfor "SO" 5
Transmit "$^M"
Waitfor "DN" 5
Transmit Phonenum
Transmit "^M"
Waitfor "LEN" 5
Transmit sLen
Transmit "^M"
Waitfor "INT" 5
Transmit "BLDN^M"
Waitfor "Ent" 5
Transmit "Y^M"
Waitfor ">" 5

Endproc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top