Repositioning record in display file

General development discussion.

Moderators: Susan Smith, admin, Gabriel

Post Reply
ltietz
Posts: 4
Joined: Tue Feb 21, 2012 2:04 pm

Repositioning record in display file

Post 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?
gtisdale
Posts: 218
Joined: Sun Jun 07, 2009 7:54 am
Location: Concord, Massachusetts
Contact:

Post 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
crosstechsystems
Posts: 4
Joined: Tue Jun 09, 2009 11:24 am

[BR_forum] Repositioning record in display file

Post 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
GomezL
Posts: 258
Joined: Wed Apr 29, 2009 5:51 am
Contact:

Post 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.
Post Reply