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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CS1000 Zoc REXX Scripting question

Status
Not open for further replies.

SherWat

Technical User
Feb 12, 2016
216
CA
I have also posted this to the REXX forum but am posting here as this forum has more activity.

I am working on a script to change multiple parameters on sets on a CS1000 PBX. I am learning REXX as I go.
I am able to create a script that does the changes but it doesn't care if the phone is busy or idle.
What command would be used to check the state of the phone, and if busy, don't do the change but end?


Code:
CALL ZocWaitForSeq "on"

CALL ZocSetLogfileName "c:\temp\changes.txt"

CALL ZocSend "ld 20^M"

CALL ZocWait "REQ:"
CALL ZocSend "stat 248 0 0 8^M"

CALL ZocWait "REQ:"
CALL ZocSend "CHG^M"

CALL ZocWait "TYPE:"
CALL ZocSend "1230^M"

CALL ZocWait "TN"
CALL ZocSend "248 0 0 8^M"

CALL ZocWait "ECHG"
CALL ZocSend "yes^M"

CALL ZocWait "ITEM"
CALL ZocSend "fdn 7000^M"

CALL ZocWait "ITEM"
CALL ZocSend "hunt 7000^M"

CALL ZocWait "ITEM"
CALL ZocSend "key 16 mwk 7000^M"

CALL ZocWait "KEY"
CALL ZocSend "^M"

CALL ZocWait "ITEM"
CALL ZocSend "^M"

CALL ZocWait "REQ:"
CALL ZocSend "****^M"
Running the above does the change and results in output that looks like this:
>ld 20

PT0000
REQ: stat 248 0 0 8
IDLE REGISTERED 00
REQ: CHG
TYPE: 1230
TN 248 0 0 8
ECHG yes
ITEM fdn 7000
ITEM hunt 7000
ITEM key 16 mwk 7000
KEY
ITEM


But how would I get the script to check if the IDLE RESISTERED line reads BUSY REGISTERED to then either wait 30 seconds and do the stat command again, or skip to the next record.

Thank you.
 
You would start a capture then read the output so

CALL ZocWait "REQ:"

CALL ZocFileDelete("C:\ZOCFILES\status.LOG") <--deletes the capture file if it exists
ZocLogname "C:\ZOCFILES\status.LOG" <--Names the capture file
CALL ZocLogging 1,1 <--Starts capture
CALL ZocSend "stat 248 0 0 8^M"
CALL ZocLogging 0,1 <--stops capture

/////////////////////////Dont't put this bit in/////////////////////////////
That gets the output in a log file and the contents would be something like

REQ: stat 248 0 0 8
IDLE REGISTERED 00
REQ:

Carry on script with the below
///////////////////////////////////////////////////////////////////////////


DO 3
fileid = linein('C:\ZOCFILES\status.LOG') <--Takes a line of log file and assigns to variable fileid

PARSE VALUE fileid WITH input <--Parses line into a variable input (this can be use for CSV (value1","value2 etc.)

stat = SUBSTR(input,1,4) <--variable stat is assigned 4 characters starting at 1st
IF stat = "IDLE" THEN CALL CHG
ELSE IF stat = "BUSY" THEN CALL FINISH
END
EXIT <--This is a cop out in case it doesn't get a match after 3 lines (DO 3) don't want a never ending loop

CHG:
CALL ZocSend "CHG^M"
and the rest of your script

FINISH:
CALL ZocSend "****^M"
CALL ZocDelay 1
EXIT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top