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
 

 

Compare 2 input files based on a column and output result
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Amit S

New User


Joined: 30 Jul 2010
Posts: 17
Location: india

PostPosted: Tue Jan 10, 2012 7:57 pm    Post subject: Compare 2 input files based on a column and output result
Reply with quote

Hello All,

I have 2 input PS files as below

File1
-----

Code:
First_name     Last_name                   State
-------------    ---------------------        ------
Raj                Shhhh                         FX
Tuz                   ddd                          FX
Ryan              tttttt                            ML
Reg                eeeeeeeee                  PN


File2
-----
Code:
State           city          area
-------------------------------
FX             abc          pqr
ML             ddd        iii
FX             XYZ         rdt
ML             hhh          uuu
PN             rrr           eee

I am trying to code a cobol program whose output file will be like this

Output file
-----------
Code:
First_name     Last_name                   State         City         Area
-------------    ---------------------        ------           ----        ------
Raj                Shhhh                         FX             abc         pqr
Tuz               ddd                             FX             abc         pqr
Raj                Shhhhh                        FX             XYZ       rdt
Tuz                 ddd                            FX             XYZ       rdt
 Ryan              tttttt                            ML            ddd       iii
Ryan              tttttt                            ML             hhh       uuu

I also searched in existing forum for any similar type of program but did not find any.

Please let me know at earliest if any one have code for this.

Thank you,
Back to top
View user's profile Send private message

Akatsukami

Global Moderator


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

PostPosted: Tue Jan 10, 2012 8:25 pm    Post subject:
Reply with quote

Too bad you couldn't find this sticky.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Tue Jan 10, 2012 8:25 pm    Post subject: Reply to: Compare 2 input files based on a column and output
Reply with quote

Sorry to be so slow, but yes, people will have code for this.

When posting your data, please include it within the Code tags, as this will preserve spacing.

What state are you talking about which only has one city? Usually states have lots of cities, towns, etc.

If the requirment is as simple as you make out, solutions will be available using your sort product.

If you've found the two-file match program at the top of the Cobol forum, and follow the advice in the topic you tailgated, then that will give you something.
Back to top
View user's profile Send private message
Amit S

New User


Joined: 30 Jul 2010
Posts: 17
Location: india

PostPosted: Tue Jan 10, 2012 8:45 pm    Post subject:
Reply with quote

Akatsukami,

Thank you for the link. I was out of COBOL coding activities for quite few years and so I was not very active in this forum. So its kind of new for me

Thanks,
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Tue Jan 10, 2012 8:49 pm    Post subject: Reply to: Compare 2 input files based on a column and output
Reply with quote

if that is all You have to do <sort> might be the fastest way around
quite a lots of examples, search for JOINKEYS
Back to top
View user's profile Send private message
Amit S

New User


Joined: 30 Jul 2010
Posts: 17
Location: india

PostPosted: Tue Jan 10, 2012 9:40 pm    Post subject: Re: Reply to: Compare 2 input files based on a column and ou
Reply with quote

Thank you Enrico, let me check joins related topics too
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: Wed Jan 11, 2012 6:03 am    Post subject:
Reply with quote

Hello,

When posting data, code, jcl, screen info, and etc, you need to use the "Code" tag to improve readability and alignment. I tried to Code your data, but you had already tried to align in the Reply Editor (which destroys the alignment).
Back to top
View user's profile Send private message
Amit S

New User


Joined: 30 Jul 2010
Posts: 17
Location: india

PostPosted: Wed Jan 11, 2012 7:48 pm    Post subject:
Reply with quote

Thank you D.Sch. Thats realy a more precise way of posting.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Thu Jan 12, 2012 3:01 am    Post subject:
Reply with quote

Hi,

maybe I'm missing something, why isn't state PN also a match in output file ?


Gerry
Back to top
View user's profile Send private message
Amit S

New User


Joined: 30 Jul 2010
Posts: 17
Location: india

PostPosted: Thu Jan 12, 2012 4:04 pm    Post subject:
Reply with quote

attachment deleted, a useless waste of space.
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 Jan 12, 2012 10:08 pm    Post subject:
Reply with quote

Hello,

Yup, attachments are most often not a good thing. . .

What about the question Gerry asked?
Quote:
maybe I'm missing something, why isn't state PN also a match in output file ?
Back to top
View user's profile Send private message
Amit S

New User


Joined: 30 Jul 2010
Posts: 17
Location: india

