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!

Read from text file

Status
Not open for further replies.

jamie2

Programmer
Jul 26, 2005
1,127
US
I am trying to read from a delimited text file in ZOC. The file example that I am trying to read is:

EXAMPLE.TXT
;2000;Tom,Williams
;2001;Gary,Johnson
;2002;Marty,Wilson

dn= ie...2000 2001 2002
name= ie...Tom,Williams Gary,Johnson Marty,Wilson

CALL ZocSend dn ie...2000
CALL ZocSend name ie...Tom,Williams

CALL ZocSend dn ie...2001
CALL ZocSend name ie...Garu, Johnson

It needs to read from the file and loop until all the DN and NAMES are entered.

Is that possible with REXX?
 
It's certainly possible, but I'm having difficulty understanding the 'spec'. You seem to have a file containing dates and names and you want to exercise "ZocSend" against each individual element; is that true?

What platform is this on?


Frank Clarke
Support the Troops:
-- Bring them home.
 
Actually, they are 4-digit telephone extensions and names. And I want to update the names via a Nortel 81C PBX phone system.

I have redone my EXAMPLE.TXT that I want to read from as:
2000 Tom,Williams
2001 Gary,Johnson
2002 Marty,Wilson

I have been trying PARSE VAR with LINEIN with some success, but I am unable to create a loop move down the EXAMPLE.TXT file and stop when the last name it sent.
 
I think I got what I need by doing the following.

file = "c:\info.txt"

do while( lines(file) )

data=LINEIN(file)
Parse Var data v1 v2

SAY v1
CALL ZocDelay 2
sAY v2

end

I am not at work, so I will implement this into the rest of my script to ensure it works.
 
The underlying OS is Psuedo Unix blend. Its the emulation software that really handles the scripting. Most techs either use Reflection VB scripts, Aspect (Procromm) scripts, or Rexx (Zoc) scripts.

I am pretty good with the Aspect scripting for procomm, but I have to use dialup to run them. If I use my emulation software ZOC, then I am able to connect over the lan using the Rlogin protocol.
 
This is the script I tried this morning and it worked great! See anything that should be coded better?


file = "c:\info.txt"

do while( lines(file) )

data=LINEIN(file)
Parse Var data v1 v2

CALL ZocSend "CHG^M"
CALL ZocWait "TYPE "
CALL ZocSend "name^M"
CALL ZocWait "CUST "
CALL ZocSend "0^M"
CALL ZocWait "DIG "
CALL ZocSend "^M"
CALL ZocWait "DN "
CALL ZocSend v1
CALL ZocSend "^M"
CALL ZocWait " NAME "
CALL ZocSend v2
CALL ZocSend "^M"
CALL ZocWait " DISPLAY_FMT "
CALL ZocSend "^M"
CALL ZocWait "DN "
CALL ZocSend "^M"
CALL ZocWait "DCNO "
CALL ZocSend "^M"
CALL ZocWait "REQ"

END
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top