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!

how to mod. this procomm script to remove 7 digit npa's in a meridian

Status
Not open for further replies.

hydroaddiction

Programmer
Nov 13, 2007
8
US
I need to modify this script (in Procomm 4.8) to remove 7 digit npa's. By entering the space on line 3 between 205 and 201 the script will not compile. Without the space the pbx will not accept the npa. Any help would be greatly appreciated.

*******************************
out npa script
*******************************
proc main
integer loops=0
integer npaex=1205 201


integer npaex1=npaex
string sznpaex
itoa npaex sznpaex

transmit "LD 90^M"
waitfor "REQ"
transmit "OUT^M"
waitfor "CUST"
transmit "0^M"
waitfor "FEAT"
transmit "NET^M"
waitfor "TRAN"
transmit "AC1^M"
waitfor "TYPE"
transmit "NPA^M"
waitfor "NPA"


npa:

loops++
if loops=800
elseif npaex1=999
endif

transmit sznpaex
transmit "^M"


npaex1=npaex1+1
itoa npaex1 sznpaex
waitquiet 1

goto npa

endproc
 
What you will need to do is break that number into two separate integers so there is no space, increment the second integer as you are doing now, then process both integers at the same time with two itoa commands. You'll also need to add a transmit " " statement at the appropriate spot to send the required space. My hunch is that the itoa commands in the script would have an issue with the space if that was allowed, but I may be wrong about that.

 
You can try putting something like this into your script:
Code:
 string npatxt
 integer npaexpart1=1205
 integer npaexpart2=201


      strfmt npatxt "%d %d^M" npaexpart1 npaexpart2
      transmit npatxt
This breaks the NPA into to parts that you can increment
or do whatewer you want with, and then put the to parts
together with the strfmt command and send it to the switch.

HTH :)
 
Thanks for the help! Now it xmits to the pbx the first npa I need to remove which is 1205 201 but it does not increment to the next npa. Any thoughts?

Here is a copy of what I am using now:

*******************
proc main
integer loops=0

string npatxt
integer npaexpart1=1205
integer npaexpart2=201

strfmt npatxt "%d %d^M" npaexpart1 npaexpart2



transmit "LD 90^M"
waitfor "REQ"
transmit "OUT^M"
waitfor "CUST"
transmit "0^M"
waitfor "FEAT"
transmit "NET^M"
waitfor "TRAN"
transmit "AC1^M"
waitfor "TYPE"
transmit "NPA^M"
waitfor "NPA"

npa:

loops++
if loops=800



transmit npatxt

npaexpart1=npaexpart1+1
npaexpart2=npaexpart2+1



waitquiet 1

goto npa

endif
endproc
 
Try incrementing the variables with:
Code:
(npaexpart1++)
(npaexpart2++)
insted of npaexpart1=npaexpart1+1 and
npaexpart1=npaexpart2+1

HTH
 
Think you need to move the
Code:
strfmt npatxt "%d %d^M" npaexpart1 npaexpart2
line dont so it's inside your
npa:

goto npa
loop. Else npatxt will remain the same nomather
what you increment the to other variables to!
 
Using your code as a basis, this is your fix:
(I've added comments to the code to make it more readable and to help explain what is being done.)

Code:
*******************************
out npa script
*******************************
proc main
   integer loops=0
   integer npa=1205
   integer ext=201
   string sznpaex

   itoa npaex sznpaex

   transmit    "LD 90^M"
   waitfor  "REQ"
   transmit   "OUT^M"
   waitfor  "CUST"
   transmit  "0^M"
   waitfor  "FEAT"
   transmit   "NET^M"
   waitfor  "TRAN"
   transmit  "AC1^M"
   waitfor  "TYPE"
   transmit  "NPA^M"
   waitfor  "NPA"

   while npa <= 1999
		; while NPA is starting value to 1999

		; first verify if the NPA should be skipped,
		if npa = 1800
			; do nothing
			; you can add more elseif npa = X to remove other
			; NPAs that are not programmed
		else
			; default
			
			; loop from NXX 200 to NXX 999
			for ext = 200 upto 999
			
				if ext = 911
					; there are no NXX 911 in any location, so skip those
					; you can also add more elseif ext = X to remove other
					; NXXs that are not programmed in each NPA
				else
					; default
					; convert npa + ext to "npa ext" with a carriage return
					strfmt sznpaex "%d %d^M" npa ext
					; send carriage return to the PBX
					transmit sznpaex
					; wait until it's quiet to prevent overrun
					waitquiet 1
				endif
				
				; for loop auto increments ext on each pass
			endfor
			
		endif
		
		; increment npa by one, then go back and check if 
		npa++
		
		; recommended in the ASPECT script documentation
		yield
		
   endwhile

	;	while & for loops are both used for educational purposes
	;	Personally, I would have done this whole thing with two for loops
	;	and I would never use goto unless there was no other way to perform
	;	the desired action.  goto creates all sorts of problems in programming.

endproc

You can also find my Meridian scripting reference page linked from knob's website at
I link his page however since he's been doing this for a lot longer than I have and has amassed a lot more generalized aspect scripting information.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top