Unexpected Value

longhair

Member
morning all,
hopefully, one of the gurus can point me in the correct direction. i'm writing what i thought would be a simple script - read in from a print file and based upon information on a line output to one of 2 different files. the issue is that i never see the var 'y' increment - but impdata[y] always has the correct import. code is below - any sugggestions?

def var y as int.
def var z as int.
def stream ukout.
def stream grout.
def stream in-data.

input stream in-data from /caras/dsltdout1.txt.
output stream grout to /caras/dsltdgr.txt.
output stream ukout to /caras/dsltduk.txt.

x = 80.
y = 0.
repeat:
cont = no.
w = 0.
if x = 80 then do:
y = y + 1.
import stream in-data unformatted impdata[y].
x = length(impdata[y]).
display impdata[y] x y with width 120. /*here y is always = to 1 but impdata[y] shows each different imported line*/
if y = 1 then do:
impdata1 = trim(impdata[1]).
if length(impdata1) = 0 then cont = yes.
end.
end.
else do:
if cont = no then do:
do z = 1 to 20:
if impdata[z] matches("*" + "GERMANY" + "*")
or impdata[z] matches("*" + "Germany" + "*") then w = 1.
end.
end.
end.
/*if w = 1 then do:
do z = 1 to y:
display stream grout impdata[z] with width 100 no-box stream-io
no-attr-space.
end.
x = 80.
end.
if w = 0 then do:
do z = 1 to y:
display stream ukout impdata[z] with width 100 no-box stream-io
no-attr-space.
end.
x = 80.
end.*/
y = 0.
end.
output stream grout close.
output stream ukout close.

thanks in advance.
regards,
longhair
 

longhair

Member
morning all,

never mind - found the answer - operator error as usual;)
changed the "if x = 80 then do:" to "repeat while x = 80:"
 
Top