Two files as input in cobol prgram

Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Two files as input in cobol prgram

Postby puneetshukla » Mon Aug 31, 2009 5:49 pm

I have two input file layout and record structure are given below
File :1 :
Name (1-20)      Roll Number(21-40)    Subject(41-60)  Qualifiaction(61-80)
Sachin Bhavsar   9867890899999         Mathmatics        Bachlor
Satish Singh       9876909090909          Hystory             Graduate
Sachin Shukla     9898989898989          Physics              Masters
Sneha Pawar       89898989898             HINDI                Senior secondry
Shweta Daware   78787878787             English               High school

File 2: 
Name (1-20)      Roll Number(21-40)   Subject(41-60)       Qualification(61-80)
Sanjay Mishra    17898989898            Cooking                 PHD
Vaishali             67767777777             Football                Eight pass
Sachin Bhavsar  9867890899999          Mathmatics           Bachlor
Satish Singh      9876909090909          Hystory                 Graduate
Sneha Pawar       89898989898            HINDI                    Senior secondry

Now , throu cobol program i want to take those record in my output file which is not matching if record is present in both file then skip that record
My output file like this :

Output :
Name (1-20)     Roll Number(21-40) Subject(41-60) Qualification(61-80
Sanjay Mishra   17898989898        Cooking        PHD
Vaishali        67767777777        Football       Eight pass
Posts: 1
Joined: Mon Aug 31, 2009 2:12 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Two files as input in cobol prgram


Re: Two files as input in cobol prgram

Postby dick scherrer » Tue Sep 01, 2009 2:55 am

Hello and welcome to the forum,

Suggest you practice and become comfortable with the "Code" tag - which improves readability and preserves alignment. Also, learn to Preview so you can see your post as it will appear to the forum. TWhen the post appears as you want, then Submit.

At the top of the IBM Cobol part of the forum is a "Sticky" that contains a working example of code that does what you want (2-file match/merge sample code). Download that code (right-click save-as) and make changes for your requirement.
Hope this helps,
User avatar
dick scherrer
Global moderator
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Return to IBM Cobol


  • Related topics
    Last post