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!

Meridian System Speed Call List Script

Status
Not open for further replies.

lexer

Programmer
Jun 13, 2006
432
VE
Hi

I'm trying to creat a script for adding SCL numbers from a CSV file this the Program:

proc main

string sline, pos,num,numPos

string Name = "file.cap" ; Name of capture file to open.

set capture file Name ; Set name of capture file.




capture on ;Start the capture

TRANSMIT "^M"
TRANSMIT "LD 18^M"
WAITFOR "REQ "
TRANSMIT "CHG^M"
waitfor "TYPE"
transmit "SSC^M"
waitfor "LSNO"
transmit "98^M"
transmit "^M"
transmit "^M"
transmit "^M"
transmit "^M"

set txpace 50
fopen 0 "C:\PC\SCL.csv" read
while not feof 0
fgets 0 sline
strtok pos sline ";" 1 ;Get number position
strtok num sline ";" 1 ;Get number to be write

numPos=" " ;Insert a space
strcat numPos num ;Insert a space before the number
strcat pos numPos ;Add the number to the SSC position

; Transmit the information to PBX
WAITFOR "STOR "
TRANSMIT pos ;Send the Position and the number example 000 92124545
TRANSMIT "^M"
WAITFOR "WRT " ;Confirm thw write
TRANSMIT "YES^M"
endwhile
fclose 0
capture off ; Close the capture file.

endproc

This is the CSV file, first the SSC position the telephonenumber:

000;92324547;s
001;93568745;s
002;92512095;s
003;93542514;s

The posiiton 000 and 001 are writen ok, but the program stuck from postion 002 this the capture (from capture on command):

>LD 18
SCL000
MEM AVAIL: (U/P): 2500278 USED U P: 541292 71389 TOT: 3112959
DISK RECS AVAIL: 896
REQ CHG
TYPE SSC
LSNO 98
NCOS
DNSZ
SIZE
WRT (ADDS: MEM: 0 DISK: 0.0)
STOR 000 92324547
WRT YES
STOR 001 93568745
WRT YES
STOR 002 SCH461
STOR 92512095
SCH461
STOR

Any Idea?



 
I don't see anything obviously wrong with the script, and it seems odd to me that you would be able to get two records in successfully and then have an issue with your logic. What happens if you try those same values manually? I'm not familiar with the hardware you're working with, but that would be my first try.

 
One suggestion:

Code:
waitfor "WRT " forever

In my limited experience, waitfor tends to timeout and this confuses the program.

Where is the SCH461 coming from? It's not in your CSV file? Make sure there's not some garbage in your source CSV file (try opening it in notepad, or something similar.)
 
Thanks kodr

This program is for Meridian PBX, The SCH461 is a error message that sends the PBX for entering a invalid data.
I dont know If I'm sendind the data to fast for the PBX (PBX speed 9600 BPS), I`ve got send something like this(300 codes, 000 to 299):

000 92324547
001 93568745
002 92512095
003 93542514

Can I read a whole line (for example 000 92324547) and assing it to variable, Then send the whole line to the PBX (Maybe fgets?)
 
Thanks kodr

This program is for Meridian PBX, The SCH461 is a error message that sends the PBX for entering a invalid data.
I dont know If I'm sendind the data to fast for the PBX (PBX speed 9600 BPS), I`ve got send something like this(300 codes, 000 to 299):

000 92324547
001 93568745
002 92512095
003 93542514

Can I read a whole line (for example 000 92324547) and assing it to variable, Then send the whole line to the PBX (Maybe I can use fgets)
 
Just as a test, try replacing this part of your code:

Code:
     WAITFOR "STOR "            
     TRANSMIT pos 
     waitquiet 3 forever
     TRANSMIT "^M"
     waitquiet 3 forever
     WAITFOR "WRT "  forever
     TRANSMIT "YES^M"

This will slow things down a bit and see if the data is going too fast.

Also, it might be worth trying:

Code:
     strcat pos "^M"
     transmit pos
     waitfor "WRT " forever
     transmit "YES^M"
 
Thanks kodr

The script is working, The issue was the PBX modem, I changed the modem and the script worked
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top