Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Reding the last but previous line of a PS file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
ravindran1185

New User


Joined: 03 Nov 2008
Posts: 7
Location: Chennai

PostPosted: Tue Jun 16, 2009 1:12 pm    Post subject: Reding the last but previous line of a PS file
Reply with quote

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
View user's profile Send private message

salltm

New User


Joined: 21 Aug 2008
Posts: 8
Location: china

PostPosted: Tue Jun 16, 2009 1:16 pm    Post subject:
Reply with quote

it is difficult .. i suggest you create a index of the file..use the key way to read the file...
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Jun 16, 2009 2:00 pm    Post subject:
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jun 16, 2009 2:04 pm    Post subject:
Reply with quote

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
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4650
Location: Raleigh, NC, USA

PostPosted: Tue Jun 16, 2009 3:25 pm    Post subject: Re: Reding the last but previous line of a PS file
Reply with quote

ravindran1185 wrote:
2) reading the PS file backwards...


I hope you know that's not possible.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Tue Jun 16, 2009 3:57 pm    Post subject:
Reply with quote

Hi.

I know fileaid allows you to read the file backwards.


Gerry
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jun 17, 2009 7:20 am    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 8 Fri Sep 22, 2017 11:35 pm
No new posts it is possible output a SET value fro... Martylin JCL & VSAM 5 Fri Sep 22, 2017 7:08 am
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us