Page 1 of 1

Repositioning record in display file

Posted: Fri Jun 08, 2012 7:58 am
by ltietz
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?

Posted: Fri Jun 08, 2012 11:14 am
by gtisdale
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

[BR_forum] Repositioning record in display file

Posted: Fri Jun 08, 2012 11:50 am
by crosstechsystems
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

Posted: Fri Jun 08, 2012 11:55 am
by GomezL
We often read a display file into an array, and the use the array for "Random Access".

We also sometime "Cache the Data" so that we have the "Last Few Records" stored in memory.