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!

Any Procomm Plus experts out there?

Status
Not open for further replies.

vgayet

Programmer
Sep 24, 2002
1
US
Hi,
I am calling a Procomm Plus32 V4.7 script from ASP.NET that connects to a PBSI system(Positive Business Solutions, Inc), an ERP system running on a Unix box. I am using a telnet connection and Zmodem protocol. Both the web server and the ERP system are on the same network.
I am wondering why this script is taking forever to run. All the script does is read a few lines from a comma delimited file, then update the ERP database.

Can someone tell me how I can speed up this process? Do I have to change the protocol type or any other option in the procomm connection directory properties? Your help is appreciated.
Thanks,
Here is the script procedure:

;Recorded script. Editing may be required.
proc main
string LineBuffer
string LineNum
string RecID
string EmpNum
string WONum
string OperNum
string QtyAccept
string QtyReject
string QtyScrap
string RecType
string AdjTime
string outputline
integer len
string rspfname = "C:\PBSIInterface\LaborEntry\pbsirsp."
string Fname = "C:\PBSIInterface\LaborEntry\PBSIREQ."
integer waittime = 10
string status = "Y"
string iErrCode ; 1000: BAD WO, 1001: BAD OPER

integer iXPosn
string strPosn
integer iNum ; used in null str fn

;REM -- Login and go to the Labor Entry screen
connect TELNET "PBSI Prod"
waitfor "login: "
transmit "test1^M"
waitfor "^[[7mSELECTION ('0' TO END):^[[0m^[[1m 0^[[24;29H" waittime
If FAILURE
transmit "^M"
waitfor "^[[7mSELECTION ('0' TO END):^[[0m^[[1m 0^[[24;29H" waittime
If FAILURE
goto end
endif
endif

;REM -- ===== Batch data entry screen =========
transmit "1"
waitfor "1 ^[[24;30H"
transmit "2"
waitfor "ORDER ENTRY "
transmit "^M"
waitfor "^[[7mSELECTION ('0' TO END):^[[0m^[[1m 0^[[24;29H"
transmit "6"
waitfor "6 ^[[24;29H"
transmit "^M"
waitfor "^[[7mSELECTION ('0' TO END):^[[0m^[[1m 0^[[24;29H"
transmit "1"
waitfor "1 ^[[24;29H"
transmit "^M"
waitfor "^[[K"
transmit "1^M" ;enter shift #
waitfor "^[[K"
;transmit "14^M" ;enter batch #
transmit s1
transmit "^M"
waitfor "BATCH EXISTS, DO YOU WISH TO CONTINUE? (Y/N): " 5
If FAILURE
waitfor "^[[5;7H" 3
elseif SUCCESS
transmit "Y^M"
waitfor "^[[5;7H" 5
endif

transmit s0 ;enter timesheet date
transmit "^M"

waitfor "^[[10;1H"
transmit "^M"
waitfor "^[[10;11H"
transmit "^M"
waitfor "^[[10;21H"
transmit "^M"
waitfor "^[[10;32H"
transmit "^M"
waitfor "^[[KARE THE BATCH TOTAL FIELDS CORRECT? (Y/N): "
transmit "y^M"
waitfor "^[[4;5H"

;output file name
strcat rspfname s3
;input file name
strcat Fname s2

iXPosn = 4


;REM -- ========= Labor Entry screen ; source file: PBSIReq.; destn file: PBSIResp. ===============
if fopen 0 Fname READ TEXT ; Open file for read only

fopen 2 rspfname write text ; Open Response file for write mode

while not feof 0 ; Loop while not end of file

iErrCode = "0"

fgets 0 LineBuffer ; Get line from file

if feof 0
goto fileclose
endif

strtok LineNum LineBuffer "," 1 ; Get the Line #
strtok RecID LineBuffer "," 1 ; Get the Rec ID
strtok EmpNum LineBuffer "," 1 ; Get the EmployeeID
strtok WONum LineBuffer "," 1 ; Get the Work Order #
strtok OperNum LineBuffer "," 1 ; Get the WorkOrder Opr #
strtok QtyAccept LineBuffer "," 1 ; Get the Qty Accept
strtok QtyReject LineBuffer "," 1 ; Get the Qty Accept
strtok QtyScrap LineBuffer "," 1 ; Get the Qty Accept
strtok RecType LineBuffer "," 1 ; Get the Type - S:Setup, Spce: Vouhcer/Indirect
strtok AdjTime LineBuffer "," 1 ; Get the Run time (Adjusted)

; REM -- Strip out the quotes
strreplace LineNum "`"" ""
strreplace RecID "`"" ""
strreplace EmpNum "`"" ""
strreplace WONum "`"" ""
strreplace OperNum "`"" ""
strreplace QtyAccept "`"" ""
strreplace QtyReject "`"" ""
strreplace QtyScrap "`"" ""
strreplace RecType "`"" ""
strreplace AdjTime "`"" ""


