Solved

RPGLE.  how to set the file pointer back to the top on a physical file

Posted on 2004-10-14
9
1,795 Views
Last Modified: 2008-02-01
i'm looping through a physical file with a read operation.  after reading through the physical file once, i would like to set the file pointer back to the top and read through the file again.  How can I do this without closing and opening the file again?  the physical file has no keys.
0
Comment
Question by:roosterup
  • 2
  • 2
  • 2
  • +2
9 Comments
 
LVL 14

Expert Comment

by:daveslater
ID: 12310534
Hi
you can decalre a numeric field 10,0. Set it to 1 then chain in as you would with a keyed file

This will reposition a record 1

Dave
0
 
LVL 1

Author Comment

by:roosterup
ID: 12310556
I just want to reset the file pointer as if the file had just been opened.
0
 
LVL 14

Expert Comment

by:daveslater
ID: 12310645
Hi
That is the only way I know. I would wait and see if anyone else has some other ideas.

Dave
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:roosterup
ID: 12310660
i know closing and reopening the file would work, but i don't want to do that.
0
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 12317043
Hi Roosterup,

Did you tried a SETLL ???

For indexed files :
     *LOVAL     SETLL      MyFile

For non indexed files:
      0       SETLL     MyFile

Never tested this, but the compiler thinks it's OK, so give it a try

Regards,
Murph
0
 
LVL 27

Expert Comment

by:tliotta
ID: 12322268
roosterup:

With no keys, you're reading in Arrival sequence. The SETLL with *LOVAL as factor 1 should give you what you want.

Tom
0
 
LVL 1

Expert Comment

by:Helixir
ID: 12337784
Try something like

*START      SETLL       MyFile

I'm not sure if works !!
0
 
LVL 1

Accepted Solution

by:
Helixir earned 50 total points
ID: 12346617
I did some test yesterday and *START on a physical file works !!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
V7R2 Virtual Tape to an iASP 1 76
adodb sql multi tables 1 1,153
iSeries DB2 query across local and remote site 4 92
RUNRMTCMD from AS/400 12 69
This article describes how to reset your Windows 10 password when you've forgotten it.
There's a lot of hype surrounding blockchain technology. Here's how it works and some of the novel ways it' s now being used - including for data protection.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question