REXX LOOP Slowness
REXX LOOP Slowness
(OP)
I'm sure I have something wrong. It works but it is really slow. I could key it in faster.
I would guess that the way the loop is setup is wrong. Any thoughts? - Thank you, Bryan
REXX SCRIPT:
CALL ZocSend "****^M"
CALL ZocDelay .5
CALL ZocSend "LD 49^M"
CALL ZocWait "REQ "
CALL ZocDelay .5
CALL ZocSend "chg^M"
CALL ZocWait "TYPE"
CALL ZocDelay .5
CALL ZocSend "idc^M"
CALL ZocWait "CUST"
CALL ZocDelay .5
CALL ZocSend "0^M"
CALL ZocWait "DCNO"
CALL ZocDelay .5
CALL ZocSend "1^M"
file = "C:\IDC\ld49.txt"
LOOP:
data=LINEIN(file)
Parse Var data v1 v2
IF v1 = "" THEN CALL finish
CALL ZocWait "IDGT"
CALL ZocDelay .5
CALL ZocSend v1
CALL ZocSend "^M"
CALL ZocDelay .5
CALL ZocSend v2
CALL ZocSend "^M"
CALL ZocDelay .5
Call LOOP
finish:
Call ZocSend "^M"
CALL ZocSend "****^M"
Exit
OUTPUT Of REXX SCRIPT:
>LD 49
DGT000
MEM AVAIL: (U/P): 44807023 USED U P: 5663954 1159100 TOT: 51630077
DISK SPACE NEEDED: 1665 KBYTES
REQ chg
TYPE idc
CUST 0
DCNO 1
IDGT 1234567
1234567 12345
IDGT 8912345
8912345 89123
IDGT 6789123
6789123 67891
IDGT 4567891
4567891 45678
IDGT 2345678
2345678 23456
IDGT 9123456
9123456 91234
IDGT
****
ld49.txt file:
1234567 12345
8912345 89123
6789123 67891
4567891 45678
2345678 23456
9123456 91234
RE: REXX LOOP Slowness
Okay, I removed the CALL ZocDelay .5 from almost all of it and now it is supper fast. I'll just have to figure out how to slow it down a little. - Thx.
CALL ZocSend "****^M"
CALL ZocDelay .5
CALL ZocSend "LD 49^M"
CALL ZocWait "REQ "
CALL ZocSend "chg^M"
CALL ZocWait "TYPE"
CALL ZocSend "idc^M"
CALL ZocWait "CUST"
CALL ZocSend "0^M"
CALL ZocWait "DCNO"
CALL ZocSend "1^M"
file = "C:\IDC\ld49.txt"
LOOP:
data=LINEIN(file)
Parse Var data v1 v2
IF v1 = "" THEN CALL finish
CALL ZocWait "IDGT"
CALL ZocSend v1
CALL ZocSend "^M"
CALL ZocDelay .5
CALL ZocSend v2
CALL ZocSend "^M"
Call LOOP
finish:
Call ZocSend "^M"
CALL ZocSend "****^M"
Exit
RE: REXX LOOP Slowness
CALL is for calling routines. If you want jump to label use SIGNAL.
But IMHO, how you try to read a file with jumping to the labels is ugly or gently said very obsolete.
Look at this example. It demonstrates how to read a text file line-by-line at 2 ways:
- using jumping to the labels as you do
- using only one while loop
IMHO, the second way is more better.hardybacon.rexx
CODE
Output:
CODE
RE: REXX LOOP Slowness
On the other way SIGNAL was thought for using to signalling when error occurs.
I don't know why they didn't include normal GOTO statement too - maybe because REXX should look as modern language without GOTO.
RE: REXX LOOP Slowness
I have here ooRexx installed and it has the SYSSLEEP() function.
You can call it as a procedure, e.g.
or as a function
Regina REXX should have function, which is similar to use.
I don't know which REXX is embedded with your application - try and you will see.
RE: REXX LOOP Slowness