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
 
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: 757
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: 757
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: 4650
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 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