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: 8620
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 ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm
No new posts unable to set RC = 4 when empty file migusd SYNCSORT 1 Tue Nov 21, 2017 1:21 am

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