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
 

 

File Comparison using DFSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Tue Dec 15, 2009 12:03 am    Post subject: File Comparison using DFSORT
Reply with quote

I have two files.
File 1 and File 2, I want to create a file named File 3.
File 3 should have the records when a few columns of File 1 is equal to a few columns of File 2.

    File 1:
    ABCDE1
    ABCDE2
    ABCDE3

    File 2:
    ABCDE1
    ABCDE2
    ABCDE4

    File 3:
    ABCDE1
    ABCDE2

should have above records, comparison, last three columns of File 1 against File 2
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Dec 15, 2009 4:31 am    Post subject:
Reply with quote

Quote:
File 3 should have the records when a few columns of File 1 is equal to a few columns of File 2.


Quote:
comparison, last three columns of File 1 against File 2


Your explanation is confusing. By last three columns, do you mean positions 5-7 or something else?

For matching records, do you want the record from file1 or the record from file2?

What is the RECFM and LRECL of each input file?

Your example does NOT have duplicates within file1? Is that the case, or can file1 have dups within it?

Your example does NOT have duplicates within file2? Is that the case, or can file2 have dups within it?

If either file can have dups within it, please show a better example of input and expected output covering those cases.
Back to top
View user's profile Send private message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Tue Mar 16, 2010 8:15 am    Post subject:
Reply with quote

Hi Frank,

I have similar kind of problem.

I have two flat input files, file-1(LRECL=9, Key=1-9) and file-2(LRECL=550, Key=1-9). One output file, file-3.

File-1 looks like:-
abcdefghi
jklmnopqr
stuvwxyza


File-2 looks like:-
abcdefghi 123456 5678 12345 ......
jklmnopqr 567890 1234 56789 ......
abc123456 abcdef ghab dfhgh .....

File-3 should look like-
abcdefghi 123456 5678 12345 ......
jklmnopqr 567890 1234 56789 ......



So, File-3 should contain all the records from file-2 which has its matching key with file-1.

Note- File-1 and File-2 can have duplicates.
Back to top
View user's profile Send private message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Tue Mar 16, 2010 8:41 pm    Post subject:
Reply with quote

Hi,

Sorry, Above requirement has been changed a littile bit:--
Please see below--

I have three flat input files, [file-B(LRECL=9, Key=1-9)] ,[file-P(LRECL=9, Key=1-9)] and [file-S(LRECL=9, Key=1-9)]
One output file, [File-M(LRECL=9)]

File-B looks like:-
abcdefghi
jklmnopqr
stuvwxyza

File-P looks like:-
abcdefghi
jklmnopqr
abc123456
123456789
567890123

File-S should look like-
jklmnopqr
abc123456
123456789
567890123


So, File-M should contain all the records from file-B Which passes following condition-
(file-B key NOT= file-P key) OR (file-B key = file-S key)

Note:- File-M should not have duplicate.

Please let me know if you need further clarification.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Mar 16, 2010 9:24 pm    Post subject: Reply to: File Comparison
Reply with quote

deepak_munjal,

The following DFSORT JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                     
//SORTOUT  DD DSN=&&HEADR,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)       
//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                 
  OUTFIL REMOVECC,BUILD=(9X),HEADER1=(9C'$')                       
//*                                                                 
//STEP0200 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD DSN=&&HEADR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT       
//         DD DSN=Your file S,DISP=SHR
//         DD DSN=&&HEADR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT       
//         DD DSN=Your file P,DISP=SHR         
//         DD DSN=&&HEADR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT       
//         DD DSN=Your file B,DISP=SHR                     
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                     
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,9,CH,EQ,C'$$$$$$$$$'),         
          PUSH=(10:ID=1))                                           
  SORT FIELDS=(1,9,CH,A),EQUALS                                     
                                                                   
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(12:SEQNUM,8,ZD,RESTART=(1,9))),
         IFTHEN=(WHEN=GROUP,BEGIN=(12,8,ZD,EQ,1),PUSH=(11:10,1))   
                                                                   
  OUTFIL REMOVECC,NODETAIL,BUILD=(9X),INCLUDE=(10,2,ZD,EQ,33),     
  SECTIONS=(1,9,TRAILER3=(1,9))                                     
//*
Back to top
View user's profile Send private message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Tue Mar 16, 2010 9:36 pm    Post subject:
Reply with quote

