Ihave 4500 500 sets to build on an option 81. The script stops on the first set at CLS , the script pulls the info from 2 tab delimited files , one for the set details and one for the cls details. I have copied the files I am using.
Any help would be greatly appreciated.
;General programming of all sets, Analog & Digital (Including ACD sets)
;NEW*** now accomodates IP set programing, i2001, i2002, i2004 and i2050
;for small and large systems
;The SCL will be also programmed automaticaly.
;File name: SETINPUTrls4.WAS
;****************************************************************************
#IFNDEF PW1GLOBALS
#DEFINE PW1GLOBALS
integer pw1strcmp = 0
integer pw1strfindcase = 0
integer pw1switchcase = 0
integer pw1waitforcase = 0
integer pw1whencase = 0
string pw1ddirpath = $pwlocalpath
integer pw1printraw = 0
integer pw1helpid = -1
integer found = 0
#define PW1WHENTARGET(id,string,name) \
IF pw1whencase #\
WHEN TARGET id string MATCHCASE CALL name #\
ELSE #\
WHEN TARGET id string CALL name #\
ENDIF
#ENDIF
;****************************************************************************
; This program reads an excel input filse saved as TAB DELIMETED TEXT files
; File 1 : input file is 2000DAT.TXT or ISET.TXT or 500DAT.TXT
; File 2 : output log file is SETOUT.DOC
; File 3 : CLS template file MUST EXIST: CLS-TEM.TXT
;********************************************************************************
;
;************
;File locations changed to be in "C:\TASKS\...". This was done to ensure the running of the script is a delebrate action
;rather than accidental from the ASPECT pick list
;
;Added IP set programing options
;
;FILE EXTENSION NAMES changed to ".TXT" to prevent accidental modification in MS Word
;IF NOT routines for BUID/NUID and MOTN/HOTN added to differentiate between large and small system prompts
;
;
; N O T E S
; Prompt SCI may not be used,
; put them between command lines
;
; #DEFINE inp_2000_file "..\INPUT\2000DAT.DOC"
; #DEFINE inp_500_file "..\INPUT\500DAT.DOC"
; #DEFINE inp_iset_file "..\INPUT\ISET.DOC"
; #DEFINE cls_file "..\INPUT\CLS-TEM.DOC"
; #DEFINE output_file "..\INPUT\SETOUT.DOC"
;
#DEFINE inp_2000_file "C:\TASK\2000DAT.TXT"
#DEFINE inp_500_file "C:\TASK\500DAT.TXT"
#DEFINE inp_iset_file "C:\TASK\ISET.TXT"
#DEFINE cls_file "C:\TASK\CLS-TEM.TXT"
#DEFINE output_file "C:\TASK\SETOUT.TXT"
;
; STRING set_type, tn , des, fdn, ncos, rnpg, scpw , sgrp, cls_temp, efd, hunt, eht, spid, dn
;digital and analog
STRING set_type, tn, des, buid, motn, kem, zone, fdn, ncos, rnpg, scpw, sgrp, cls_temp, efd, hunt, eht, spid, dn
STRING str_input, cls_string, key_str, feature, set_array[100]
STRING xlst="", ten="", ssu="10", aom="" ; Use for extra parameter in the Input File
INTEGER array_cnt, nbr_star, scc_pos
INTEGER key, Event, index, cls_previous=1, cls_current=1, read_counter
INTEGER num_extra_param=0
STRING PromptList = "None,XLST,TEN,SSU,AOM"
STRING PromptItem = "None", Xparam1 = "None", Xparam2 = "None"
STRING ProgList = "Program Digital Sets,Program IP Sets,Program Analog Sets"
STRING ProgItem = "Program Digital Sets"
STRING ParamList = "None,Extra Parameters Needed"
STRING ParamItem = "None"
STRING DnszList ="16,20,24,28", SizeList ="10,20,30,40", ProgSCL = "YES"
STRING dnsz="20",_size="10",lsno
#ifndef _pw1main
#define _pw1main
PROC main
INTEGER i
STRING spath
NULLSTR $PARENTFILE i
IF ($SCRIPTMODE != 2) && !i
FETCH SCRIPTPATH spath
CHDIR spath ASPECTPATH
ENDIF
pw1main()
ENDPROC
#endif
PROC pw1main
; Open the CLS-TEM.DOC & read the first CLS
FOPEN 3 cls_file READ TEXT
FSEEK 3 0 0 ; Reset the file pointer
FGETS 3 cls_string ; After FGETS, the file pointer points to the next line
STRDELETE cls_string 0 4
;
DIALOGBOX 0 6 10 300 260 259 "SET PROG version 1.0b C.Johnson"
TEXT 700 6 16 300 20 "W E L C O M E, to the Automatic Set Programming Tool" CENTER
GROUPBOX 701 10 40 120 70 "Please make your choice :"
COMBOBOX 702 20 60 100 50 DROPDOWNLIST ProgList ProgItem
GROUPBOX 703 150 40 120 70 "Extra Parameters ?"
COMBOBOX 704 160 60 100 50 DROPDOWNLIST ParamList ParamItem
TEXT 705 14 130 180 10 "The CLSs are defined in file CLS-TEM.DOC" LEFT
GROUPBOX 706 10 150 260 50 " Automatic Speed Call Lists (SCL) programming "
TEXT 707 40 170 50 16 "DNSZ :" LEFT
COMBOBOX 708 80 170 50 40 DROPDOWN DnszList dnsz
TEXT 709 150 170 50 16 "SIZE :" LEFT
COMBOBOX 710 190 170 50 40 DROPDOWN SizeList _size
PUSHBUTTON 711 120 220 50 16 "NO SCL" ok
PUSHBUTTON 712 180 220 50 16 "OK" default
ENDDIALOG
WHILE 1
DLGEVENT 0 Event
SWITCH Event
CASE 0
ENDCASE
CASE 702 ; Combobox selected
ENDCASE
CASE 704 ; Combobox selected
ENDCASE
CASE 708 ; Combobox selected
ENDCASE
CASE 710 ; Combobox selected
ENDCASE
CASE 711 ;"NO SCL"
ProgSCL ="NO"
EXITWHILE
ENDCASE
DEFAULT
EXITWHILE
ENDCASE
ENDSWITCH
ENDWHILE
dlgdestroy 0 CANCEL
; ******************************************************
IF STRCMP ParamItem "Extra Parameters Needed"
CALL Get_extra_param
ENDIF
IF STRCMP ProgSCL "YES"
;
; PROGRAM THE SCLs form input file
;
IF STRCMP ProgItem "Program IP Sets"
FOPEN 1 inp_iset_file READ TEXT
ELSEIF STRCMP ProgItem "Program Digital Sets"
FOPEN 1 inp_2000_file READ TEXT
ELSE
FOPEN 1 inp_500_file READ TEXT
ENDIF
IF !SUCCESS
ERRORMSG "Can't open input file"
EXIT
ENDIF
MSPAUSE 500
TRANSMIT "****"
MSPAUSE 500
TRANSMIT "^M"
WAITFOR ">" FOREVER
MSPAUSE 500
TRANSMIT "LD 18"
MSPAUSE 500
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
MSPAUSE 500
WHILE NOT FEOF 1 ; Loop while not End Of File
FGETS 1 str_input
IF STRFIND str_input "SCC " scc_pos
; SCC is found on pos scc_pos, copy 4 digits of the list number
SUBSTR lsno str_input scc_pos+4 4
IF STRCHR lsno ' '
; "TAB" is found in lsno, copy 3 digits of the list number
SUBSTR lsno str_input scc_pos+4 3
ENDIF
CALL WRITE_SCL
ENDIF ; STRFIND SCC
ENDWHILE ; Not FEOF
FCLOSE 1
MSPAUSE 500
TRANSMIT "END^M"
FOPEN 2 output_file WRITE TEXT
FSEEK 2 0 2
FPUTS 2 " Automatic SCL program is finished"
FCLOSE 2
ENDIF ; STRCMP ProgSCL "YES"
;
;********************************************************************
IF STRCMP ProgItem "Program Digital Sets"
GOTO DIGITAL_SET
ELSEIF STRCMP ProgItem "Program IP Sets"
GOTO IP_SET
ELSE
GOTO ANALOG_SET
ENDIF
;
;;
;**********************************
;* *
;* PROGRAM IP SETS *
;* *
;**********************************
IP_SET:
TRANSMIT "****"
PAUSE 1
TRANSMIT "^M"
WAITFOR ">" FOREVER
MSPAUSE 500
TRANSMIT "LD 11"
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
FOPEN 1 inp_iset_file READ TEXT
MSPAUSE 500
;
; Begin programming an IP set
START_1_IP:
CALL Extract_param
set_type = set_array[1] ; parameter 1, IP set type
tn = set_array[2] ; parameter 2, TN
des = set_array[3] ; parameter 3, DES - can not be empty
buid = set_array[4] ; parameter 4, BUID or NUID - a number or empty
motn = set_array[5] ; parameter 5, MOTN or HOTN - a TN format number or empty
kem = set_array[6] ; parameter 6, KEM - a number or empty
zone = set_array[7] ; parameter 7, ZONE - a number
fdn = set_array[8] ; parameter 8, FDN - a number or empty
ncos = set_array[9] ; parameter 9, NCOS - a number or empty
rnpg = set_array[10] ; parameter 10, RNPG - a number or empty
scpw = set_array[11] ; parameter 11, SCPW - a number or empty
sgrp = set_array[12] ; parameter 12, SGRP - a number or empty
cls_temp = set_array[13] ; parameter 13, CLS template
efd = set_array[14] ; parameter 14, EFD - a number or empty
hunt = set_array[15] ; parameter 15, HUNT - a number or empty
eht = set_array[16] ; parameter 16, EHT - a number or empty
spid = set_array[17] ; parameter 17, SPID - a number or empty
;
; Possible extra parameter
;
SWITCH Xparam1
CASE "None"
; No extra parameter
GOTO IP_continue_1
ENDCASE
CASE "XLST"
xlst = set_array[18]
ENDCASE
CASE "TEN"
ten = set_array[18]
ENDCASE
CASE "SSU"
ssu = set_array[18]
ENDCASE
; CASE "AOM"
; aom = set_array[18]
; ENDCASE
ENDSWITCH
SWITCH Xparam2
CASE "None"
; No second parameter
GOTO IP_continue_1
ENDCASE
CASE "XLST"
xlst = set_array[19]
ENDCASE
CASE "TEN"
ten = set_array[19]
ENDCASE
CASE "SSU"
ssu = set_array[19]
ENDCASE
; next section not applicable to IP sets
; CASE "AOM"
; aom = set_array[19]
; ENDCASE
ENDSWITCH
;
IP_continue_1:
MSPAUSE 300
TRANSMIT "NEW^M"
WAITFOR "TYPE" FOREVER
MSPAUSE 500
TRANSMIT set_type
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "TN" FOREVER
CALL CHECK_TN
IF STRCMP tn "fail"
IF nbr_star == 2
CALL END_PROC
EXIT
ELSE
GOTO START_1_IP
ENDIF
ENDIF
; Waitfor DES is done in subroutine check-tn
TRANSMIT des
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "CUST" FOREVER
MSPAUSE 500
TRANSMIT "0^M"
; the next prompt may be BUID or NUID dependent upon system type
IF NOT WAITFOR "BUID" 2
CALL PUT_VALUE WITH buid
TRANSMIT "^M"
WAITFOR "BUID" FOREVER
ENDIF
CALL PUT_VALUE WITH buid
TRANSMIT "^M"
; the next prompt may be MOTN or HOTN dependent upon system type
IF NOT WAITFOR "MOTN" 2
CALL PUT_VALUE WITH motn
TRANSMIT "^M"
WAITFOR "MOTN" FOREVER
ENDIF
CALL PUT_VALUE WITH motn
TRANSMIT "^M"
WAITFOR "KEM" FOREVER
CALL PUT_VALUE WITH kem
TRANSMIT "^M"
WAITFOR "ZONE" FOREVER
CALL PUT_VALUE WITH zone
TRANSMIT "^M"
; this ifnot section not applicable to IP sets
; IF NOT WAITFOR "FDN" 2
; Prompt AOM is received
; CALL PUT_VALUE WITH aom
; TRANSMIT "^M"
WAITFOR "FDN" FOREVER
; ENDIF
CALL PUT_VALUE WITH fdn
TRANSMIT "^M"
WAITFOR "TGAR" FOREVER
MSPAUSE 300
TRANSMIT "0^M"
WAITFOR "LDN" FOREVER
MSPAUSE 300
TRANSMIT "^M"
; If NCOS is empty, return-NCOS 0 will be put
WAITFOR "NCOS" FOREVER
CALL PUT_VALUE WITH ncos
TRANSMIT "^M"
; If RNPG is not empty, CLS PUA will be default
WAITFOR "RNPG" FOREVER
CALL PUT_VALUE WITH rnpg
TRANSMIT "^M"
; Default SSU is 10
WAITFOR "SSU" FOREVER
CALL PUT_VALUE WITH ssu
TRANSMIT "^M"
IF NOT NULLSTR xlst
; Extra parameter xlst
WAITFOR "XLST" FOREVER
CALL PUT_VALUE WITH xlst
TRANSMIT "^M"
ENDIF
;WAITFOR "SCPW" FOREVER
;CALL PUT_VALUE WITH scpw
;TRANSMIT "^M"
WAITFOR "SGRP" FOREVER
;CALL PUT_VALUE WITH sgrp
TRANSMIT "^M"
WAITFOR "SFLT" FOREVER
MSPAUSE 300
TRANSMIT "^M"
CALL WRITE_CLS
TRANSMIT "^M"
;
; The next prompt may:RCO if CLS FNA and/or MWA
; MWA is standard on every digital set
WAITFOR "CAC" FOREVER
MSPAUSE 300
TRANSMIT "^M"
; The next prompt may be EFD HUNT EHT
; ....................................or.........HUNT......
IF WAITFOR "rco" 2
TRANSMIT "^M"
WAITFOR "EFD" 2
CALL PUT_VALUE WITH efd
TRANSMIT "^M"
WAITFOR "HUNT" FOREVER
CALL PUT_VALUE WITH hunt
TRANSMIT "^M"
WAITFOR "EHT" FOREVER
CALL PUT_VALUE WITH eht
ELSE
; Prompt HUNT is received
CALL PUT_VALUE WITH hunt
ENDIF
TRANSMIT "^M"
; The next prompt may: LHK LNRS
; or: LNRS if CLS LNA (standard on every set)
IF NOT WAITFOR "LNRS" 2
; LHK is received
TRANSMIT "^M"
WAITFOR "LNRS" FOREVER
ENDIF
MSPAUSE 500
TRANSMIT "20^M"
IF NOT NULLSTR ten
; Extra parameter ten
WAITFOR "TEN" FOREVER
CALL PUT_VALUE WITH ten
TRANSMIT "^M"
ENDIF
;
; Then the next Prompt may appear: SCI, PLEV, FCAR, (SPID), AST
;
; Test for ACD agent - wait SPID
IF NULLSTR spid
GOTO Non_ACD_agent_IP
ELSE
ATOI cls_temp cls_current
SWITCH cls_current
CASE 41
GOTO ACD_agent_IP
ENDCASE
CASE 42
GOTO ACD_agent_IP
ENDCASE
CASE 43
GOTO ACD_agent_IP
ENDCASE
CASE 44
GOTO ACD_agent_IP
ENDCASE
CASE 45
GOTO ACD_agent_IP
ENDCASE
CASE 61
GOTO ACD_agent_IP
ENDCASE
CASE 62
GOTO ACD_agent_IP
ENDCASE
CASE 63
GOTO ACD_agent_IP
ENDCASE
CASE 64
GOTO ACD_agent_IP
ENDCASE
CASE 65
GOTO ACD_agent_IP
ENDCASE
CASE 141
GOTO ACD_agent_IP
ENDCASE
CASE 142
GOTO ACD_agent_IP
ENDCASE
CASE 143
GOTO ACD_agent_IP
ENDCASE
CASE 144
GOTO ACD_agent_IP
ENDCASE
CASE 145
GOTO ACD_agent_IP
ENDCASE
DEFAULT
GOTO Non_ACD_agent_IP
ENDCASE
ENDSWITCH ; cls_current
ENDIF ; null string SPID
;
ACD_agent_IP:
WHILE NOT WAITFOR "SPID" 2
TRANSMIT "^M"
ENDWHILE
CALL PUT_VALUE WITH spid
TRANSMIT "^M"
;
Non_ACD_agent_IP:
WHILE NOT WAITFOR "AST" 2
TRANSMIT "^M"
ENDWHILE
MSPAUSE 300
TRANSMIT "^M"
;
; Then the next prompt may appear: IAPG, PRI, LANG, KEY
;
WHILE NOT WAITFOR "KEY" 2
; ALSO TO BE TESTED WHEN WAITTIME = 1 SECOND !!
TRANSMIT "^M"
ENDWHILE
MSPAUSE 300
;
; KEYS programing
;
key=0
array_cnt=18+num_extra_param ; parameter 18, 19 or 20 is the first_key
KEY_PROG_IP:
key_str = set_array[array_cnt]
IF NULLSTR key_str
; empty key
key++
array_cnt++
GOTO KEY_PROG_IP
ELSE
SWITCH key_str
DEFAULT
ITOA key S1
TRANSMIT S1
TRANSMIT " " ; transmit a space
MSPAUSE 200
SET TXPACE 150
TRANSMIT key_str
SET TXPACE 0
MSPAUSE 500
TRANSMIT "^M"
; The next prompt may be received (MARP), (CPND), (VMB), KEY
IF NOT WAITFOR "KEY" 3
; Wait less than 3 second will not work when MARP is received
TRANSMIT "^M"
WHILE NOT WAITFOR "KEY" 2
; ALSO TO BE TESTED WHEN WAITTIME = 1 SECOND !!
TRANSMIT "^M"
ENDWHILE
ENDIF
MSPAUSE 200
key++
array_cnt++
GOTO KEY_PROG_IP
ENDCASE
CASE "*"
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
GOTO START_1
ENDCASE
CASE "**"
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
CALL END_PROC
EXIT
ENDCASE
ENDSWITCH
ENDIF
;
;
;**********************************
;* *
;* PROGRAM DIGITAL SETS *
;* *
;**********************************
DIGITAL_SET:
TRANSMIT "****"
PAUSE 1
TRANSMIT "^M"
WAITFOR ">" FOREVER
MSPAUSE 500
TRANSMIT "LD 11"
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
FOPEN 1 inp_2000_file READ TEXT
MSPAUSE 500
;
; Begin of programming a 2000 set
START_1:
CALL Extract_param
set_type = set_array[1] ; parameter 1, 2000 set type
tn = set_array[2] ; parameter 2, TN
des = set_array[3] ; parameter 3, DES
fdn = set_array[4] ; parameter 4, FDN - a number or empty
ncos = set_array[5] ; parameter 5, NCOS - a number or empty
rnpg = set_array[6] ; parameter 6, RNPG - a number or empty
scpw = set_array[7] ; parameter 7, SCPW - a number or empty
sgrp = set_array[8] ; parameter 8, SGRP - a number or empty
cls_temp = set_array[9] ; parameter 9, CLS template
efd = set_array[10] ; parameter 10, EFD - a number or empty
hunt = set_array[11] ; parameter 11, HUNT - a number or empty
eht = set_array[12] ; parameter 12, EHT - a number or empty
spid = set_array[13] ; parameter 13, SPID - a number or empty
;
; Possible extra parameter
;
SWITCH Xparam1
CASE "None"
; No extra parameter
GOTO Dig_continue_1
ENDCASE
CASE "XLST"
xlst = set_array[14]
ENDCASE
CASE "TEN"
ten = set_array[14]
ENDCASE
CASE "SSU"
ssu = set_array[14]
ENDCASE
CASE "AOM"
aom = set_array[14]
ENDCASE
ENDSWITCH
SWITCH Xparam2
CASE "None"
; No second parameter
GOTO Dig_continue_1
ENDCASE
CASE "XLST"
xlst = set_array[15]
ENDCASE
CASE "TEN"
ten = set_array[15]
ENDCASE
CASE "SSU"
ssu = set_array[15]
ENDCASE
CASE "AOM"
aom = set_array[15]
ENDCASE
ENDSWITCH
;
Dig_continue_1:
MSPAUSE 300
TRANSMIT "NEW^M"
WAITFOR "TYPE" FOREVER
MSPAUSE 500
TRANSMIT set_type
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "TN" FOREVER
CALL CHECK_TN
IF STRCMP tn "fail"
IF nbr_star == 2
CALL END_PROC
EXIT
ELSE
GOTO START_1
ENDIF
ENDIF
; Waitfor DES is done in subroutine check-tn
TRANSMIT des
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "CUST" FOREVER
MSPAUSE 500
TRANSMIT "0^M"
IF NOT WAITFOR "FDN" 2
; Prompt AOM is received
CALL PUT_VALUE WITH aom
TRANSMIT "^M"
WAITFOR "FDN" FOREVER
ENDIF
CALL PUT_VALUE WITH fdn
TRANSMIT "^M"
WAITFOR "TGAR" FOREVER
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "LDN" FOREVER
MSPAUSE 300
TRANSMIT "^M"
; If NCOS is empty, return-NCOS 0 will be put
WAITFOR "NCOS" FOREVER
CALL PUT_VALUE WITH ncos
TRANSMIT "^M"
; If RNPG is not empty, CLS PUA will be default
WAITFOR "RNPG" FOREVER
CALL PUT_VALUE WITH rnpg
TRANSMIT "^M"
; Default SSU is 10
WAITFOR "SSU" FOREVER
CALL PUT_VALUE WITH ssu
TRANSMIT "^M"
IF NOT NULLSTR xlst
; Extra parameter xlst
WAITFOR "XLST" FOREVER
CALL PUT_VALUE WITH xlst
TRANSMIT "^M"
ENDIF
WAITFOR "SCPW" FOREVER
CALL PUT_VALUE WITH scpw
TRANSMIT "^M"
WAITFOR "SGRP" FOREVER
;CALL PUT_VALUE WITH sgrp
TRANSMIT "^M"
WAITFOR "SFLT" FOREVER
MSPAUSE 300
CALL WRITE_CLS
TRANSMIT "^M"
;
; The next prompt may:RCO if CLS FNA and/or MWA
; MWA is standard on every digital set
WAITFOR "RCO" FOREVER
MSPAUSE 300
TRANSMIT "^M"
; The next prompt may be EFD HUNT EHT
; ....................................or.........HUNT......
IF WAITFOR "EFD" 2
CALL PUT_VALUE WITH efd
TRANSMIT "^M"
WAITFOR "HUNT" FOREVER
CALL PUT_VALUE WITH hunt
TRANSMIT "^M"
WAITFOR "EHT" FOREVER
CALL PUT_VALUE WITH eht
ELSE
; Prompt HUNT is received
CALL PUT_VALUE WITH hunt
ENDIF
TRANSMIT "^M"
; The next prompt may: LHK LNRS
; or: LNRS if CLS LNA (standard on every set)
IF NOT WAITFOR "LNRS" 2
; LHK is received
TRANSMIT "^M"
WAITFOR "LNRS" FOREVER
ENDIF
MSPAUSE 500
TRANSMIT "20^M"
IF NOT NULLSTR ten
; Extra parameter ten
WAITFOR "TEN" FOREVER
CALL PUT_VALUE WITH ten
TRANSMIT "^M"
ENDIF
;
; Then the next Prompt may appear: SCI, PLEV, FCAR, (SPID), AST
;
; Test for ACD agent - wait SPID
IF NULLSTR spid
GOTO Non_ACD_agent
ELSE
ATOI cls_temp cls_current
SWITCH cls_current
CASE 41
GOTO ACD_agent
ENDCASE
CASE 42
GOTO ACD_agent
ENDCASE
CASE 43
GOTO ACD_agent
ENDCASE
CASE 44
GOTO ACD_agent
ENDCASE
CASE 45
GOTO ACD_agent
ENDCASE
CASE 61
GOTO ACD_agent
ENDCASE
CASE 62
GOTO ACD_agent
ENDCASE
CASE 63
GOTO ACD_agent
ENDCASE
CASE 64
GOTO ACD_agent
ENDCASE
CASE 65
GOTO ACD_agent
ENDCASE
CASE 141
GOTO ACD_agent
ENDCASE
CASE 142
GOTO ACD_agent
ENDCASE
CASE 143
GOTO ACD_agent
ENDCASE
CASE 144
GOTO ACD_agent
ENDCASE
CASE 145
GOTO ACD_agent
ENDCASE
DEFAULT
GOTO Non_ACD_agent
ENDCASE
ENDSWITCH ; cls_current
ENDIF ; null string SPID
;
ACD_agent:
WHILE NOT WAITFOR "SPID" 2
TRANSMIT "^M"
ENDWHILE
CALL PUT_VALUE WITH spid
TRANSMIT "^M"
;
Non_ACD_agent:
WHILE NOT WAITFOR "AST" 2
TRANSMIT "^M"
ENDWHILE
MSPAUSE 300
TRANSMIT "^M"
;
; Then the next prompt may appear: IAPG, PRI, LANG, KEY
;
WHILE NOT WAITFOR "KEY" 2
; ALSO TO BE TESTED WHEN WAITTIME = 1 SECOND !!
TRANSMIT "^M"
ENDWHILE
MSPAUSE 300
;
; KEYS programing
;
key=0
array_cnt=14+num_extra_param ; parameter 14, 15 or 16 is the first_key
KEY_PROG:
key_str = set_array[array_cnt]
IF NULLSTR key_str
; empty key
key++
array_cnt++
GOTO KEY_PROG
ELSE
SWITCH key_str
DEFAULT
ITOA key S1
TRANSMIT S1
TRANSMIT " " ; transmit a space
MSPAUSE 200
SET TXPACE 150
TRANSMIT key_str
SET TXPACE 0
MSPAUSE 500
TRANSMIT "^M"
; The next prompt may be received (MARP), (CPND), (VMB), KEY
IF NOT WAITFOR "KEY" 3
; Wait less than 3 second will not work when MARP is received
TRANSMIT "^M"
WHILE NOT WAITFOR "KEY" 2
; ALSO TO BE TESTED WHEN WAITTIME = 1 SECOND !!
TRANSMIT "^M"
ENDWHILE
ENDIF
MSPAUSE 200
key++
array_cnt++
GOTO KEY_PROG
ENDCASE
CASE "*"
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
GOTO START_1
ENDCASE
CASE "**"
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
CALL END_PROC
EXIT
ENDCASE
ENDSWITCH
ENDIF
;
;**********************************
;* *
;* PROGRAM ANALOG SETS *
;* *
;**********************************
ANALOG_SET:
TRANSMIT "****"
PAUSE 1
TRANSMIT "^M"
WAITFOR ">" FOREVER
MSPAUSE 500
TRANSMIT "LD 10"
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
MSPAUSE 300
FOPEN 1 inp_500_file READ TEXT
MSPAUSE 300
;
; Begin of programming an analog set
START_2:
CALL Extract_param
tn = set_array[1] ; parameter 1, TN
des = set_array[2] ; parameter 2, DES
dn = set_array[3] ; parameter 3, DN
hunt = set_array[4] ; parameter 4, HUNT - a number or empty
ncos = set_array[5] ; parameter 5, NCOS - a number or empty
rnpg = set_array[6] ; parameter 6, RNPG - a number or empty
scpw = set_array[7] ; parameter 7, SCPW - a number or empty
sgrp = set_array[8] ; parameter 8, SGRP - a number or empty
cls_temp = set_array[9] ; parameter 9, CLS template
;
; Possible extra parameter, for analog sets only XLST and TEN are possible
;
SWITCH Xparam1
CASE "None"
; No extra parameter
GOTO Ana_continue_1
ENDCASE
CASE "XLST"
xlst = set_array[10]
ENDCASE
CASE "TEN"
ten = set_array[10]
ENDCASE
DEFAULT
EXITSWITCH
ENDCASE
ENDSWITCH
SWITCH Xparam2
CASE "None"
; No second parameter
GOTO Ana_continue_1
ENDCASE
CASE "XLST"
xlst = set_array[11]
ENDCASE
CASE "TEN"
ten = set_array[11]
ENDCASE
DEFAULT
EXITSWITCH
ENDCASE
ENDSWITCH
;
Ana_continue_1:
MSPAUSE 300
TRANSMIT "NEW^M"
WAITFOR "TYPE" FOREVER
MSPAUSE 500
TRANSMIT "500^M"
WAITFOR "TN" FOREVER
CALL CHECK_TN
IF STRCMP tn "fail"
IF nbr_star == 2
CALL END_PROC
EXIT
ELSE
GOTO START_1
ENDIF
ENDIF
; Waitfor DES is done in subroutine check-tn
TRANSMIT des
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "CUST" FOREVER
MSPAUSE 500
TRANSMIT "0^M"
; The next prompt may appear: WRLS, DIG, DN
WHILE NOT WAITFOR "DN" 2
TRANSMIT "^M"
ENDWHILE
MSPAUSE 500
TRANSMIT dn
MSPAUSE 300
TRANSMIT "^M"
; The next prompt may be received (MARP), (CPND), (VMB), AST
IF NOT WAITFOR "AST" 3
; Wait less than 3 second will not work when MARP is received
TRANSMIT "^M"
WHILE NOT WAITFOR "AST" 2
; ALSO TO BE TESTED WHEN WAITTIME = 1 SECOND !!
TRANSMIT "^M"
ENDWHILE
ENDIF
MSPAUSE 300
TRANSMIT "^M"
IF WAITFOR "IAPG" 2
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "HUNT" FOREVER
; ELSE prompt HUNT is received
ENDIF
CALL PUT_VALUE WITH hunt
TRANSMIT "^M"
WAITFOR "TGAR" FOREVER
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "LDN" FOREVER
MSPAUSE 300
TRANSMIT "^M"
; If NCOS is empty, return-NCOS 0 will be put
WAITFOR "NCOS" FOREVER
CALL PUT_VALUE WITH ncos
TRANSMIT "^M"
; If RNPG is not empty, CLS PUA will be default
WAITFOR "RNPG" FOREVER
CALL PUT_VALUE WITH rnpg
TRANSMIT "^M"
IF NOT NULLSTR xlst
; Extra parameter xlst
WAITFOR "XLST" FOREVER
CALL PUT_VALUE WITH xlst
TRANSMIT "^M"
ENDIF
WAITFOR "SCPW" FOREVER
CALL PUT_VALUE WITH scpw
TRANSMIT "^M"
WAITFOR "SGRP" FOREVER
CALL PUT_VALUE WITH sgrp
TRANSMIT "^M"
WAITFOR "SFLT" FOREVER
MSPAUSE 300
CALL WRITE_CLS
TRANSMIT "^M"
IF NOT WAITFOR "LNRS" 2
; Prompt RCO is received
TRANSMIT "^M"
WAITFOR "LNRS" FOREVER
ENDIF
MSPAUSE 300
TRANSMIT "20^M"
IF NOT NULLSTR ten
; Extra parameter ten
WAITFOR "TEN" FOREVER
CALL PUT_VALUE WITH ten
TRANSMIT "^M"
ENDIF
;
; The next prompt may be received: SCI, FCAR, PLEV, PRI & AACD (Analog ACD), LANG
WHILE NOT WAITFOR "FTR" 2
; ALSO TO BE TESTED WHEN WAITTIME = 1 SECOND !!
TRANSMIT "^M"
ENDWHILE
;
; FTR - feature- programing
;
; Read the next input parameter in set_array, it may :
; - empty -> read next parameter
; - ** -> programming is finish
; - * -> programming of this set is finished
; - 500 set feature
;
SET TXPACE 200
array_cnt=9+num_extra_param ; parameter(+1) 9, 10 or 11 is the first FTR
START_FTR:
array_cnt++
MSPAUSE 300
feature = set_array[array_cnt]
SWITCH feature
DEFAULT
TRANSMIT feature
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "FTR" FOREVER
GOTO START_FTR
ENDCASE
CASE ""
; empty feature
GOTO START_FTR
ENDCASE
CASE "*"
SET TXPACE 0
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
GOTO START_2
ENDCASE
CASE "**"
SET TXPACE 0
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
CALL END_PROC
EXIT
ENDCASE
ENDSWITCH
ENDPROC ; MAIN
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; S U B R O U T I N E ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
PROC WRITE_SCL
;
MSPAUSE 500
TRANSMIT "NEW^M"
WAITFOR "TYPE" FOREVER
MSPAUSE 500
TRANSMIT "SCL^M"
WAITFOR "LSNO" FOREVER
MSPAUSE 300
TRANSMIT lsno
MSPAUSE 300
TRANSMIT "^M"
IF WAITFOR "DNSZ" 2
TRANSMIT dnsz
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "SIZE" FOREVER
MSPAUSE 300
TRANSMIT _size
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "WRT" FOREVER
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "STOR" FOREVER
ELSE
; SCL number is not OK -- write in a ouput file
FOPEN 2 output_file WRITE TEXT
FSEEK 2 0 2
S1="The next SCL can not be programmed: "
STRCAT S1 lsno
FPUTS 2 S1
FCLOSE 2
MSPAUSE 300
TRANSMIT "**"
ENDIF
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
MSPAUSE 300
ENDPROC ; WRITE_SCL
;
; ***************************
;
PROC Extract_param
;
; Read the set parameter from the input file
; One input file line contains all parameter for one set,
; a TAB between the parameter and * at the end of line.
; Result are saved in set_array
;
STRING set_string, more_string = "NO"
INTEGER str_length, count1, nbr_param
LONG back_pos
nbr_star = 0
array_cnt = 1
more_string = "NO"
FGETS 1 set_string
STRLEN set_string str_length
;;????When the previous line length = 255 or 256 FGETS read nothing
IF str_length == 0
FGETS 1 set_string ; Try again
STRLEN set_string str_length
ENDIF
;;;?????????????????
STRSEARCH set_string "*" nbr_star
; nbr_star = 0 (no star is found), = 1 ( * is found), = 2, ** is found
IF str_length < 256 ; max length of string variable = 256
more_string = "NO"
ELSE
; Total parameter length of this set >= 256.
IF nbr_star > 0
; * or ** is found, all parameters for this set have been read.
more_string = "NO"
ELSE
; * is NOT found, totall parameter length of this set > 256
more_string = "YES"
ENDIF
ENDIF ; str_length < 256
Start_extract:
STRSEARCH set_string " " nbr_param
;nbr_param the number of valid parameter (TAB as delimeter)
FOR count1=1 upto nbr_param
; Find a string till a TAB is found, STREXTRACT first param pos is 0
STREXTRACT set_array[array_cnt] set_string " " count1-1
array_cnt ++
ENDFOR
STREXTRACT set_array[array_cnt] set_string " " nbr_param
IF STRCMP more_string "YES"
STRLEN set_array[array_cnt] str_length
back_pos = 0-str_length
; File pointer back to the beginning of the last found parameter
FSEEK 1 back_pos 1
FGETS 1 set_string
STRSEARCH set_string "*" nbr_star
STRLEN set_string str_length
IF str_length < 256 ; max length of string variable = 256
more_string = "NO"
ELSE
; Total parameter length of this set >= 256.
IF nbr_star > 0
; * or ** is found, all parameters for this set have been read.
more_string = "NO"
ENDIF
ENDIF ; str_length < 256
GOTO Start_extract
ENDIF ; more_string
ENDPROC ; Extract_param
;
; ***************************
;
PROC Get_extra_param
;
; This procedure asks the user to give extra parameters which are added in the Input File.
;
DIALOGBOX 10 6 60 300 150 259 "ASPAM version 3.0 G. Kirana"
TEXT 11 16 16 300 20 "Now you can easily add extra paramaters into the Standard Input File." LEFT
TEXT 12 16 30 300 20 "The FIRST extra parameter must be inserted in:" LEFT
TEXT 13 16 44 300 20 " Digital set (D): Between SPID and KEY parameters." LEFT
TEXT 14 16 58 300 20 " Analog set (A): Between CLS and FTR parameters." LEFT
TEXT 15 16 90 300 20 "Extra parameter 1 - column 14 (D), column 10 (A) :" LEFT
COMBOBOX 16 186 90 100 66 DROPDOWNLIST PromptList PromptItem
PUSHBUTTON 17 186 120 60 16 " OK " ok DEFAULT
ENDDIALOG
WHILE 1
DLGEVENT 10 Event
SWITCH Event
CASE 0
ENDCASE
CASE 16 ; Combobox extra parameter 1
Xparam1 = PromptItem
ENDCASE
DEFAULT
EXITWHILE
ENDCASE
ENDSWITCH
ENDWHILE
IF STRCMP Xparam1 "None"
num_extra_param = 0
ELSE
PromptItem = "None"
DIALOGBOX 20 6 80 300 150 259 "ASPAM version 3.0 G. Kirana"
TEXT 21 16 16 300 20 "You have added one parameter, now you can add the second paramater if you wish." LEFT
TEXT 22 16 30 300 20 "The SECOND extra parameter must be inserted in:" LEFT
TEXT 23 16 44 300 20 " Digital set (D): Between FIRST extra parameter and KEY parameter." LEFT
TEXT 24 16 58 300 20 " Analog set (A): Between FIRST extra parameter and FTR parameter." LEFT
TEXT 25 16 90 300 20 "Extra parameter 2 - column 15 (D), column 11 (A) :" LEFT
COMBOBOX 26 186 90 100 66 DROPDOWNLIST PromptList PromptItem
PUSHBUTTON 27 186 120 60 16 " OK " ok DEFAULT
ENDDIALOG
WHILE 1
DLGEVENT 20 Event
SWITCH Event
CASE 0
ENDCASE
CASE 26 ; Combobox extra parameter 2
Xparam2 = PromptItem
ENDCASE
DEFAULT
EXITWHILE
ENDCASE
ENDSWITCH
ENDWHILE
DLGDESTROY 20 CANCEL
IF STRCMP Xparam2 "None"
num_extra_param = 1
ELSE
num_extra_param = 2
ENDIF ; Xparam2 = "None"
ENDIF ; Xparam1 = "None"
USERMSG "Extra parameter 1: %s , Extra parameter 2: %s " Xparam1 Xparam2
ENDPROC ; Get_extra_param
;
; ***************************
;
PROC WRITE_CLS
;
; Transmit the right CLS value
;
SET TXPACE 200
ATOI cls_temp cls_current
IF cls_current>=cls_previous
read_counter=cls_current-cls_previous
ELSE
read_counter=cls_current
FSEEK 3 0 0
ENDIF
cls_previous=cls_current
;
IF read_counter>0
FOR index=1 UPTO read_counter
FGETS 3 cls_string
ENDFOR
STRDELETE cls_string 0 4
ENDIF
;
TRANSMIT "^M"
WHILE NOT WAITFOR "CLS" 2
; Prompt "CAC" may be received
TRANSMIT "^M"
ENDWHILE
MSPAUSE 500
TRANSMIT cls_string
MSPAUSE 500
SET TXPACE 0
ENDPROC ; WRITE_CLS
;
; ***************************
;
PROC CHECK_TN
;
; This subroutine tries to put the TN from the input file
; When it fail, the TN will be put into the output file
;
SET TXPACE 150
TRANSMIT tn
MSPAUSE 500
TRANSMIT "^M"
IF NOT WAITFOR "DES" 3
; Prompt TN or CDEN (Analog set) is received.
MSPAUSE 300
TRANSMIT "^M"
IF NOT WAITFOR "DES" 2
MSPAUSE 300
FOPEN 2 output_file WRITE TEXT
FSEEK 2 0 2
S1="The next TN can not be programmed: "
STRCAT S1 tn
FPUTS 2 S1
FCLOSE 2
TRANSMIT "**"
MSPAUSE 500
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
tn = "fail"
ENDIF
ENDIF
SET TXPACE 0
MSPAUSE 300
ENDPROC ; CHECK_TN
; ***************************
PROC PUT_VALUE
;
; This subroutine writes the value from the input file to the
; approriate Prompt, if the parameter is empty RETURN only will be transmitted
; after procedure return
;
param string value
MSPAUSE 300
IF NOT NULLSTR value
TRANSMIT value
MSPAUSE 300
ENDIF
ENDPROC ; PUT_VALUE
; ***************************
;
PROC END_PROC
;
; Automatic programming is finished
;
MSPAUSE 500
FOPEN 2 output_file WRITE TEXT
FSEEK 2 0 2
FPUTS 2 " Automatic SET programming is finished"
FCLOSE 1
FCLOSE 2
FCLOSE 3
DIALOGBOX 0 6 12 250 120 259 "SET PROG version 1.0b C.Johnson"
TEXT 700 6 20 250 20 "Automatic SET programming is finished" CENTER
TEXT 701 6 40 250 10 "Do not forget to check the OUTPUT file: SETOUT.DOC" CENTER
PUSHBUTTON 10 150 100 40 14 "OK" ok DEFAULT
ENDDIALOG
WHILE 1
DLGEVENT 0 Event
SWITCH Event
CASE 0
ENDCASE
DEFAULT
EXITWHILE
ENDCASE
ENDSWITCH
ENDWHILE
dlgdestroy 0 CANCEL
ENDPROC ; END_PROC
; ***************************
This is 1 portion of the 500dat.txt
15 0 0 0 500 42200 42200 5 8 *
15 0 0 1 500 42201 42201 5 8 *
15 0 0 2 500 42202 42202 5 8 *
15 0 0 3 500 42203 42203 5 8 *
15 0 0 4 500 42204 42204 5 8 *
15 0 0 5 500 42205 42205 5 8 *
15 0 0 6 500 42206 42206 5 8 *
15 0 0 7 500 42207 42207 5 8 *
15 0 0 8 500 42208 42208 5 8 *
15 0 0 9 500 42209 42209 5 8 *
15 0 0 10 500 42210 42210 5 8 *
15 0 0 11 500 42211 42211 5 8 *
15 0 0 12 500 42212 42212 5 8 *
15 0 0 13 500 42213 42213 5 8 *
15 0 0 14 500 42214 42214 5 8 *
15 0 0 15 500 42215 42215 5 8 **
This is a portion of the cls-ten.txt fils
0 TLD DTN ARHA C6A CFXD DPUA GPUA LNA XFA XRA PUA
1 TLD DTN ARHA C6A CFXD DPUA GPUA LNA XFA XRA
2 TLD DTN ARHA C6A CFXD DPUA GPUA LNA XFA XRA FNA CFTA SFA HBTA
3 TLD DTN ARHA C6A CFXD DPUA GPUA LNA XFA XRA FNA CFTA SFA FBA
4 TLD DTN ARHA C6A CFXD DPUA GPUA LNA XFA XRA FNA HTA CFTA SFA HBTA
5 TLD DTN ARHA C6A CFXD DPUA GPUA LNA XFA XRA FNA HTA CFTA SFA FBA
6 TLD DTN CFXD LNA FAXA
7 TLD DTN ARHA C6A CFXD DPUA GPUA LNA XFA XRA FN
9 TLD DTN ARHA C6A CFXD DPUA GPUA LNA XFA XRA FNA HTA CFTA SFA HBTA CFXA
Any help would be greatly appreciated.
;General programming of all sets, Analog & Digital (Including ACD sets)
;NEW*** now accomodates IP set programing, i2001, i2002, i2004 and i2050
;for small and large systems
;The SCL will be also programmed automaticaly.
;File name: SETINPUTrls4.WAS
;****************************************************************************
#IFNDEF PW1GLOBALS
#DEFINE PW1GLOBALS
integer pw1strcmp = 0
integer pw1strfindcase = 0
integer pw1switchcase = 0
integer pw1waitforcase = 0
integer pw1whencase = 0
string pw1ddirpath = $pwlocalpath
integer pw1printraw = 0
integer pw1helpid = -1
integer found = 0
#define PW1WHENTARGET(id,string,name) \
IF pw1whencase #\
WHEN TARGET id string MATCHCASE CALL name #\
ELSE #\
WHEN TARGET id string CALL name #\
ENDIF
#ENDIF
;****************************************************************************
; This program reads an excel input filse saved as TAB DELIMETED TEXT files
; File 1 : input file is 2000DAT.TXT or ISET.TXT or 500DAT.TXT
; File 2 : output log file is SETOUT.DOC
; File 3 : CLS template file MUST EXIST: CLS-TEM.TXT
;********************************************************************************
;
;************
;File locations changed to be in "C:\TASKS\...". This was done to ensure the running of the script is a delebrate action
;rather than accidental from the ASPECT pick list
;
;Added IP set programing options
;
;FILE EXTENSION NAMES changed to ".TXT" to prevent accidental modification in MS Word
;IF NOT routines for BUID/NUID and MOTN/HOTN added to differentiate between large and small system prompts
;
;
; N O T E S
; Prompt SCI may not be used,
; put them between command lines
;
; #DEFINE inp_2000_file "..\INPUT\2000DAT.DOC"
; #DEFINE inp_500_file "..\INPUT\500DAT.DOC"
; #DEFINE inp_iset_file "..\INPUT\ISET.DOC"
; #DEFINE cls_file "..\INPUT\CLS-TEM.DOC"
; #DEFINE output_file "..\INPUT\SETOUT.DOC"
;
#DEFINE inp_2000_file "C:\TASK\2000DAT.TXT"
#DEFINE inp_500_file "C:\TASK\500DAT.TXT"
#DEFINE inp_iset_file "C:\TASK\ISET.TXT"
#DEFINE cls_file "C:\TASK\CLS-TEM.TXT"
#DEFINE output_file "C:\TASK\SETOUT.TXT"
;
; STRING set_type, tn , des, fdn, ncos, rnpg, scpw , sgrp, cls_temp, efd, hunt, eht, spid, dn
;digital and analog
STRING set_type, tn, des, buid, motn, kem, zone, fdn, ncos, rnpg, scpw, sgrp, cls_temp, efd, hunt, eht, spid, dn
STRING str_input, cls_string, key_str, feature, set_array[100]
STRING xlst="", ten="", ssu="10", aom="" ; Use for extra parameter in the Input File
INTEGER array_cnt, nbr_star, scc_pos
INTEGER key, Event, index, cls_previous=1, cls_current=1, read_counter
INTEGER num_extra_param=0
STRING PromptList = "None,XLST,TEN,SSU,AOM"
STRING PromptItem = "None", Xparam1 = "None", Xparam2 = "None"
STRING ProgList = "Program Digital Sets,Program IP Sets,Program Analog Sets"
STRING ProgItem = "Program Digital Sets"
STRING ParamList = "None,Extra Parameters Needed"
STRING ParamItem = "None"
STRING DnszList ="16,20,24,28", SizeList ="10,20,30,40", ProgSCL = "YES"
STRING dnsz="20",_size="10",lsno
#ifndef _pw1main
#define _pw1main
PROC main
INTEGER i
STRING spath
NULLSTR $PARENTFILE i
IF ($SCRIPTMODE != 2) && !i
FETCH SCRIPTPATH spath
CHDIR spath ASPECTPATH
ENDIF
pw1main()
ENDPROC
#endif
PROC pw1main
; Open the CLS-TEM.DOC & read the first CLS
FOPEN 3 cls_file READ TEXT
FSEEK 3 0 0 ; Reset the file pointer
FGETS 3 cls_string ; After FGETS, the file pointer points to the next line
STRDELETE cls_string 0 4
;
DIALOGBOX 0 6 10 300 260 259 "SET PROG version 1.0b C.Johnson"
TEXT 700 6 16 300 20 "W E L C O M E, to the Automatic Set Programming Tool" CENTER
GROUPBOX 701 10 40 120 70 "Please make your choice :"
COMBOBOX 702 20 60 100 50 DROPDOWNLIST ProgList ProgItem
GROUPBOX 703 150 40 120 70 "Extra Parameters ?"
COMBOBOX 704 160 60 100 50 DROPDOWNLIST ParamList ParamItem
TEXT 705 14 130 180 10 "The CLSs are defined in file CLS-TEM.DOC" LEFT
GROUPBOX 706 10 150 260 50 " Automatic Speed Call Lists (SCL) programming "
TEXT 707 40 170 50 16 "DNSZ :" LEFT
COMBOBOX 708 80 170 50 40 DROPDOWN DnszList dnsz
TEXT 709 150 170 50 16 "SIZE :" LEFT
COMBOBOX 710 190 170 50 40 DROPDOWN SizeList _size
PUSHBUTTON 711 120 220 50 16 "NO SCL" ok
PUSHBUTTON 712 180 220 50 16 "OK" default
ENDDIALOG
WHILE 1
DLGEVENT 0 Event
SWITCH Event
CASE 0
ENDCASE
CASE 702 ; Combobox selected
ENDCASE
CASE 704 ; Combobox selected
ENDCASE
CASE 708 ; Combobox selected
ENDCASE
CASE 710 ; Combobox selected
ENDCASE
CASE 711 ;"NO SCL"
ProgSCL ="NO"
EXITWHILE
ENDCASE
DEFAULT
EXITWHILE
ENDCASE
ENDSWITCH
ENDWHILE
dlgdestroy 0 CANCEL
; ******************************************************
IF STRCMP ParamItem "Extra Parameters Needed"
CALL Get_extra_param
ENDIF
IF STRCMP ProgSCL "YES"
;
; PROGRAM THE SCLs form input file
;
IF STRCMP ProgItem "Program IP Sets"
FOPEN 1 inp_iset_file READ TEXT
ELSEIF STRCMP ProgItem "Program Digital Sets"
FOPEN 1 inp_2000_file READ TEXT
ELSE
FOPEN 1 inp_500_file READ TEXT
ENDIF
IF !SUCCESS
ERRORMSG "Can't open input file"
EXIT
ENDIF
MSPAUSE 500
TRANSMIT "****"
MSPAUSE 500
TRANSMIT "^M"
WAITFOR ">" FOREVER
MSPAUSE 500
TRANSMIT "LD 18"
MSPAUSE 500
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
MSPAUSE 500
WHILE NOT FEOF 1 ; Loop while not End Of File
FGETS 1 str_input
IF STRFIND str_input "SCC " scc_pos
; SCC is found on pos scc_pos, copy 4 digits of the list number
SUBSTR lsno str_input scc_pos+4 4
IF STRCHR lsno ' '
; "TAB" is found in lsno, copy 3 digits of the list number
SUBSTR lsno str_input scc_pos+4 3
ENDIF
CALL WRITE_SCL
ENDIF ; STRFIND SCC
ENDWHILE ; Not FEOF
FCLOSE 1
MSPAUSE 500
TRANSMIT "END^M"
FOPEN 2 output_file WRITE TEXT
FSEEK 2 0 2
FPUTS 2 " Automatic SCL program is finished"
FCLOSE 2
ENDIF ; STRCMP ProgSCL "YES"
;
;********************************************************************
IF STRCMP ProgItem "Program Digital Sets"
GOTO DIGITAL_SET
ELSEIF STRCMP ProgItem "Program IP Sets"
GOTO IP_SET
ELSE
GOTO ANALOG_SET
ENDIF
;
;;
;**********************************
;* *
;* PROGRAM IP SETS *
;* *
;**********************************
IP_SET:
TRANSMIT "****"
PAUSE 1
TRANSMIT "^M"
WAITFOR ">" FOREVER
MSPAUSE 500
TRANSMIT "LD 11"
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
FOPEN 1 inp_iset_file READ TEXT
MSPAUSE 500
;
; Begin programming an IP set
START_1_IP:
CALL Extract_param
set_type = set_array[1] ; parameter 1, IP set type
tn = set_array[2] ; parameter 2, TN
des = set_array[3] ; parameter 3, DES - can not be empty
buid = set_array[4] ; parameter 4, BUID or NUID - a number or empty
motn = set_array[5] ; parameter 5, MOTN or HOTN - a TN format number or empty
kem = set_array[6] ; parameter 6, KEM - a number or empty
zone = set_array[7] ; parameter 7, ZONE - a number
fdn = set_array[8] ; parameter 8, FDN - a number or empty
ncos = set_array[9] ; parameter 9, NCOS - a number or empty
rnpg = set_array[10] ; parameter 10, RNPG - a number or empty
scpw = set_array[11] ; parameter 11, SCPW - a number or empty
sgrp = set_array[12] ; parameter 12, SGRP - a number or empty
cls_temp = set_array[13] ; parameter 13, CLS template
efd = set_array[14] ; parameter 14, EFD - a number or empty
hunt = set_array[15] ; parameter 15, HUNT - a number or empty
eht = set_array[16] ; parameter 16, EHT - a number or empty
spid = set_array[17] ; parameter 17, SPID - a number or empty
;
; Possible extra parameter
;
SWITCH Xparam1
CASE "None"
; No extra parameter
GOTO IP_continue_1
ENDCASE
CASE "XLST"
xlst = set_array[18]
ENDCASE
CASE "TEN"
ten = set_array[18]
ENDCASE
CASE "SSU"
ssu = set_array[18]
ENDCASE
; CASE "AOM"
; aom = set_array[18]
; ENDCASE
ENDSWITCH
SWITCH Xparam2
CASE "None"
; No second parameter
GOTO IP_continue_1
ENDCASE
CASE "XLST"
xlst = set_array[19]
ENDCASE
CASE "TEN"
ten = set_array[19]
ENDCASE
CASE "SSU"
ssu = set_array[19]
ENDCASE
; next section not applicable to IP sets
; CASE "AOM"
; aom = set_array[19]
; ENDCASE
ENDSWITCH
;
IP_continue_1:
MSPAUSE 300
TRANSMIT "NEW^M"
WAITFOR "TYPE" FOREVER
MSPAUSE 500
TRANSMIT set_type
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "TN" FOREVER
CALL CHECK_TN
IF STRCMP tn "fail"
IF nbr_star == 2
CALL END_PROC
EXIT
ELSE
GOTO START_1_IP
ENDIF
ENDIF
; Waitfor DES is done in subroutine check-tn
TRANSMIT des
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "CUST" FOREVER
MSPAUSE 500
TRANSMIT "0^M"
; the next prompt may be BUID or NUID dependent upon system type
IF NOT WAITFOR "BUID" 2
CALL PUT_VALUE WITH buid
TRANSMIT "^M"
WAITFOR "BUID" FOREVER
ENDIF
CALL PUT_VALUE WITH buid
TRANSMIT "^M"
; the next prompt may be MOTN or HOTN dependent upon system type
IF NOT WAITFOR "MOTN" 2
CALL PUT_VALUE WITH motn
TRANSMIT "^M"
WAITFOR "MOTN" FOREVER
ENDIF
CALL PUT_VALUE WITH motn
TRANSMIT "^M"
WAITFOR "KEM" FOREVER
CALL PUT_VALUE WITH kem
TRANSMIT "^M"
WAITFOR "ZONE" FOREVER
CALL PUT_VALUE WITH zone
TRANSMIT "^M"
; this ifnot section not applicable to IP sets
; IF NOT WAITFOR "FDN" 2
; Prompt AOM is received
; CALL PUT_VALUE WITH aom
; TRANSMIT "^M"
WAITFOR "FDN" FOREVER
; ENDIF
CALL PUT_VALUE WITH fdn
TRANSMIT "^M"
WAITFOR "TGAR" FOREVER
MSPAUSE 300
TRANSMIT "0^M"
WAITFOR "LDN" FOREVER
MSPAUSE 300
TRANSMIT "^M"
; If NCOS is empty, return-NCOS 0 will be put
WAITFOR "NCOS" FOREVER
CALL PUT_VALUE WITH ncos
TRANSMIT "^M"
; If RNPG is not empty, CLS PUA will be default
WAITFOR "RNPG" FOREVER
CALL PUT_VALUE WITH rnpg
TRANSMIT "^M"
; Default SSU is 10
WAITFOR "SSU" FOREVER
CALL PUT_VALUE WITH ssu
TRANSMIT "^M"
IF NOT NULLSTR xlst
; Extra parameter xlst
WAITFOR "XLST" FOREVER
CALL PUT_VALUE WITH xlst
TRANSMIT "^M"
ENDIF
;WAITFOR "SCPW" FOREVER
;CALL PUT_VALUE WITH scpw
;TRANSMIT "^M"
WAITFOR "SGRP" FOREVER
;CALL PUT_VALUE WITH sgrp
TRANSMIT "^M"
WAITFOR "SFLT" FOREVER
MSPAUSE 300
TRANSMIT "^M"
CALL WRITE_CLS
TRANSMIT "^M"
;
; The next prompt may:RCO if CLS FNA and/or MWA
; MWA is standard on every digital set
WAITFOR "CAC" FOREVER
MSPAUSE 300
TRANSMIT "^M"
; The next prompt may be EFD HUNT EHT
; ....................................or.........HUNT......
IF WAITFOR "rco" 2
TRANSMIT "^M"
WAITFOR "EFD" 2
CALL PUT_VALUE WITH efd
TRANSMIT "^M"
WAITFOR "HUNT" FOREVER
CALL PUT_VALUE WITH hunt
TRANSMIT "^M"
WAITFOR "EHT" FOREVER
CALL PUT_VALUE WITH eht
ELSE
; Prompt HUNT is received
CALL PUT_VALUE WITH hunt
ENDIF
TRANSMIT "^M"
; The next prompt may: LHK LNRS
; or: LNRS if CLS LNA (standard on every set)
IF NOT WAITFOR "LNRS" 2
; LHK is received
TRANSMIT "^M"
WAITFOR "LNRS" FOREVER
ENDIF
MSPAUSE 500
TRANSMIT "20^M"
IF NOT NULLSTR ten
; Extra parameter ten
WAITFOR "TEN" FOREVER
CALL PUT_VALUE WITH ten
TRANSMIT "^M"
ENDIF
;
; Then the next Prompt may appear: SCI, PLEV, FCAR, (SPID), AST
;
; Test for ACD agent - wait SPID
IF NULLSTR spid
GOTO Non_ACD_agent_IP
ELSE
ATOI cls_temp cls_current
SWITCH cls_current
CASE 41
GOTO ACD_agent_IP
ENDCASE
CASE 42
GOTO ACD_agent_IP
ENDCASE
CASE 43
GOTO ACD_agent_IP
ENDCASE
CASE 44
GOTO ACD_agent_IP
ENDCASE
CASE 45
GOTO ACD_agent_IP
ENDCASE
CASE 61
GOTO ACD_agent_IP
ENDCASE
CASE 62
GOTO ACD_agent_IP
ENDCASE
CASE 63
GOTO ACD_agent_IP
ENDCASE
CASE 64
GOTO ACD_agent_IP
ENDCASE
CASE 65
GOTO ACD_agent_IP
ENDCASE
CASE 141
GOTO ACD_agent_IP
ENDCASE
CASE 142
GOTO ACD_agent_IP
ENDCASE
CASE 143
GOTO ACD_agent_IP
ENDCASE
CASE 144
GOTO ACD_agent_IP
ENDCASE
CASE 145
GOTO ACD_agent_IP
ENDCASE
DEFAULT
GOTO Non_ACD_agent_IP
ENDCASE
ENDSWITCH ; cls_current
ENDIF ; null string SPID
;
ACD_agent_IP:
WHILE NOT WAITFOR "SPID" 2
TRANSMIT "^M"
ENDWHILE
CALL PUT_VALUE WITH spid
TRANSMIT "^M"
;
Non_ACD_agent_IP:
WHILE NOT WAITFOR "AST" 2
TRANSMIT "^M"
ENDWHILE
MSPAUSE 300
TRANSMIT "^M"
;
; Then the next prompt may appear: IAPG, PRI, LANG, KEY
;
WHILE NOT WAITFOR "KEY" 2
; ALSO TO BE TESTED WHEN WAITTIME = 1 SECOND !!
TRANSMIT "^M"
ENDWHILE
MSPAUSE 300
;
; KEYS programing
;
key=0
array_cnt=18+num_extra_param ; parameter 18, 19 or 20 is the first_key
KEY_PROG_IP:
key_str = set_array[array_cnt]
IF NULLSTR key_str
; empty key
key++
array_cnt++
GOTO KEY_PROG_IP
ELSE
SWITCH key_str
DEFAULT
ITOA key S1
TRANSMIT S1
TRANSMIT " " ; transmit a space
MSPAUSE 200
SET TXPACE 150
TRANSMIT key_str
SET TXPACE 0
MSPAUSE 500
TRANSMIT "^M"
; The next prompt may be received (MARP), (CPND), (VMB), KEY
IF NOT WAITFOR "KEY" 3
; Wait less than 3 second will not work when MARP is received
TRANSMIT "^M"
WHILE NOT WAITFOR "KEY" 2
; ALSO TO BE TESTED WHEN WAITTIME = 1 SECOND !!
TRANSMIT "^M"
ENDWHILE
ENDIF
MSPAUSE 200
key++
array_cnt++
GOTO KEY_PROG_IP
ENDCASE
CASE "*"
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
GOTO START_1
ENDCASE
CASE "**"
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
CALL END_PROC
EXIT
ENDCASE
ENDSWITCH
ENDIF
;
;
;**********************************
;* *
;* PROGRAM DIGITAL SETS *
;* *
;**********************************
DIGITAL_SET:
TRANSMIT "****"
PAUSE 1
TRANSMIT "^M"
WAITFOR ">" FOREVER
MSPAUSE 500
TRANSMIT "LD 11"
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
FOPEN 1 inp_2000_file READ TEXT
MSPAUSE 500
;
; Begin of programming a 2000 set
START_1:
CALL Extract_param
set_type = set_array[1] ; parameter 1, 2000 set type
tn = set_array[2] ; parameter 2, TN
des = set_array[3] ; parameter 3, DES
fdn = set_array[4] ; parameter 4, FDN - a number or empty
ncos = set_array[5] ; parameter 5, NCOS - a number or empty
rnpg = set_array[6] ; parameter 6, RNPG - a number or empty
scpw = set_array[7] ; parameter 7, SCPW - a number or empty
sgrp = set_array[8] ; parameter 8, SGRP - a number or empty
cls_temp = set_array[9] ; parameter 9, CLS template
efd = set_array[10] ; parameter 10, EFD - a number or empty
hunt = set_array[11] ; parameter 11, HUNT - a number or empty
eht = set_array[12] ; parameter 12, EHT - a number or empty
spid = set_array[13] ; parameter 13, SPID - a number or empty
;
; Possible extra parameter
;
SWITCH Xparam1
CASE "None"
; No extra parameter
GOTO Dig_continue_1
ENDCASE
CASE "XLST"
xlst = set_array[14]
ENDCASE
CASE "TEN"
ten = set_array[14]
ENDCASE
CASE "SSU"
ssu = set_array[14]
ENDCASE
CASE "AOM"
aom = set_array[14]
ENDCASE
ENDSWITCH
SWITCH Xparam2
CASE "None"
; No second parameter
GOTO Dig_continue_1
ENDCASE
CASE "XLST"
xlst = set_array[15]
ENDCASE
CASE "TEN"
ten = set_array[15]
ENDCASE
CASE "SSU"
ssu = set_array[15]
ENDCASE
CASE "AOM"
aom = set_array[15]
ENDCASE
ENDSWITCH
;
Dig_continue_1:
MSPAUSE 300
TRANSMIT "NEW^M"
WAITFOR "TYPE" FOREVER
MSPAUSE 500
TRANSMIT set_type
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "TN" FOREVER
CALL CHECK_TN
IF STRCMP tn "fail"
IF nbr_star == 2
CALL END_PROC
EXIT
ELSE
GOTO START_1
ENDIF
ENDIF
; Waitfor DES is done in subroutine check-tn
TRANSMIT des
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "CUST" FOREVER
MSPAUSE 500
TRANSMIT "0^M"
IF NOT WAITFOR "FDN" 2
; Prompt AOM is received
CALL PUT_VALUE WITH aom
TRANSMIT "^M"
WAITFOR "FDN" FOREVER
ENDIF
CALL PUT_VALUE WITH fdn
TRANSMIT "^M"
WAITFOR "TGAR" FOREVER
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "LDN" FOREVER
MSPAUSE 300
TRANSMIT "^M"
; If NCOS is empty, return-NCOS 0 will be put
WAITFOR "NCOS" FOREVER
CALL PUT_VALUE WITH ncos
TRANSMIT "^M"
; If RNPG is not empty, CLS PUA will be default
WAITFOR "RNPG" FOREVER
CALL PUT_VALUE WITH rnpg
TRANSMIT "^M"
; Default SSU is 10
WAITFOR "SSU" FOREVER
CALL PUT_VALUE WITH ssu
TRANSMIT "^M"
IF NOT NULLSTR xlst
; Extra parameter xlst
WAITFOR "XLST" FOREVER
CALL PUT_VALUE WITH xlst
TRANSMIT "^M"
ENDIF
WAITFOR "SCPW" FOREVER
CALL PUT_VALUE WITH scpw
TRANSMIT "^M"
WAITFOR "SGRP" FOREVER
;CALL PUT_VALUE WITH sgrp
TRANSMIT "^M"
WAITFOR "SFLT" FOREVER
MSPAUSE 300
CALL WRITE_CLS
TRANSMIT "^M"
;
; The next prompt may:RCO if CLS FNA and/or MWA
; MWA is standard on every digital set
WAITFOR "RCO" FOREVER
MSPAUSE 300
TRANSMIT "^M"
; The next prompt may be EFD HUNT EHT
; ....................................or.........HUNT......
IF WAITFOR "EFD" 2
CALL PUT_VALUE WITH efd
TRANSMIT "^M"
WAITFOR "HUNT" FOREVER
CALL PUT_VALUE WITH hunt
TRANSMIT "^M"
WAITFOR "EHT" FOREVER
CALL PUT_VALUE WITH eht
ELSE
; Prompt HUNT is received
CALL PUT_VALUE WITH hunt
ENDIF
TRANSMIT "^M"
; The next prompt may: LHK LNRS
; or: LNRS if CLS LNA (standard on every set)
IF NOT WAITFOR "LNRS" 2
; LHK is received
TRANSMIT "^M"
WAITFOR "LNRS" FOREVER
ENDIF
MSPAUSE 500
TRANSMIT "20^M"
IF NOT NULLSTR ten
; Extra parameter ten
WAITFOR "TEN" FOREVER
CALL PUT_VALUE WITH ten
TRANSMIT "^M"
ENDIF
;
; Then the next Prompt may appear: SCI, PLEV, FCAR, (SPID), AST
;
; Test for ACD agent - wait SPID
IF NULLSTR spid
GOTO Non_ACD_agent
ELSE
ATOI cls_temp cls_current
SWITCH cls_current
CASE 41
GOTO ACD_agent
ENDCASE
CASE 42
GOTO ACD_agent
ENDCASE
CASE 43
GOTO ACD_agent
ENDCASE
CASE 44
GOTO ACD_agent
ENDCASE
CASE 45
GOTO ACD_agent
ENDCASE
CASE 61
GOTO ACD_agent
ENDCASE
CASE 62
GOTO ACD_agent
ENDCASE
CASE 63
GOTO ACD_agent
ENDCASE
CASE 64
GOTO ACD_agent
ENDCASE
CASE 65
GOTO ACD_agent
ENDCASE
CASE 141
GOTO ACD_agent
ENDCASE
CASE 142
GOTO ACD_agent
ENDCASE
CASE 143
GOTO ACD_agent
ENDCASE
CASE 144
GOTO ACD_agent
ENDCASE
CASE 145
GOTO ACD_agent
ENDCASE
DEFAULT
GOTO Non_ACD_agent
ENDCASE
ENDSWITCH ; cls_current
ENDIF ; null string SPID
;
ACD_agent:
WHILE NOT WAITFOR "SPID" 2
TRANSMIT "^M"
ENDWHILE
CALL PUT_VALUE WITH spid
TRANSMIT "^M"
;
Non_ACD_agent:
WHILE NOT WAITFOR "AST" 2
TRANSMIT "^M"
ENDWHILE
MSPAUSE 300
TRANSMIT "^M"
;
; Then the next prompt may appear: IAPG, PRI, LANG, KEY
;
WHILE NOT WAITFOR "KEY" 2
; ALSO TO BE TESTED WHEN WAITTIME = 1 SECOND !!
TRANSMIT "^M"
ENDWHILE
MSPAUSE 300
;
; KEYS programing
;
key=0
array_cnt=14+num_extra_param ; parameter 14, 15 or 16 is the first_key
KEY_PROG:
key_str = set_array[array_cnt]
IF NULLSTR key_str
; empty key
key++
array_cnt++
GOTO KEY_PROG
ELSE
SWITCH key_str
DEFAULT
ITOA key S1
TRANSMIT S1
TRANSMIT " " ; transmit a space
MSPAUSE 200
SET TXPACE 150
TRANSMIT key_str
SET TXPACE 0
MSPAUSE 500
TRANSMIT "^M"
; The next prompt may be received (MARP), (CPND), (VMB), KEY
IF NOT WAITFOR "KEY" 3
; Wait less than 3 second will not work when MARP is received
TRANSMIT "^M"
WHILE NOT WAITFOR "KEY" 2
; ALSO TO BE TESTED WHEN WAITTIME = 1 SECOND !!
TRANSMIT "^M"
ENDWHILE
ENDIF
MSPAUSE 200
key++
array_cnt++
GOTO KEY_PROG
ENDCASE
CASE "*"
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
GOTO START_1
ENDCASE
CASE "**"
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
CALL END_PROC
EXIT
ENDCASE
ENDSWITCH
ENDIF
;
;**********************************
;* *
;* PROGRAM ANALOG SETS *
;* *
;**********************************
ANALOG_SET:
TRANSMIT "****"
PAUSE 1
TRANSMIT "^M"
WAITFOR ">" FOREVER
MSPAUSE 500
TRANSMIT "LD 10"
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
MSPAUSE 300
FOPEN 1 inp_500_file READ TEXT
MSPAUSE 300
;
; Begin of programming an analog set
START_2:
CALL Extract_param
tn = set_array[1] ; parameter 1, TN
des = set_array[2] ; parameter 2, DES
dn = set_array[3] ; parameter 3, DN
hunt = set_array[4] ; parameter 4, HUNT - a number or empty
ncos = set_array[5] ; parameter 5, NCOS - a number or empty
rnpg = set_array[6] ; parameter 6, RNPG - a number or empty
scpw = set_array[7] ; parameter 7, SCPW - a number or empty
sgrp = set_array[8] ; parameter 8, SGRP - a number or empty
cls_temp = set_array[9] ; parameter 9, CLS template
;
; Possible extra parameter, for analog sets only XLST and TEN are possible
;
SWITCH Xparam1
CASE "None"
; No extra parameter
GOTO Ana_continue_1
ENDCASE
CASE "XLST"
xlst = set_array[10]
ENDCASE
CASE "TEN"
ten = set_array[10]
ENDCASE
DEFAULT
EXITSWITCH
ENDCASE
ENDSWITCH
SWITCH Xparam2
CASE "None"
; No second parameter
GOTO Ana_continue_1
ENDCASE
CASE "XLST"
xlst = set_array[11]
ENDCASE
CASE "TEN"
ten = set_array[11]
ENDCASE
DEFAULT
EXITSWITCH
ENDCASE
ENDSWITCH
;
Ana_continue_1:
MSPAUSE 300
TRANSMIT "NEW^M"
WAITFOR "TYPE" FOREVER
MSPAUSE 500
TRANSMIT "500^M"
WAITFOR "TN" FOREVER
CALL CHECK_TN
IF STRCMP tn "fail"
IF nbr_star == 2
CALL END_PROC
EXIT
ELSE
GOTO START_1
ENDIF
ENDIF
; Waitfor DES is done in subroutine check-tn
TRANSMIT des
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "CUST" FOREVER
MSPAUSE 500
TRANSMIT "0^M"
; The next prompt may appear: WRLS, DIG, DN
WHILE NOT WAITFOR "DN" 2
TRANSMIT "^M"
ENDWHILE
MSPAUSE 500
TRANSMIT dn
MSPAUSE 300
TRANSMIT "^M"
; The next prompt may be received (MARP), (CPND), (VMB), AST
IF NOT WAITFOR "AST" 3
; Wait less than 3 second will not work when MARP is received
TRANSMIT "^M"
WHILE NOT WAITFOR "AST" 2
; ALSO TO BE TESTED WHEN WAITTIME = 1 SECOND !!
TRANSMIT "^M"
ENDWHILE
ENDIF
MSPAUSE 300
TRANSMIT "^M"
IF WAITFOR "IAPG" 2
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "HUNT" FOREVER
; ELSE prompt HUNT is received
ENDIF
CALL PUT_VALUE WITH hunt
TRANSMIT "^M"
WAITFOR "TGAR" FOREVER
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "LDN" FOREVER
MSPAUSE 300
TRANSMIT "^M"
; If NCOS is empty, return-NCOS 0 will be put
WAITFOR "NCOS" FOREVER
CALL PUT_VALUE WITH ncos
TRANSMIT "^M"
; If RNPG is not empty, CLS PUA will be default
WAITFOR "RNPG" FOREVER
CALL PUT_VALUE WITH rnpg
TRANSMIT "^M"
IF NOT NULLSTR xlst
; Extra parameter xlst
WAITFOR "XLST" FOREVER
CALL PUT_VALUE WITH xlst
TRANSMIT "^M"
ENDIF
WAITFOR "SCPW" FOREVER
CALL PUT_VALUE WITH scpw
TRANSMIT "^M"
WAITFOR "SGRP" FOREVER
CALL PUT_VALUE WITH sgrp
TRANSMIT "^M"
WAITFOR "SFLT" FOREVER
MSPAUSE 300
CALL WRITE_CLS
TRANSMIT "^M"
IF NOT WAITFOR "LNRS" 2
; Prompt RCO is received
TRANSMIT "^M"
WAITFOR "LNRS" FOREVER
ENDIF
MSPAUSE 300
TRANSMIT "20^M"
IF NOT NULLSTR ten
; Extra parameter ten
WAITFOR "TEN" FOREVER
CALL PUT_VALUE WITH ten
TRANSMIT "^M"
ENDIF
;
; The next prompt may be received: SCI, FCAR, PLEV, PRI & AACD (Analog ACD), LANG
WHILE NOT WAITFOR "FTR" 2
; ALSO TO BE TESTED WHEN WAITTIME = 1 SECOND !!
TRANSMIT "^M"
ENDWHILE
;
; FTR - feature- programing
;
; Read the next input parameter in set_array, it may :
; - empty -> read next parameter
; - ** -> programming is finish
; - * -> programming of this set is finished
; - 500 set feature
;
SET TXPACE 200
array_cnt=9+num_extra_param ; parameter(+1) 9, 10 or 11 is the first FTR
START_FTR:
array_cnt++
MSPAUSE 300
feature = set_array[array_cnt]
SWITCH feature
DEFAULT
TRANSMIT feature
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "FTR" FOREVER
GOTO START_FTR
ENDCASE
CASE ""
; empty feature
GOTO START_FTR
ENDCASE
CASE "*"
SET TXPACE 0
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
GOTO START_2
ENDCASE
CASE "**"
SET TXPACE 0
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
CALL END_PROC
EXIT
ENDCASE
ENDSWITCH
ENDPROC ; MAIN
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; S U B R O U T I N E ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
PROC WRITE_SCL
;
MSPAUSE 500
TRANSMIT "NEW^M"
WAITFOR "TYPE" FOREVER
MSPAUSE 500
TRANSMIT "SCL^M"
WAITFOR "LSNO" FOREVER
MSPAUSE 300
TRANSMIT lsno
MSPAUSE 300
TRANSMIT "^M"
IF WAITFOR "DNSZ" 2
TRANSMIT dnsz
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "SIZE" FOREVER
MSPAUSE 300
TRANSMIT _size
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "WRT" FOREVER
MSPAUSE 300
TRANSMIT "^M"
WAITFOR "STOR" FOREVER
ELSE
; SCL number is not OK -- write in a ouput file
FOPEN 2 output_file WRITE TEXT
FSEEK 2 0 2
S1="The next SCL can not be programmed: "
STRCAT S1 lsno
FPUTS 2 S1
FCLOSE 2
MSPAUSE 300
TRANSMIT "**"
ENDIF
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
MSPAUSE 300
ENDPROC ; WRITE_SCL
;
; ***************************
;
PROC Extract_param
;
; Read the set parameter from the input file
; One input file line contains all parameter for one set,
; a TAB between the parameter and * at the end of line.
; Result are saved in set_array
;
STRING set_string, more_string = "NO"
INTEGER str_length, count1, nbr_param
LONG back_pos
nbr_star = 0
array_cnt = 1
more_string = "NO"
FGETS 1 set_string
STRLEN set_string str_length
;;????When the previous line length = 255 or 256 FGETS read nothing
IF str_length == 0
FGETS 1 set_string ; Try again
STRLEN set_string str_length
ENDIF
;;;?????????????????
STRSEARCH set_string "*" nbr_star
; nbr_star = 0 (no star is found), = 1 ( * is found), = 2, ** is found
IF str_length < 256 ; max length of string variable = 256
more_string = "NO"
ELSE
; Total parameter length of this set >= 256.
IF nbr_star > 0
; * or ** is found, all parameters for this set have been read.
more_string = "NO"
ELSE
; * is NOT found, totall parameter length of this set > 256
more_string = "YES"
ENDIF
ENDIF ; str_length < 256
Start_extract:
STRSEARCH set_string " " nbr_param
;nbr_param the number of valid parameter (TAB as delimeter)
FOR count1=1 upto nbr_param
; Find a string till a TAB is found, STREXTRACT first param pos is 0
STREXTRACT set_array[array_cnt] set_string " " count1-1
array_cnt ++
ENDFOR
STREXTRACT set_array[array_cnt] set_string " " nbr_param
IF STRCMP more_string "YES"
STRLEN set_array[array_cnt] str_length
back_pos = 0-str_length
; File pointer back to the beginning of the last found parameter
FSEEK 1 back_pos 1
FGETS 1 set_string
STRSEARCH set_string "*" nbr_star
STRLEN set_string str_length
IF str_length < 256 ; max length of string variable = 256
more_string = "NO"
ELSE
; Total parameter length of this set >= 256.
IF nbr_star > 0
; * or ** is found, all parameters for this set have been read.
more_string = "NO"
ENDIF
ENDIF ; str_length < 256
GOTO Start_extract
ENDIF ; more_string
ENDPROC ; Extract_param
;
; ***************************
;
PROC Get_extra_param
;
; This procedure asks the user to give extra parameters which are added in the Input File.
;
DIALOGBOX 10 6 60 300 150 259 "ASPAM version 3.0 G. Kirana"
TEXT 11 16 16 300 20 "Now you can easily add extra paramaters into the Standard Input File." LEFT
TEXT 12 16 30 300 20 "The FIRST extra parameter must be inserted in:" LEFT
TEXT 13 16 44 300 20 " Digital set (D): Between SPID and KEY parameters." LEFT
TEXT 14 16 58 300 20 " Analog set (A): Between CLS and FTR parameters." LEFT
TEXT 15 16 90 300 20 "Extra parameter 1 - column 14 (D), column 10 (A) :" LEFT
COMBOBOX 16 186 90 100 66 DROPDOWNLIST PromptList PromptItem
PUSHBUTTON 17 186 120 60 16 " OK " ok DEFAULT
ENDDIALOG
WHILE 1
DLGEVENT 10 Event
SWITCH Event
CASE 0
ENDCASE
CASE 16 ; Combobox extra parameter 1
Xparam1 = PromptItem
ENDCASE
DEFAULT
EXITWHILE
ENDCASE
ENDSWITCH
ENDWHILE
IF STRCMP Xparam1 "None"
num_extra_param = 0
ELSE
PromptItem = "None"
DIALOGBOX 20 6 80 300 150 259 "ASPAM version 3.0 G. Kirana"
TEXT 21 16 16 300 20 "You have added one parameter, now you can add the second paramater if you wish." LEFT
TEXT 22 16 30 300 20 "The SECOND extra parameter must be inserted in:" LEFT
TEXT 23 16 44 300 20 " Digital set (D): Between FIRST extra parameter and KEY parameter." LEFT
TEXT 24 16 58 300 20 " Analog set (A): Between FIRST extra parameter and FTR parameter." LEFT
TEXT 25 16 90 300 20 "Extra parameter 2 - column 15 (D), column 11 (A) :" LEFT
COMBOBOX 26 186 90 100 66 DROPDOWNLIST PromptList PromptItem
PUSHBUTTON 27 186 120 60 16 " OK " ok DEFAULT
ENDDIALOG
WHILE 1
DLGEVENT 20 Event
SWITCH Event
CASE 0
ENDCASE
CASE 26 ; Combobox extra parameter 2
Xparam2 = PromptItem
ENDCASE
DEFAULT
EXITWHILE
ENDCASE
ENDSWITCH
ENDWHILE
DLGDESTROY 20 CANCEL
IF STRCMP Xparam2 "None"
num_extra_param = 1
ELSE
num_extra_param = 2
ENDIF ; Xparam2 = "None"
ENDIF ; Xparam1 = "None"
USERMSG "Extra parameter 1: %s , Extra parameter 2: %s " Xparam1 Xparam2
ENDPROC ; Get_extra_param
;
; ***************************
;
PROC WRITE_CLS
;
; Transmit the right CLS value
;
SET TXPACE 200
ATOI cls_temp cls_current
IF cls_current>=cls_previous
read_counter=cls_current-cls_previous
ELSE
read_counter=cls_current
FSEEK 3 0 0
ENDIF
cls_previous=cls_current
;
IF read_counter>0
FOR index=1 UPTO read_counter
FGETS 3 cls_string
ENDFOR
STRDELETE cls_string 0 4
ENDIF
;
TRANSMIT "^M"
WHILE NOT WAITFOR "CLS" 2
; Prompt "CAC" may be received
TRANSMIT "^M"
ENDWHILE
MSPAUSE 500
TRANSMIT cls_string
MSPAUSE 500
SET TXPACE 0
ENDPROC ; WRITE_CLS
;
; ***************************
;
PROC CHECK_TN
;
; This subroutine tries to put the TN from the input file
; When it fail, the TN will be put into the output file
;
SET TXPACE 150
TRANSMIT tn
MSPAUSE 500
TRANSMIT "^M"
IF NOT WAITFOR "DES" 3
; Prompt TN or CDEN (Analog set) is received.
MSPAUSE 300
TRANSMIT "^M"
IF NOT WAITFOR "DES" 2
MSPAUSE 300
FOPEN 2 output_file WRITE TEXT
FSEEK 2 0 2
S1="The next TN can not be programmed: "
STRCAT S1 tn
FPUTS 2 S1
FCLOSE 2
TRANSMIT "**"
MSPAUSE 500
TRANSMIT "^M"
WAITFOR "REQ" FOREVER
tn = "fail"
ENDIF
ENDIF
SET TXPACE 0
MSPAUSE 300
ENDPROC ; CHECK_TN
; ***************************
PROC PUT_VALUE
;
; This subroutine writes the value from the input file to the
; approriate Prompt, if the parameter is empty RETURN only will be transmitted
; after procedure return
;
param string value
MSPAUSE 300
IF NOT NULLSTR value
TRANSMIT value
MSPAUSE 300
ENDIF
ENDPROC ; PUT_VALUE
; ***************************
;
PROC END_PROC
;
; Automatic programming is finished
;
MSPAUSE 500
FOPEN 2 output_file WRITE TEXT
FSEEK 2 0 2
FPUTS 2 " Automatic SET programming is finished"
FCLOSE 1
FCLOSE 2
FCLOSE 3
DIALOGBOX 0 6 12 250 120 259 "SET PROG version 1.0b C.Johnson"
TEXT 700 6 20 250 20 "Automatic SET programming is finished" CENTER
TEXT 701 6 40 250 10 "Do not forget to check the OUTPUT file: SETOUT.DOC" CENTER
PUSHBUTTON 10 150 100 40 14 "OK" ok DEFAULT
ENDDIALOG
WHILE 1
DLGEVENT 0 Event
SWITCH Event
CASE 0
ENDCASE
DEFAULT
EXITWHILE
ENDCASE
ENDSWITCH
ENDWHILE
dlgdestroy 0 CANCEL
ENDPROC ; END_PROC
; ***************************
This is 1 portion of the 500dat.txt
15 0 0 0 500 42200 42200 5 8 *
15 0 0 1 500 42201 42201 5 8 *
15 0 0 2 500 42202 42202 5 8 *
15 0 0 3 500 42203 42203 5 8 *
15 0 0 4 500 42204 42204 5 8 *
15 0 0 5 500 42205 42205 5 8 *
15 0 0 6 500 42206 42206 5 8 *
15 0 0 7 500 42207 42207 5 8 *
15 0 0 8 500 42208 42208 5 8 *
15 0 0 9 500 42209 42209 5 8 *
15 0 0 10 500 42210 42210 5 8 *
15 0 0 11 500 42211 42211 5 8 *
15 0 0 12 500 42212 42212 5 8 *
15 0 0 13 500 42213 42213 5 8 *
15 0 0 14 500 42214 42214 5 8 *
15 0 0 15 500 42215 42215 5 8 **
This is a portion of the cls-ten.txt fils
0 TLD DTN ARHA C6A CFXD DPUA GPUA LNA XFA XRA PUA
1 TLD DTN ARHA C6A CFXD DPUA GPUA LNA XFA XRA
2 TLD DTN ARHA C6A CFXD DPUA GPUA LNA XFA XRA FNA CFTA SFA HBTA
3 TLD DTN ARHA C6A CFXD DPUA GPUA LNA XFA XRA FNA CFTA SFA FBA
4 TLD DTN ARHA C6A CFXD DPUA GPUA LNA XFA XRA FNA HTA CFTA SFA HBTA
5 TLD DTN ARHA C6A CFXD DPUA GPUA LNA XFA XRA FNA HTA CFTA SFA FBA
6 TLD DTN CFXD LNA FAXA
7 TLD DTN ARHA C6A CFXD DPUA GPUA LNA XFA XRA FN
9 TLD DTN ARHA C6A CFXD DPUA GPUA LNA XFA XRA FNA HTA CFTA SFA HBTA CFXA