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
 

 

Comapre two files and create a new record.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
faizm

New User


Joined: 13 Apr 2012
Posts: 59
Location: India

PostPosted: Wed Feb 05, 2014 9:20 pm    Post subject: Comapre two files and create a new record.
Reply with quote

Hi All,

I have two input files (file1 and file2) of same LRECL but number of records could be different in both files i.e file2 may have more records than file1 . First field in both files is an that reflects whether it is changed record (C) or new added record (A) indicator field.
My requirement is basically

1. If any of the field is mismatched in both files then write the record in new output file and insert an indicator C(change) in first field.
2. If it is totally a new record (additional records in file 2) then write these new records from file 2 and insert an indicator A(add) in first field.
3. If record matches then don't write in output file.

Ex: I in below records is indicator field.
input file1 has 3 records
IABCD
IEFGH
IIJKL

input file 2 has 4 records
IABCD
IEFGK
IIJKL
IMNOP

Result should be:
CEFGK
AMNOP

Please reply how we can implement it using SORT. Thanks.
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed Feb 05, 2014 9:34 pm    Post subject:
Reply with quote

Could you please confirm the product you use?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Wed Feb 05, 2014 9:37 pm    Post subject: Reply to: Comapre two files and create a new record.
Reply with quote

Do none of the other JOINKEY examples in the forum help you on this?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Wed Feb 05, 2014 9:56 pm    Post subject: Reply to: Comapre two files and create a new record.
Reply with quote

are You telling that the key is from column 2 for three bytes ?
Back to top
View user's profile Send private message
faizm

New User


Joined: 13 Apr 2012
Posts: 59
Location: India

PostPosted: Thu Feb 06, 2014 8:45 pm    Post subject:
Reply with quote

Just to give some more information. LRECL of both the files are 200 and the key in both the files start at 11 and end at 20 that is key length is 10 char. Now if there is a way I can compare the two files and write the records in a new file. I am trying JOINKEYS.
Can anybody provide me the psuedo code and help me with the tutorial location as well so that I can go and read the syntax etc.

Also, how much it will be feasible (taking CPU time in consideration) to compare the files using JCL when the number of records are 10 lakhs around. Or should I go and write a program to read both the files and compare each values present in them.


Thanks for reply.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Thu Feb 06, 2014 9:29 pm    Post subject: Reply to: Comapre two files and create a new record.
Reply with quote

Quote:
compare the files using JCL

JCL cannot do this - it only tells the system what programs you want to run and what resources are required by those programs.

Syncsort documentation is only available to licensed sites so you should ask around your shop for copies. a good place for examples is within this section of the forum - do a search on JOINKEYS.

To compare files why not use the facilities available to you - sepcifically SUPERC which can be run in both background (batch) or foreground. Your site may have another compare tool e.g. Comparex but you will have to ask around your colloeagues.
Back to top
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Fri Feb 07, 2014 10:38 am    Post subject:
Reply with quote

Faizm,

As per the example given,I assumed your LRECL=5 and RECFM=FB.
Key field = 1,4 . Data=5th column.

Code:
//SORT      EXEC  PGM=SORT                                     
//SORTOUT   DD SYSOUT=*                                       
//SYSIN     DD *                                               
  JOINKEYS F1=IN1,FIELDS=(1,4,A)                               
  JOINKEYS F2=IN2,FIELDS=(1,4,A)                               
  JOIN UNPAIRED,F2                                             
  REFORMAT FIELDS=(F1:1,5,F2:1,5)                             
  OPTION COPY                                                 
  OUTREC IFTHEN=(WHEN=(1,4,CH,EQ,6,4,CH,AND,5,1,CH,NE,10,1,CH),
                 BUILD=(1:C'C',7,4)),                         
         IFTHEN=(WHEN=(1,4,CH,NE,6,4,CH),                     
                 BUILD=(1:C'A',7,4))                           
  OUTFIL OMIT=(1,5,CH,EQ,6,5,CH)                               
//SYSOUT    DD  SYSOUT=*                                       
//IN1       DD *
IABCD           
IEFGH           
IIJKL           
//IN2       DD *
IABCD           
IEFGK           
IIJKL           
IMNOP           



Output is:
Code:
CEFGK
AMNOP


There might be simplest way to achieve this. But I just tried to get the desire output. May be Bill/Kolusu will clear your clarification if you have any.

Note: I feel this Topic should be moved to DFSORT.
Back to top
View user's profile Send private message
faizm

New User


Joined: 13 Apr 2012
Posts: 59
Location: India

PostPosted: Fri Feb 07, 2014 11:36 am    Post subject: Reply to: Comapre two files and create a new record.
Reply with quote

Thanks Suresh and everyone to help me out icon_smile.gif
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Fri Feb 07, 2014 2:43 pm    Post subject: Reply to: Comapre two files and create a new record.
Reply with quote

Quote:
Note: I feel this Topic should be moved to DFSORT.

Why? Nowhere has OP stated, or inferred, that they are using DFSort and, in fact, refused to say which product was being used despite multiple requests. Syncsort lives in JCL (for some strange reason) so it has to be assumed, unless otherwise stated, that the product in question is Syncsort
Back to top
View user's profile Send private message
faizm

New User


Joined: 13 Apr 2012
Posts: 59
Location: India

PostPosted: Fri Feb 07, 2014 3:16 pm    Post subject: Reply to: Comapre two files and create a new record.
Reply with quote

Nic,

We are using SYNCSORT. I just mention that if we can solve the problem through JCL (and need not to write any cobol pgm) that was just to check if we can use any utility programs like SORT. Thanks.
Regards
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Sat Feb 08, 2014 2:55 pm    Post subject: Reply to: Comapre two files and create a new record.
Reply with quote

Please note that you are not solving the problem "through jcl". When running in batch JCL will be used whether you you use a utility program or a program written in the language of your choice.
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: Mon Feb 10, 2014 10:23 pm    Post subject:
Reply with quote

Hello,

Quote:
I just mention that if we can solve the problem through JCL
Just curious, just why does someone believe you can do this "with JCL"?

Most of your contrymen understand they are running a utility with JCL (i.e. batch) and use the correct terminology when talking about it.

Somewhere there, clueless trainers and/or managers have taught this. . .

People who use this terminology just demonstrate that they do not have the slightest grasp of their working environment.
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 -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm


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