Thanks Kolusu!!

But can't we do this with Comparex or ICETOOL.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Mar 16, 2010 9:42 pm    Post subject:
Reply with quote

deepak_munjal wrote:
Thanks Kolusu!!

But can't we do this with Comparex or ICETOOL.


Are you shopping for a solution ? I gave you the optimal solution using DFSORT. If you want a solution using COMPAREX , then why did you even post the question in DFSORT forum in the first place.

Next time you post a requirement , post all your limitations and your choices too , so that i can simply ignore them.

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: Tue Mar 16, 2010 9:43 pm    Post subject:
Reply with quote

Hello,

Why would ICETOOL be preferred over the sort. . . icon_confused.gif

Maybe, i misunderstand. . .
Back to top
View user's profile Send private message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Tue Mar 16, 2010 9:53 pm    Post subject:
Reply with quote

Its not the matter of preferred!!

As you see the above code has two steps and Also liitle complicated.
I was looking to do this in one step by using ICETOOL/Comparex.

As here, I have following condition--
( file-B key NOT= file-P key) OR (file-B key = file-S key)

I mean I can do this easily in two steps by using ICETOOL/comparex with less complicated code.<By implementing (file-B key NOT= file-P key) in one step and (file-B key = file-S key) in 2nd step>

Please let me know if we have a better way.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Mar 16, 2010 10:05 pm    Post subject:
Reply with quote

deepak_munjal wrote:
Its not the matter of preferred!!

As you see the above code has two steps and Also liitle complicated.
I was looking to do this in one step by using ICETOOL/Comparex.


Do you really know the concept of how many passes it would require to do with ICETOOL ?. Understand the difference between one step vs multiple passes of data. Even though you code a single ICETOOL step it would take a minimum of 4 passes to get the desired results.

Quote:

I mean I can do this easily in two steps by using ICETOOL/comparex with less complicated code.<By implementing (file-B key NOT= file-P key) in one step and (file-B key = file-S key) in 2nd step>


Oh really ? I can't speak for COMPAREX , but I would LOVE to see an easier solution using ICETOOL. May be I can learn a thing from you.

Quote:
Please let me know if we have a better way.


What is the use? You are hell bent on having a solution your way. So it doesn't matter if we provided the most optimal solution.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Tue Mar 16, 2010 10:11 pm    Post subject:
Reply with quote

What are you whining about.
Skolusu is giving you a crack solution just for nothing.

You are talking about using a comparex/icetool solution which
also will need 2 steps.

You want a 1 step solution? Use SAS or Easytrev.
Back to top
View user's profile Send private message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Tue Mar 16, 2010 10:15 pm    Post subject:
Reply with quote

I am not saying that that this is not the solution... I am asking if you have any other way which i can opt for and see which process take longer time.

I can do this easily using Comparex.
For first condition Compares card would be-

MAXDIFF=50,,
,,,
FORMAT=22,,CASE=UPPER,DASH=C'-',PLUS=C'+'
NIBBLE=NO,FLDSONLY=NO,LINE=(32,HOR)
MBRHDR=YES,PAGE=58
DECIMAL,EBCDIC,GENFLDS=NO,KEYSONLY=NO
COPYDIFF
KEY=(1,9)
FIELD=(1,9)

For 2nd condition Compares card would be-

MAXDIFF=50,,
,,,
FORMAT=22,,CASE=UPPER,DASH=C'-',PLUS=C'+'
NIBBLE=NO,FLDSONLY=NO,LINE=(32,HOR)
MBRHDR=YES,PAGE=58
DECIMAL,EBCDIC,GENFLDS=NO,KEYSONLY=NO
COPYSAME
KEY=(1,9)
FIELD=(1,9)


Thanks!
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Mar 16, 2010 11:13 pm    Post subject:
Reply with quote

So run your COMPAREX job and Kolusu's DFSORT job and see which is faster.

As Kolusu said, you don't seem to understand the difference between multiple steps and multiple passes and how they relate to performance.

Quote:
I can do this easily using Comparex.


You seem to think the Comparex solution is "easy" whereas the DFSORT solution is not. I don't know on what basis you've reached that conclusion. That Comparex solution doesn't look easy to me (but then I don't know Comparex as you obviously don't know DFSORT).

I'm locking this thread as there's no point in continuing this discussion.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 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