INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

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

(OP)

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

Hi hardybacon,
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:
  1. using jumping to the labels as you do
  2. using only one while loop
IMHO, the second way is more better.

hardybacon.rexx

CODE

file = "ld49.txt"

-- Reading file: Example 1  
say 'Reading file: Example 1' 
say 'Begin'
LOOP:
  data=LINEIN(file)
  Parse Var data v1 v2
  -- if empty line jump to label FINISH
  if v1 = "" then signal FINISH
  say data
  say v1 ', ' v2
  -- jump to label LOOP
  signal LOOP
FINISH: 
  say 'Done.'

say '-----------------------'
say
-- close file
call lineout file

-- Reading file: Example 2
say 'Reading file: Example 2'
say 'Begin'
do while lines(file) \= 0
  data=LINEIN(file)
  Parse Var data v1 v2
  say data
  say v1 ', ' v2
end
say 'Done.'

exit 

Output:

CODE

$ rexx hardybacon.rexx
Reading file: Example 1
Begin
1234567 12345
1234567 ,  12345
8912345 89123
8912345 ,  89123
6789123 67891
6789123 ,  67891
4567891 45678
4567891 ,  45678
2345678 23456
2345678 ,  23456
9123456 91234 
9123456 ,  91234 
Done.
-----------------------

Reading file: Example 2
Begin
1234567 12345
1234567 ,  12345
8912345 89123
8912345 ,  89123
6789123 67891
6789123 ,  67891
4567891 45678
4567891 ,  45678
2345678 23456
2345678 ,  23456
9123456 91234 
9123456 ,  91234 
Done. 

RE: REXX LOOP Slowness

OK, CALL works too, but for me it's irritating, because I'm using it only to routines.
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

Quote:


I'll just have to figure out how to slow it down a little.

I have here ooRexx installed and it has the SYSSLEEP() function.
You can call it as a procedure, e.g.
  call syssleep 10 
or as a function
  syssleep(10) 
Regina REXX should have
  SLEEP() 
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

(OP)
Thank you mikrom. I will try to make some changes to it. The file is used to load Direct Dial numbers to extension conversions in a Legacy Nortel PBX.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close