View previous topic :: View next topic
|
Author |
Message |
ravindran1185
New User
Joined: 03 Nov 2008 Posts: 7 Location: Chennai
|
|
|
|
Hi,
The scenario is to read the last but previous line of a PS file all the times.
i have explained two logics 1) the Count-1 logic, But the file may contain millions of record. 2) reading the PS file backwards, but No key will be specified for that file.
If anybody knows the optimized logic, please post here.
Thanks in advance. |
|
Back to top |
|
|
salltm
New User
Joined: 21 Aug 2008 Posts: 8 Location: china
|
|
|
|
it is difficult .. i suggest you create a index of the file..use the key way to read the file... |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Code: |
//STEP0100 EXEC PGM=ICETOOL
//SYSOUT DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD dsn=your input file
//OUT DD dsn=your output file
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) KEEP INPUT LAST(2)
/*
|
Now I will read first record of output file (which is actually second last record of input file) |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
salltm wrote: |
it is difficult .. i suggest you create a index of the file..use the key way to read the file... |
How would you create an index for a PS file ? |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
ravindran1185 wrote: |
2) reading the PS file backwards... |
I hope you know that's not possible. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi.
I know fileaid allows you to read the file backwards.
Gerry |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Why are the last 2 records needed?
If the file is huge (hundreds of millions of records or whatever) suggest that when the file is created, the process could create another little file that contains only the last 2 records. . . Or these 2 entries might be put in some database table . . . Or. . . |
|
Back to top |
|
|
|