outputline = LineNum ; for response file
strcat outputline ","
strcat outputline RecID
strcat outputline ","

waitfor "^[[%d" iXPosn;5H" 3
transmit EmpNum ;emp #
transmit "^M"

transmit WoNum ;WO #
transmit "^M"

WoNum = trim(WoNum)
if nullstr WoNum ;was: if not nullstr WoNum
else
waitfor &quot;^[[KENTER <CR> TO CONTINUE OR 'M' TO SEE MORE OPERATIONS: &quot; 3
if SUCCESS
transmit &quot;^M&quot;
goto readnext
elseif FAILURE
;transmit &quot;^M&quot; ;added on 28aug02
endif

waitfor &quot;^[[KPRESS <CR> TO ACKNOWLEDGE: &quot; 3 ; was 1 then 3
if SUCCESS
iErrCode = &quot;1000&quot;
status = &quot;N&quot;
goto UpdateResp
elseif FAILURE

endif

endif

readnext:
transmit OperNum ;oper num
transmit &quot;^M&quot;

;===added this exception - 28aug02
if not nullstr WoNum
waitfor &quot;^[[KPRESS <CR> TO ACKNOWLEDGE: &quot; 3
if SUCCESS
iErrCode = &quot;1000&quot;
status = &quot;N&quot;
goto UpdateResp
endif
endif

if nullstr WoNum
transmit &quot;1^M&quot; ;dept #
endif

if not nullstr WoNum
transmit QtyAccept ;qty
transmit &quot;^M&quot;
endif

transmit &quot; ^M&quot; ;start time
transmit &quot; ^M&quot; ;end time

transmit AdjTime ;elapsed time
transmit &quot;^M&quot;

if nullstr WoNum
else
transmit &quot;^M&quot;
waitfor &quot;^[[KA'CCEPT OR R'EJECT: &quot; 3 ; was 1 , then 5
if FAILURE

elseif SUCCESS
transmit &quot;A^M&quot;
endif
endif

transmit RecType ;job type - column : RWK FLG
transmit &quot;^M&quot;

if not nullstr WoNum
transmit &quot;^M&quot; ; added AA
endif

transmit &quot;^M&quot;
if not nullstr WoNum
transmit &quot; ^M&quot; ;Labor Rate ;uncommented for testing
transmit &quot;^M&quot; ; added AA 2
endif

;REM -- Entry complete for first line write the rec id to the response file
if SUCCESS
status = &quot;Y&quot;
else
status = &quot;N&quot;
endif

iXPosn = iXPosn + 1

UpdateResp:
strcat outputline status ; for response file

;write to output file
strlen outputline len
fputs 2 outputline

ErrBadWO:
if strcmp iErrCode &quot;1000&quot;
; == commented the old code on 28aug02, replaced with the new lines below
;transmit &quot;^M&quot;
;waitfor &quot;^[[%d&quot; iXPosn;16H&quot;
;transmit &quot;\&quot;
; ==

transmit &quot;^M&quot;
waitfor &quot;^[[%d&quot; iXPosn;22H&quot; 3
transmit &quot;\&quot;
waitfor &quot;^[[%d&quot; iXPosn;16H&quot; 3
transmit &quot;\&quot;
;waitfor &quot;^[[%d&quot; iXPosn;5H&quot; 3
endif


endwhile

fileclose:
fclose 0 ; Close file opened for read.
fclose 2

exitmenu:
transmit &quot;^[&quot;
waitfor &quot;^[[KE-END JOB, C-CONTINUE: &quot;
transmit &quot;e^M&quot;
waitfor &quot;^[[KPRESS <CR> TO ACKNOWLEDGE: &quot; waittime
transmit &quot;^M&quot;
waitfor &quot;^[[7mSELECTION ('0' TO END):^[[0m^[[1m 0^[[24;29H&quot; waittime
transmit &quot;^M&quot;
waitfor &quot;^[[7mSELECTION ('0' TO END):^[[0m^[[1m 0^[[24;29H&quot; waittime
transmit &quot;^M&quot;
waitfor &quot;^[[7mSELECTION ('0' TO END):^[[0m^[[1m 0^[[24;29H&quot; waittime
transmit &quot;^M&quot;
waitfor &quot;^[[KExit Master Menu now (Y/N)? N^[[24;68H&quot; waittime
transmit &quot;Y^M&quot;

else
;errormsg &quot;Couldn't open file `&quot;%s`&quot;.&quot; Fname
endif

end:
pwexit
endproc
 
The first thing I would do is remove all the escape sequences (they start with ^[[) in the waitfor commands so that you are only waiting on actual visible text. The more text you have in a waitfor statement, the greater the chances are the exact string you are waiting for is not received correctly (line noise, etc.), which would throw off your script.

I don't see anything else that jumps out at me. Does the script run successfully, but it's just slow? I don't really see a way to speed the script up since you are just sending text in response to a prompt from the other system and I don't see any timing bottlenecks in the script.
aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top