Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Read file in reverse from last to first in cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: Read file in reverse from last to first in cobol
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    Post subject:
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    Post subject:
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: 743
Location: Germany

PostPosted: Thu Nov 02, 2006 6:02 pm    Post subject:
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    Post subject:
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    Post subject:
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: 743
Location: Germany

PostPosted: Thu Nov 02, 2006 6:55 pm    Post subject:
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

Moderator Team Head


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

PostPosted: Fri Nov 03, 2006 2:24 am    Post subject: Re: Read file in reverse from last to first in cobol
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    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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us