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

Write only matched records in file using cobol


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

New User


Joined: 26 Jul 2012
Posts: 4
Location: india

PostPosted: Thu Jul 26, 2012 12:56 pm
Reply with quote

There are two files

FileA FileB
1 3
3 4
5 6
7 7
9 8

now i need in output file only matched records - 3 and 7 ..
and also this is jus sample input file i have given.. actual input file has 'n' number of datas//

Write matched records in file using cobol only
Back to top
View user's profile Send private message
rakesh1155

New User


Joined: 21 Jan 2009
Posts: 84
Location: India

PostPosted: Thu Jul 26, 2012 2:24 pm
Reply with quote

I googled "File matching in cobol" and got a lot of links explaining the logic.

Here is one of them:
Link from a competitive site is removed

Also, There is tested sample code to accomplish a 2-file match/merge posted as a "Sticky" at the top of the COBOL part of the forum.
ibmmainframes.com/viewtopic.php?t=22649
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Jul 26, 2012 2:36 pm
Reply with quote

PS.: Rakesh - per the Forum rules I've removed one of the links from your post. If you ask, why? Well, posting such links is against Forum rules.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Jul 26, 2012 2:39 pm
Reply with quote

yasho_bala -- have you tried something, to start with? Forget about the language used, what pseudo code will you write for it? It's a simple file-matching logic and there are plenty of example of that sort over internet and on Forums like this, as Rakesh has also indicated.
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: Thu Jul 26, 2012 7:00 pm
Reply with quote

Hello,

If you have never written code to "match" 2 files, suggest you review the code attached to the "Sticky" at the top of the COBOL part of the forum.

Many of the examples found on the internet are incomplete or just plain wrong.

As this is such a common requirement, suggest you start with tested, working code and expand on this as needed. There is no reason to start from scratch. The code in the sticky is being used very many places.

If you have questions about something in the code, post the bit of code where you have a doubt and someone will be able to clarify.
Back to top
View user's profile Send private message
rakesh1155

New User


Joined: 21 Jan 2009
Posts: 84
Location: India

PostPosted: Fri Jul 27, 2012 12:36 pm
Reply with quote

Anuj, I am not going to ask the question "why".

I just copy-pasted the first link that I got when I googled. Thanks for not issuing a warning for posting a link from a competitive site. icon_smile.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Jul 27, 2012 1:04 pm
Reply with quote

icon_smile.gif - No problem, I usually don't issue a 'yellow-card', unless it's too compelling!

Have a nice stay here,
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Fri Jul 27, 2012 6:02 pm
Reply with quote

<nostalgia> Back when developers were called "Programmers", coding a two file match program, from scratch, was considered an essential part of the training process. Most people struggled when they first encountered this task, but they learned a lot in the process. Of course, some learned only that programming wasn't what they wanted to do with their careers. For others, it was quite the opposite. icon_cool.gif <\nostalgia>
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Jul 27, 2012 6:54 pm
Reply with quote

/Perhaps On

Quote:
Back when developers were called "Programmers"
Over the years, the perception is also changed, I believe. In my small career, I find that, people "know languages" but they don't know "programming" and that's why they are "developers" and not called "programmers" anymore...

/Perhaps Off
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: Fri Jul 27, 2012 7:21 pm
Reply with quote

Programming has become ah, uh, umm, like work . . . And maybe we can get someone to do this for us . . .

Being a developer is more grand. . .

icon_wink.gif
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri Jul 27, 2012 8:16 pm
Reply with quote

Well, I generally style myself a "developer". However, this is because over the past 15-20 years I have more and more had to wear several hats simultaneously: business analyst (determine requirements), system analyst (translate requirements into design), and programmer (implement design). "Test analyst" (execute program and write report detailing defects for programmer to ignore) seems to be considered a separate role these days, although back in the day programmers took their programs through system test.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Fri Jul 27, 2012 9:14 pm
Reply with quote

Several years ago I was successful in being hired for a contract SAS programming position.

As everyone else on the team was SAS certified, the hiring manager asked why I was not SAS certified. I replied that certification merely showed that you knew what the pieces were, but said nothing about how you put them together. To his credit, the hiring mananger liked this answer.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Jul 27, 2012 9:22 pm
Reply with quote

we should start defining some PC ( politically correct ) terms to define these <new> figures

for example in Italy the PC name for the garbage/trash/... collector/man is "ecological operator"

along the lines that a bald man could be defined as hairbrush impaired icon_biggrin.gif
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri Jul 27, 2012 9:44 pm
Reply with quote

enrico-sorichetti wrote:
for example in Italy the PC name for the garbage/trash/... collector/man is "ecological operator"

A friend (who is a real engineer; MS, PE, specializes in coal-fired power plants) complained about the misappropriation of "engineer" to lend prestige to unskilled jobs, as with garbage collectors being called "sanitation engineers". I told her not to worry, as they were now styled "post-consumer resource analysts" icon_lol.gif
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Fri Jul 27, 2012 10:15 pm
Reply with quote

Where I live, in Ontario, Canada, the Association of Professional Engineers regularly takes to task any organization misusing the term "engineer". Only licensed Engineers are allowed to call themselves engineers. In the most recalcitrant cases they take legal action.

One reason this distinction is important is that Engineers are legally accountable for their work. Imagine being sued for malpractice every time one of your programs abended. I would have been out of business years ago.

I am not an engineer, but am a proud father of one. icon_smile.gif
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top