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

Program to matches/merges two sequential files


IBM Mainframe Forums -> COBOL Programming
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Jul 10, 2007 9:12 pm
Reply with quote

Hello,

Attached to this "sticky" is a small sample program that matches/merges 2 sequential files that have been previously put "in sequence".

Depending on your exact requirement, changes may need to be made, but the overall process works for most cases. If your files have a 1-to-1 or a 1-to-many relationship, the model should work for you. One case where additional code may be needed is when both files might have duplicate key values. The issue may be how to determine how the duplicates should "sync up".

Something to keep in mind is that to keep things more manageable you do not want to code compares for multiple keys. As you read records (before any comparing) combine the "key" fields into a ws field (one for each file) so the compare does not become other than simple.

If you find a typo or a "real" error, please let me know via PM. If you prefer a different way, fine, but this is an approach that works many, many places.

I cannot emphasize enough that it is critical that you thoroughly test your version of the code before production implementation.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Jul 18, 2008 9:04 pm
Reply with quote

Hello,

Quote:
Think this sample program will be usefull to less experienced programmers.
Yes, this was to provide compilable/executable pseudo-code for learning - many training centers do not appear to teach/require the students understand this very basic process that is in every application i've ever seen.

Quote:
But it does not meet most companys standards. Usage of "GO TO", for instance, instruction is not accepted in many companys.
Most companies (at least those that are well managed) have backed off of the "no go to" rule. It has been demonstrated many, many times that properly used, there is nothing wrong with a go to.

Most places that have standards concerning the use of "go to" permit this in these situations:

1. To go to the end of a routine (i.e. AT END).
2. To go to the top of a routine.
3. To go to an abend procedure.

One of the reasons for "go to less" programming was so code would be "structured". Unfortunately, no "go to"s does not guarantee well structured code. Another issue we discovered/documented "back then" was that whe programs always ran inside some PERFORMs, system paging was greatly increased.

As far as code is concerned (i've supported very many organizations whose standards greatly differ), i believe code should always work correctly, be maintainable, and not use an excessive amount of system resources. These goals can be accomplished with or without permission/prevention of "go to".
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Sat Jul 30, 2011 5:44 pm
Reply with quote

if you have never posted You cannot download anything
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Mon Aug 26, 2019 6:30 pm
Reply with quote

From all these replies, it looks like if the New user who has 0 posts don't see an option to Download until they make their first post on this forum and that is the reason why we see so many replies with same question rolling over many pages...

Admin, You might need to see if the same problem still persists and can be fixed to avoid this happening in future.

For sure the clean up is needed.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Tue Aug 27, 2019 12:37 am
Reply with quote

Cleaned and locked.
Back to top
View user's profile Send private message
rvcr3303

New User


Joined: 21 May 2022
Posts: 1
Location: Portugal

PostPosted: Sat May 21, 2022 11:38 pm
Reply with quote

Want to be able to dowload program sample
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Sun May 22, 2022 10:55 am
Reply with quote

Please don’t tailgate the old posts .. if you have a question start a new topic.
Btw, if you read my earlier response then after your first post now you can able to download it.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts 3 files concatenated to 1 DFSORT/ICETOOL 2
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts Error to invoke MPP program through B... IMS DB/DC 3
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files and write Matched/Unm... JCL & VSAM 8
Search our Forums:

Back to Top