IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Read file in reverse from last to first in cobol


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
swapna_b

New User


Joined: 08 Aug 2005
Posts: 1
Location: HYD

PostPosted: Thu Nov 02, 2006 4:57 pm
Reply with quote

I need to read a file in reverse order i.e from last to first in cobol but not using jcl, sort or any other files.
Back to top
View user's profile Send private message
shreevamsi

Active User


Joined: 23 Feb 2006
Posts: 305
Location: Hyderabad,India

PostPosted: Thu Nov 02, 2006 5:46 pm
Reply with quote

As of my knowledge COBOL don't support.....reading of file from botom to top.

Only thing is sort and then read....
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Thu Nov 02, 2006 6:00 pm
Reply with quote

hi

i think u can do it using READ PRIOR statement...

it can be used for VSAM files. not sure whether it can be used for PS files.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Thu Nov 02, 2006 6:02 pm
Reply with quote

Hi !

Native cobol ? No way !!!

Regards, UmeySan
Back to top
View user's profile Send private message
viv
Currently Banned

New User


Joined: 31 Oct 2006
Posts: 4

PostPosted: Thu Nov 02, 2006 6:28 pm
Reply with quote

read the file from the front and put the first record in variable(1) and then in variable(2)......variable(n).. Then try printing the reocrd from variable(n) to variable(1).
Back to top
View user's profile Send private message
viv
Currently Banned

New User


Joined: 31 Oct 2006
Posts: 4

PostPosted: Thu Nov 02, 2006 6:51 pm
Reply with quote

the above works only if the no of records are of some finite size...
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Thu Nov 02, 2006 6:55 pm
Reply with quote

@ viv !

That's quiet a nice idea, if your file has 20 records.
Think of a file with one Million records and then have a look at
your needed storage.

Solutions habe to be practical & workable

Regards, UmeySan
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Fri Nov 03, 2006 2:24 am
Reply with quote

Argh! I'm getting tired of seeing this same question every week, when it has been posted over and over again that this is NOT an option in any of the standard MVS mainframe COBOL products, unless the data resides on tape (and that option is now becoming obsolete).
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
Search our Forums:

Back to Top