I have opened a file for display and use linput to read a record at a time.
After reading three records, can i reposition the record location to go back three records and start again?
Repositioning record in display file
Moderators: Susan Smith, admin, Gabriel
Not with LINPUT and a DISPLAY file.
Becasue every line is a different length it is not easy to reposition backwards.
However, you could write a function that would do this if you kept track of how many lines you have read since starting to read the file. Let assume that the current line is XL and you want to go back three lines.
DEF FNBACKUP(fileno,lineno)
restore #fileno:
let rl=0
for a=1 to lineo
linput #fileno:a$
rl+=1
next a
let fnbackup=rl
fnend
you would then just say
let rl=fnbackup(displayfile,rl-3)
linput a$
I have not tried this and you may need to adjust the A loop, but it should accomplish what you want.
FNGeorge
Becasue every line is a different length it is not easy to reposition backwards.
However, you could write a function that would do this if you kept track of how many lines you have read since starting to read the file. Let assume that the current line is XL and you want to go back three lines.
DEF FNBACKUP(fileno,lineno)
restore #fileno:
let rl=0
for a=1 to lineo
linput #fileno:a$
rl+=1
next a
let fnbackup=rl
fnend
you would then just say
let rl=fnbackup(displayfile,rl-3)
linput a$
I have not tried this and you may need to adjust the A loop, but it should accomplish what you want.
FNGeorge
-
- Posts: 4
- Joined: Tue Jun 09, 2009 11:24 am
[BR_forum] Repositioning record in display file
One can store the lines read in an array.
Eddie Singer
Sent via BlackBerry by AT&T
-----Original Message-----
From: "gtisdale" <brforumlist@ads.net>
Sender: br_forum-bounces@ads.net
Date: Fri, 08 Jun 2012 11:14:16
To: <br_forum@ads.net>
Reply-To: Business Rules Forum <br_forum@ads.net>
Subject: Re: [BR_forum] Repositioning record in display file
_______________________________________________
BR_forum mailing list
BR_forum@ads.net
http://box475.bluehost.com/mailman/list ... um_ads.net
_______________________________________________
BR_forum mailing list
BR_forum@ads.net
http://box475.bluehost.com/mailman/list ... um_ads.net
Eddie Singer
Sent via BlackBerry by AT&T
-----Original Message-----
From: "gtisdale" <brforumlist@ads.net>
Sender: br_forum-bounces@ads.net
Date: Fri, 08 Jun 2012 11:14:16
To: <br_forum@ads.net>
Reply-To: Business Rules Forum <br_forum@ads.net>
Subject: Re: [BR_forum] Repositioning record in display file
_______________________________________________
BR_forum mailing list
BR_forum@ads.net
http://box475.bluehost.com/mailman/list ... um_ads.net
_______________________________________________
BR_forum mailing list
BR_forum@ads.net
http://box475.bluehost.com/mailman/list ... um_ads.net