PostPosted: Thu Jan 12, 2012 10:14 pm    Post subject:
Reply with quote

Hello All,
Is is possible to achieve the same merge function using ICETOOL only? my JCL is working fine in mainframe for the above code but in UNIX it is giving parsing error : syntax error at ","

Thanks,
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 Jan 12, 2012 10:32 pm    Post subject: Reply to: Compare 2 input files based on a column and output
Reply with quote

Hello,

You are quite close to having your topic locked and probably getting a Warning.

You still have not answered Gerry's question (which is just rude) and now present this question about ICETOOL and UNIX .

You posted a COBOL question (or so we understood) so how does ICETOOL even relate. . . icon_confused.gif

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

New User


Joined: 30 Jul 2010
Posts: 17
Location: india

PostPosted: Thu Jan 12, 2012 10:39 pm    Post subject:
Reply with quote

Sorry , I missed Gary's post. Gary is right. PN will also be a match in last rows starting with Reg in first field.
I missed to post that row in output file.

I started this thread with a COBOL code in mind but my goal was achieved with JOINKEYS in SORT utility to get a desired output file. I am just checking if the output file with same format can be generated using ICETOOL/ICEMAN.

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Thu Jan 12, 2012 11:59 pm    Post subject: Reply to: Compare 2 input files based on a column and output
Reply with quote

Perhaps if you can confirm which Sort product you are using and full details of the problem you are having, including the Unix bit (which Unix, etc), the topic can be moved/split into the appropriate forum. Full sort code, full messages, sample input/required output, all in the Code tags.

Take the time to get it all right.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Jan 13, 2012 7:59 am    Post subject:
Reply with quote

Hi,

I have been called many other names before but Gary is not one of them.


Gerry
Back to top
View user's profile Send private message
Amit S

New User


Joined: 30 Jul 2010
Posts: 17
Location: india

PostPosted: Fri Jan 13, 2012 11:32 am    Post subject:
Reply with quote

Hi Gerry,

I am sorry, I mispelled.

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

New User


Joined: 30 Jul 2010
Posts: 17
Location: india

PostPosted: Fri Jan 13, 2012 2:21 pm    Post subject:
Reply with quote

Hi Bill,

Please find the details below:

Server where code is failing:
SunOS 5.10.
Full Sort Code
---------------
Code:
//JOIN01   EXEC PGM=SORT                                           
//SYSOUT DD SYSOUT=*                                               
//SORTJNF1  DD DSN=FILE1,DISP=SHR         
//SORTJNF2  DD DSN=FILE2,DISP=SHR         
//SORTOUT  DD DSN=MERGED FILE,DISP=OLD                     
//*********************************************                     
//SYSIN  DD *                                                       
   JOINKEYS FILES=F1,FIELDS=(19,2,A)                               
   JOINKEYS FILES=F2,FIELDS=(1,2,A)                                 
   REFORMAT FIELDS=(F1:1,5,F1:7,10,F1:19,4,F2:1,3,F2:6,5,F2:12,4)
   SORT FIELDS=COPY
//
%%%%%%%%%%%%%%%%%%%%%%%

Error msg
=======
064230 M SRT0001M parsing starts.
JOINKEYSFILES=F1064230 U MSGXXXXU
parsing error : syntax error at ","[line:0,col:3]

064230 E SRT6001E sort_cmd_parse() fails. rc=-111.
064230 E SRT6001E sortpar_parse fails. rc=-111

-111 stands for internal error
============================
Sample input/output will be same as in my first post.

I am not sure of which sort product the system uses[seems of IBM only], Could you please tell if there any command/way to check whose product
is it?


Thanks,
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Fri Jan 13, 2012 2:28 pm    Post subject: Reply to: Compare 2 input files based on a column and output
Reply with quote

wouldn' t it be time to speak to Your support...
the forum is for zOS related stuff ...
the chances of getting help for SUN related thoings is pretty slim.

I also wonder what <thing> are You using on the SUN server which understands zOS jcl and <sort> control statements ?
Back to top
View user's profile Send private message
Amit S

New User


Joined: 30 Jul 2010
Posts: 17
Location: india

PostPosted: Fri Jan 13, 2012 2:30 pm    Post subject: Re: Reply to: Compare 2 input files based on a column and ou
Reply with quote

Oh,ok. I got the point. Thank you Enrico
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
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Unwrap the data based on delimiter X'25' bhavana yalavarthi DFSORT/ICETOOL 30 Fri Dec 09, 2016 10:25 am
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 24 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


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