how to get next line of a particular line while reading a text file?

rajendran

Member
i am reading a text file line by line with unformatted.
i am able to get the particular line which contains some string "comply" in the line.i need to get next line followed by particular string "comply".
def var vrow as char no-undo.
def var v-comply as char format "x(15)" no-undo.
input from text.txt.
repeat:
import unformatted vrow.
if entry(1,vrow," " ) = "Comply" then
v-comply = vrow.
end.
but i need to get the line followed by "COMPLY" in the text file.

Please help to rectify this.
 

jramos

New Member
i am reading a text file line by line with unformatted.
i am able to get the particular line which contains some string "comply" in the line.i need to get next line followed by particular string "comply".
def var vrow as char no-undo.
def var v-comply as char format "x(15)" no-undo.
input from text.txt.
repeat:
import unformatted vrow.
if entry(1,vrow," " ) = "Comply" then
v-comply = vrow.
end.
but i need to get the line followed by "COMPLY" in the text file.

Please help to rectify this.

Try this:

def var vrow as char no-undo.
def var v-comply as char format "x(15)" no-undo.
def var cumple as logical no-undo initial false.
input from text.txt.
repeat:
import unformatted vrow.
if cumple then do:
v-comply = vrow.
cumple = false.
end.
if entry(1,vrow," " ) = "Comply" then
cumple = true.
end.
 

tanveer_jkt

New Member
I hope, below solution you are looking !!!

def var vrow as char no-undo.
def var next-line as char format "x(15)" no-undo.
def var v-comply as char format "x(15)" no-undo.

input from text.txt.

repeat:
import unformatted vrow.
if entry(1,vrow," " ) = "Comply" then
do:
v-comply = vrow.
import unformatted vrow. /* when import statement is executed ... it moves pointer to next line and read it */
next-line = vrow.
end.
end.
 
Top