× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



"Also I think I can not use CLF also, as this is external licensed
tool.I do not think we buy it."

You may have mis-read my earlier post on this topic. There is nothing
to "buy" for the CL function you describe. If you install the free runtime
option of Control Language for Files (CLF) then the following CL program
(named CLFRRN_RNT for CLF access by relative record number using runtime
support) will do what you describe needing:

Pgm
Dcl Var(&Record) Type(*Char) Len(100)
OpnFCLF FileID(Z5PFILEP) LvlChk(*No)
ReadRcdCLF FileID(Z5PFILEP) Type(*Last) RcdBuf(&Record)
SndPgmMsg Msg('Record ID: ' *Cat %sst(&Record 1 3))
SndPgmMsg Msg('Number records: ' *Cat %sst(&Record 4 6))
CloFCLF Z5PFILEP
EndPgm

In the above code I'm assuming the record length of file V5PFILEP is 100
bytes in length and that your trailer information (TLR012536) is in the
first nine bytes of the last record. So:

The declare of variable &Record is to hold a record image.
The open of Z5PFILEP is done with level check *NO (the default is *Yes and
with a program described open, as the sample is using, you need to specify
*No). The open is defaulting to record access by relative record number.
The read specifies to read the *Last record (by RRN due to the previous
open) of Z5PFILEP, returning the record contents to CL variable &Record.
The first send program messages displays the value TLR (the first three
bytes read from the last record).
The second send program message displays the value 012536 (bytes 4 through 9
from the last record).
The close of file Z5PFILEP is done for completeness.
The program ends.

Compiling this sample program with CRTBNDCL (or CRTCLPGM as OPM is supported
too) CLFRRN_RNT and then calling the program with CALL CLRRRN_RNT from the
command entry display will result in this display:

call clfrrn_rnt
Record ID: TLR
Number records: 012536

No need to retrieve the current number of records, no need for positioning
overrides, no need to read all of the previous records, no need to write and
call another program written in RPG or COBOL or C, no need for a logical
file, no need to introduce SQL, etc. -- simply just do it from CL! That's
why I wrote CLF in the first place -- to avoid the hassles of database
access from CL based applications.

To download CLF and the associated manuals (including the Install manual) go
to http://www.powercl.com/home/clf/clfdownloads

As the above is "free" use of CLF (the runtime was specifically designed as
being no charge to make it easy to distribute applications from a central
site) I haven't identified this as a vendor response. If David disagrees
with this approach then I will take a different approach in future postings
involving code and CLF. But the above approach (using the base support) is
essentially freeware packaged as a no-charge option of a licensed program.
CLF has been tested on V5R4, V6R1, and 7.1 and does require that your system
be on V5R4 or later.

Bruce Vining

On Wed, May 26, 2010 at 11:28 PM, Gangasani, Bhargava <
Bhargava.Gangasani@xxxxxxxxxxxxxx> wrote:


As of now in production it is reading through the file and running for long
time just to pick up the LAST RECORD in the file (trailer).

As I need to validate trailer I want to read the last record in CLP program
, as this is existing program and I do not want to go for new program
(RPGLE).

Also I think I can not use CLF also, as this is external licensed tool.I do
not think we buy it.

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:
midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Albert York
Sent: Thursday, May 27, 2010 5:00 AM
To: Midrange Systems Technical Discussion
Subject: Re: READ PREVOIUS in CLP

If you need to do it in C/L simply read through the file and move the
record to a variable. When you are done the variable will contina the
last record.

Albert

On Wed, May 26, 2010 at 3:46 PM, Bruce Vining <bvining@xxxxxxxxxxxxxxx>
wrote:
Vendor response.

Though the Control Language for Files (CLF) web site is experiencing some
problems right now, the Read Record using CLF (ReadRcdCLF) command
directly
supports reading the *LAST record of a file (in addition to *PRV, *NXT,
*KEY, *RRN, etc). This can be done using the no-charge CLF run-time
option
though productivity will be higher using the fee-based CLF precompiler.

Using CLF there is no need to write another program using a language such
as
RPG or COBOL in order to do file operations.

Bruce Vining




On Wed, May 26, 2010 at 9:47 AM, DeLong, Eric <EDeLong@xxxxxxxxxxxxxxx
wrote:

That sounds like a REALLY BAD IDEA.... Sorry, but I think this would be
guaranteed to screw up if there are any deleted records in the file...

Why try to force this into CL, when that language is unable to support
your requirements?

Jmo,
-Eric

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Pat Barber
Sent: Wednesday, May 26, 2010 9:00 AM
To: Midrange Systems Technical Discussion
Subject: Re: READ PREVOIUS in CLP

It would take some screwing around but, by finding out the
record count of the file with a rtvobjd , you could position by record
count-1
and then do a ovrdbf with that record number.

Would be a tad messy but can be done.

Gangasani, Bhargava wrote:
Hi,

Using CLP I can read a specific RRN/ Key record using below code.
DCLF Z5PFILEP
OVRDBF FILE(Z5PFILEP) TOFILE(Z5PFILEP) +
POSITION(*RRN 4) SHARE(*NO)
RCVF

Question is: I can place my pointer at *END of file as
OVRDBF FILE(Z5PFILEP) TOFILE(Z5PFILEP) +
POSITION(*END) SHARE(*NO)
But How I can read the previous record. That is the Last record of the
file.



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




--
Regards,
Bruce
www.brucevining.com
www.powercl.com
--
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 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.

2009 Winner: Broadridge receives “Top Overall Honors" for 2 consecutive
years in the Black Book of Outsourcing Brokerage Process Service Provider
Survey. Learn more at http://www.broadridge.com/ranked1/



“THANK GOD IT’S MONDAY!” Sounds interesting? Know more @
www.broadridge.com.


This message and any attachments are intended only for the use of the
addressee and
may contain information that is privileged and confidential. If the reader
of the
message is not the intended recipient or an authorized representative of
the
intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this
communication in
error, please notify us immediately by e-mail and delete the message and
any
attachments from your system.

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





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.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 on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.