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 "^[[KENTER <CR> TO CONTINUE OR 'M' TO SEE MORE OPERATIONS: " 3
if SUCCESS
transmit "^M"
goto readnext
elseif FAILURE
;transmit "^M" ;added on 28aug02
endif
waitfor "^[[KPRESS <CR> TO ACKNOWLEDGE: " 3 ; was 1 then 3
if SUCCESS
iErrCode = "1000"
status = "N"
goto UpdateResp
elseif FAILURE
endif
endif
readnext:
transmit OperNum ;oper num
transmit "^M"
;===added this exception - 28aug02
if not nullstr WoNum
waitfor "^[[KPRESS <CR> TO ACKNOWLEDGE: " 3
if SUCCESS
iErrCode = "1000"
status = "N"
goto UpdateResp
endif
endif
if nullstr WoNum
transmit "1^M" ;dept #
endif
if not nullstr WoNum
transmit QtyAccept ;qty
transmit "^M"
endif
transmit " ^M" ;start time
transmit " ^M" ;end time
transmit AdjTime ;elapsed time
transmit "^M"
if nullstr WoNum
else
transmit "^M"
waitfor "^[[KA'CCEPT OR R'EJECT: " 3 ; was 1 , then 5
if FAILURE
elseif SUCCESS
transmit "A^M"
endif
endif
transmit RecType ;job type - column : RWK FLG
transmit "^M"
if not nullstr WoNum
transmit "^M" ; added AA
endif
transmit "^M"
if not nullstr WoNum
transmit " ^M" ;Labor Rate ;uncommented for testing
transmit "^M" ; added AA 2
endif
;REM -- Entry complete for first line write the rec id to the response file
if SUCCESS
status = "Y"
else
status = "N"
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 "1000"
; == commented the old code on 28aug02, replaced with the new lines below
;transmit "^M"
;waitfor "^[[%d" iXPosn;16H"
;transmit "\"
; ==
transmit "^M"
waitfor "^[[%d" iXPosn;22H" 3
transmit "\"
waitfor "^[[%d" iXPosn;16H" 3
transmit "\"
;waitfor "^[[%d" iXPosn;5H" 3
endif
endwhile
fileclose:
fclose 0 ; Close file opened for read.
fclose 2
exitmenu:
transmit "^["
waitfor "^[[KE-END JOB, C-CONTINUE: "
transmit "e^M"
waitfor "^[[KPRESS <CR> TO ACKNOWLEDGE: " waittime
transmit "^M"
waitfor "^[[7mSELECTION ('0' TO END):^[[0m^[[1m 0^[[24;29H" waittime
transmit "^M"
waitfor "^[[7mSELECTION ('0' TO END):^[[0m^[[1m 0^[[24;29H" waittime
transmit "^M"
waitfor "^[[7mSELECTION ('0' TO END):^[[0m^[[1m 0^[[24;29H" waittime
transmit "^M"
waitfor "^[[KExit Master Menu now (Y/N)? N^[[24;68H" waittime
transmit "Y^M"
else
;errormsg "Couldn't open file `"%s`"." Fname
endif
end:
pwexit
endproc
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 "^[[KENTER <CR> TO CONTINUE OR 'M' TO SEE MORE OPERATIONS: " 3
if SUCCESS
transmit "^M"
goto readnext
elseif FAILURE
;transmit "^M" ;added on 28aug02
endif
waitfor "^[[KPRESS <CR> TO ACKNOWLEDGE: " 3 ; was 1 then 3
if SUCCESS
iErrCode = "1000"
status = "N"
goto UpdateResp
elseif FAILURE
endif
endif
readnext:
transmit OperNum ;oper num
transmit "^M"
;===added this exception - 28aug02
if not nullstr WoNum
waitfor "^[[KPRESS <CR> TO ACKNOWLEDGE: " 3
if SUCCESS
iErrCode = "1000"
status = "N"
goto UpdateResp
endif
endif
if nullstr WoNum
transmit "1^M" ;dept #
endif
if not nullstr WoNum
transmit QtyAccept ;qty
transmit "^M"
endif
transmit " ^M" ;start time
transmit " ^M" ;end time
transmit AdjTime ;elapsed time
transmit "^M"
if nullstr WoNum
else
transmit "^M"
waitfor "^[[KA'CCEPT OR R'EJECT: " 3 ; was 1 , then 5
if FAILURE
elseif SUCCESS
transmit "A^M"
endif
endif
transmit RecType ;job type - column : RWK FLG
transmit "^M"
if not nullstr WoNum
transmit "^M" ; added AA
endif
transmit "^M"
if not nullstr WoNum
transmit " ^M" ;Labor Rate ;uncommented for testing
transmit "^M" ; added AA 2
endif
;REM -- Entry complete for first line write the rec id to the response file
if SUCCESS
status = "Y"
else
status = "N"
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 "1000"
; == commented the old code on 28aug02, replaced with the new lines below
;transmit "^M"
;waitfor "^[[%d" iXPosn;16H"
;transmit "\"
; ==
transmit "^M"
waitfor "^[[%d" iXPosn;22H" 3
transmit "\"
waitfor "^[[%d" iXPosn;16H" 3
transmit "\"
;waitfor "^[[%d" iXPosn;5H" 3
endif
endwhile
fileclose:
fclose 0 ; Close file opened for read.
fclose 2
exitmenu:
transmit "^["
waitfor "^[[KE-END JOB, C-CONTINUE: "
transmit "e^M"
waitfor "^[[KPRESS <CR> TO ACKNOWLEDGE: " waittime
transmit "^M"
waitfor "^[[7mSELECTION ('0' TO END):^[[0m^[[1m 0^[[24;29H" waittime
transmit "^M"
waitfor "^[[7mSELECTION ('0' TO END):^[[0m^[[1m 0^[[24;29H" waittime
transmit "^M"
waitfor "^[[7mSELECTION ('0' TO END):^[[0m^[[1m 0^[[24;29H" waittime
transmit "^M"
waitfor "^[[KExit Master Menu now (Y/N)? N^[[24;68H" waittime
transmit "Y^M"
else
;errormsg "Couldn't open file `"%s`"." Fname
endif
end:
pwexit
endproc