MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » September 2012

RE: program to read pf in reverse order using cl/400 program



fixed

The POSITION(*RRN &rrn) in the OVRDBF is not necessary, in fact I'm not
certain that it will work in a CL pgm.
The OVRDBF is in the CL program initialisation, not inside the processing
loop. You may also need to do a RTVMBRD to identify the current number of
records.
The CPYF command uses a decreasing variable-value in FROMRCD, with a
constant value of 1 in NBRRCDS.
This should work quite successfully IF the system allows you to copy
record(s) into your open work-file - which I believe it should.
CPF0864 should not be set on the work-file as long as a CPYF precedes the
RCVF.
Once you have read the first record in the work-file it is opened, then the
work-file is processed sequentially, as usual.
The work-file will close when the program ends; if you need to force the
close, do a RCVF without a preceding CPYF.

I still think this is an awful way to Read-previous a PF, but the customer
is always right ... even when they wrong.

Regards

Jeff Bull
iSeries Technical Consultant
NYCO Ltd - iSeries & AS/400 Automation Specialists
Tel: +44(0)20 8416 3778
Fax: +44(0)20 8416 3779
Mobile: +44(0)77 5692 3335
Email: jeff.bull@xxxxxxxxxx
Website: www.nyco.co.uk
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Stone, Joel
Sent: 10 September 2012 20:06
To: 'Midrange Systems Technical Discussion'
Subject: RE: program to read pf in reverse order using cl/400 program

Oops - this probably wont work - I think that OVRDBF only works once with
RCVF. SQL should work to add a new field containing the RRN and then RCVF
on that new field descending.

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Stone, Joel
Sent: Monday, September 10, 2012 2:01 PM
To: 'Midrange Systems Technical Discussion'
Subject: RE: program to read pf in reverse order using cl/400 program

Rishi -

People rarely send the "exact code" on these tech forums. It makes it sound
like you are asking others to do your work (or homework) for you, and people
don't want to do that.

However, iseries developers do like to point people in the right direction.

That said, maybe you could try something like the following (although I have
no idea if this will work)

Rtvmbrd filename NBRCURRCD (&rrn)

topOfLoop:
Ovrdbf filename POSITION(*RRN &rrn)
rcvf
Chgvar &rrn (&rrn - 1)
If (&rrn > 0) goto TopOfLoop


This is the most direct method I can think of. Using a less direct
alternative, SQL or OPNQRYF would allow you to add a sequential # to each
record, then RCVF the view in descending order.



-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Rishi Seth
Sent: Monday, September 10, 2012 10:56 AM
To: midrange-l@xxxxxxxxxxxx
Subject: program to read pf in reverse order using cl/400 program

Hi,

I want to read a physical file in reverse order using cl program condition
is there should not be any logical file in this program.If somebody could
please send the exact code for this then it would really be helpful to
understand the logic.

Thanks
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/midrange-l.


________________________________________________________________________
This inbound email has been scanned for all viruses by the MessageLabs
SkyScan
service.
________________________________________________________________________

______________________________________________________________________
This outbound email has been scanned for all viruses by the MessageLabs
Skyscan service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________





Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact