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
 

 

Rewind a sequential file in COBOL program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
kalais

New User


Joined: 18 Apr 2006
Posts: 22

PostPosted: Thu Aug 09, 2007 8:23 pm    Post subject: Rewind a sequential file in COBOL program
Reply with quote

Hi,

I need to search a sequential file repeatedly each time from the start of the file.
How I can achieve this without closing and opening the file each time.
Is there any options like Rewind for doing it?


Thanks,
Kalais
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 09, 2007 8:49 pm    Post subject:
Reply with quote

No rewind for dasd. you could considered tabling the sequential file, thus reducing the I/O.

But, why do you have to make repeated passes? A redesign solution may be provided if you can provide your requirements.
Back to top
View user's profile Send private message
jz1b0c

Active User


Joined: 25 Jan 2004
Posts: 160
Location: Toronto, Canada

PostPosted: Thu Aug 09, 2007 8:49 pm    Post subject:
Reply with quote

Sort the file on some key, (let there be duplicates- not an issue)

Now once you are at the end of the file, use START command to position it to the beginning of the file (use low-values in the key field).

I think you have to use access method dynamic for this.

Its been a long time, since I worked with files in cobol, I am not able to quote an example here, but I think this should work.
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Thu Aug 09, 2007 9:41 pm    Post subject:
Reply with quote

Full file searches are generally not a good thing if they are done repeatedly in program. The cpu performance and run time of your application is going to suffer greatly by doing this.
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: Thu Aug 09, 2007 11:09 pm    Post subject:
Reply with quote

Hello,

If you explain why you need to search the file repeatedly, we may be able to offer far better performing alternatives.
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Fri Aug 10, 2007 10:31 am    Post subject:
Reply with quote

See if you can use VSAM KSDS - this will avoid repeated scanning of the file.
Back to top
View user's profile Send private message
kalais

New User


Joined: 18 Apr 2006
Posts: 22

PostPosted: Fri Aug 10, 2007 3:03 pm    Post subject:
Reply with quote

Hi,

I used a table for storing the sequntial file and did the search. The program got considerable improvement in performance.

Maximum no of records for that file will be below 5000 I hope.

Problem definition is that,
There are two sequential files FILE1 and FILE2 .
There will be a field in FILE1 with missing value. I need to search FILE2
using one or more key values(these keys for search will differ based on a field in FILE1) from FILE1 to find out the missing value.

(e.x)
FILE1
------
1.ACMABANO <missing field> PAP1 R PRDW ACMABANO
2.APFL905 <missing field> PAP1 L

If the field in BOLD is R ,search keys will be PRDW and ACMABANO
or if it is L search key will be the first field APFL905.

FILE2
------
1.ACMABANO PVSAM.CICS.ACMABANO PRDW L
2. APFL905 PVSAM.CICS.APFL905 PRDC L

The BOLD fields in FILE2 are the results of serach.


If anybody has better idea please let me know.

Please let me know if more clarification is needed.

Thanks,
Kalai
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Full Time COBOL Software Development ... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:24 am
This topic is locked: you cannot edit posts or make replies. COBOL Software Development Lead at Fi... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:21 am
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


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