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

Going back to file begining


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bhashyam
Currently Banned

New User


Joined: 13 Nov 2007
Posts: 12
Location: Bangalore

PostPosted: Mon Nov 26, 2007 7:35 pm
Reply with quote

Hi,
If i am reading a sequential file and assume that i am in middle of the file. If i want to go back to the first line, of the file. How can i do it?
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Mon Nov 26, 2007 7:46 pm
Reply with quote

Close and reopen the file.
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1104
Location: The Netherlands at Hole 19

PostPosted: Mon Nov 26, 2007 8:04 pm
Reply with quote

And if it's on tape you can read backwards icon_wink.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Nov 26, 2007 10:39 pm
Reply with quote

Hello,

What business process requires you "start over" at the beginning?
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Mon Nov 26, 2007 11:58 pm
Reply with quote

Hey Dick, I am assuming that file has multiple records types that bhashyam didn't realize he needed until he read past them?

That is why it is so important to understand the business process. icon_wink.gif
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Nov 27, 2007 2:38 am
Reply with quote

Beware multiple open/closes. It can turn a 10 min job into a 3 hr job.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Nov 27, 2007 3:00 am
Reply with quote

Yup, some of the very worst performance problems i've helped alleviate is where someone "started over" many, many times in a program.

Nearly always, there is a more effecient way to accomplish the same task.

d
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1104
Location: The Netherlands at Hole 19

PostPosted: Tue Nov 27, 2007 3:03 am
Reply with quote

Yep Dick, like sorting the file icon_wink.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Nov 27, 2007 3:45 am
Reply with quote

Or doing a 2-file merge instead of "searching" thru a file over and over. . . icon_smile.gif

d
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Tue Nov 27, 2007 3:58 am
Reply with quote

Or - how about a database - or - maybe a table? We can come up with a multitude of ideas that are based on years of experience, BUT, if we do not know the business NEED, how can we possibly give the best advice?
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1104
Location: The Netherlands at Hole 19

PostPosted: Tue Nov 27, 2007 3:36 pm
Reply with quote

In Austria one of my teammembers (hired) has written a balance line program and for each inputrecord closed, reopenened and read the masterfile until the identification met with the inputrecord. In test with some inputrecords it worked but with a large inputfile it ran for hours. We checked all of his other programs and found out he did this all the time. I sacked him, had the programs rewritten including a sort of the inputfile.

But we still don't know what the business case for TS is icon_cry.gif
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Tue Nov 27, 2007 5:18 pm
Reply with quote

Wow, George! Why would anyone do that? Where did he ever come up with that idea?
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1104
Location: The Netherlands at Hole 19

PostPosted: Tue Nov 27, 2007 5:32 pm
Reply with quote

Beats me.........not well trained and sold himself well to the HR-manager. going to play a round of golf now; cold outside but feel like a hero icon_wink.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Nov 27, 2007 10:31 pm
Reply with quote

Hello,

Quote:
Why would anyone do that? Where did he ever come up with that idea?
If one was to search around in the forum, many examples of people who do not know how (and don't want to do the work to learn how) to code a simple 2-file match/merge (what George refers to as a "balance line program").

It is one of the most common needs in batch programs and is not taught well (if taught at all) in most programming training. Most newbies make it much harder than it needs to be - it really is quite straightforward. There is a sample-code "sticky" near the top of the cobol forum.

As George mentioned, we still do not know what TS needs to accomplish.
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1104
Location: The Netherlands at Hole 19

PostPosted: Tue Nov 27, 2007 10:40 pm
Reply with quote

TS is in no hurry since he didn't respond after starting his topic. icon_rolleyes.gif

And there should also be an example of a balance line program I posted. Formerly developed by the teachers of Volmac (now Cap Gemini). They taught and explained it to me in 1970 and I can still dream it. Always works; first you understand the business case and then pick the right solution.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top