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

JCL - file comparision


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Balasubramanian

New User


Joined: 23 Apr 2005
Posts: 13
Location: Bangalore

PostPosted: Tue Nov 22, 2005 3:18 pm
Reply with quote

Hi,

file1:-

Code:

field1          field2
----------------------------
1                  1
1                  3
1                  4
1                  5
1                  6
2                  0
2                  1
2                  2
2                  3


file2:-

Code:

field1          field2
----------------------------
1                  1
1                  1
1                  1
1                  3
1                  4
1                  5
2                  1
2                  2
2                  2
2                  2


file1 doesnt contain duplicates and file2 contains duplicates

Have to find the values that are in file1 and not in file2.

Output should be

Code:

field1          field2
----------------------------
1                  6
2                  0
2                  3


Can anybody help to do the above using JCl.

Thanks & Regards,
Balasubramanian S
Back to top
View user's profile Send private message
sivakumar. K. M

New User


Joined: 22 Nov 2005
Posts: 3

PostPosted: Tue Nov 22, 2005 3:43 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//CON DD * input file1
1 1
1 3
1 4
1 5
1 6
2 0
2 1
2 2
2 3

/*
// DD * input file2
1 1
1 1
1 1
1 3
1 4
1 5
2 1
2 2
2 2
2 2
/*
//OUT DD DSN=... output file
//TOOLIN DD *
SELECT FROM(CON) TO(OUT) ON(1,2,CH) NODUPS
/*
Back to top
View user's profile Send private message
Phantom

New User


Joined: 04 Sep 2005
Posts: 25

PostPosted: Tue Nov 22, 2005 4:50 pm
Reply with quote

Sivakumar K.M

Quote:

Balasubramaniam
Have to find the values that are in file1 and not in file2.


When you use NODUPS option of SORT, it will pick up non-duplicate entries from both files. But the original poster just wanted data from file 1 that are not in file 2. But your code will also pickup data from file 2 that is not available in file 1 which will not give desired results.

The other way to accomplish this is
1. To generate dynamic sort cards
2. Using SPLICE

Balasubramaniam,
For Solution # 1, (dynamic sort card) - You cannot use this method if your input file 1 (without dups) is huge. How many records do you have ?

For Solution # 2 - You need to have latest version of Syncsort or Dfsort. What sort product do you have ? and what is the version.

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

DFSORT Developer


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

PostPosted: Tue Nov 22, 2005 9:31 pm
Reply with quote

Actually, for the input data shown, NODUPS will work since there aren't any nondup records in file2. For the more general case where there are nondup records in file2, you can use a DFSORT/ICETOOL job like this:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
1                  1
1                  3
1                  4
1                  5
1                  6
2                  0
2                  1
2                  2
2                  3
//IN2 DD *
1                  0  <--- added nondup in file2
1                  1
1                  1
1                  1
1                  3
1                  4
1                  5
2                  1
2                  2
2                  2
2                  2
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,1,CH) ON(20,1,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  OUTREC FIELDS=(1,80,81:C'1')
/*
//CTL2CNTL DD *
  OUTREC FIELDS=(1,80,81:C'2')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(81,1,CH,EQ,C'1'),
    OUTREC=(1,80)
/*


Alternatively, you could use the SPLICE operator of DFSORT's ICETOOL as discussed at:

www.ibm.com/servers/storage/support/software/sort/mvs/tricks/srtmst02.html#t05
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue Nov 22, 2005 9:36 pm
Reply with quote

Phantom wrote
Quote:
2. Using SPLICE
For Solution # 2 - You need to have latest version of Syncsort or Dfsort.


This may be true for Syncsort, but it is definitely NOT TRUE for DFSORT. DFSORT's ICETOOL has had SPLICE since the Feb, 2003 DFSORT PTF! The "latest version" of DFSORT is the Dec, 2004 PTF (which is not very new at this point).
Back to top
View user's profile Send private message
Phantom

New User


Joined: 04 Sep 2005
Posts: 25

PostPosted: Wed Nov 23, 2005 8:08 pm
Reply with quote

You are correct Frank,

I should have said "You need to have Dfsort or latest version of syncsort" instead of saying the other way ! But whatever you said is what I meant.

Thanks,
Phantom
Back to top
View user's profile Send private message
Balasubramanian

New User


Joined: 23 Apr 2005
Posts: 13
Location: Bangalore

PostPosted: Mon Nov 28, 2005 4:07 pm
Reply with quote

Hi all

Thanks for your immediate response and valid comments.

Thanks & Regards,
Balasubramanian S
Back to top
View user's profile Send private message
Alain Benveniste

New User


Joined: 14 Feb 2005
Posts: 88

PostPosted: Tue Nov 29, 2005 3:59 am
Reply with quote

Code:

The "latest version" of DFSORT is the Dec, 2004 PTF (which is not very new at this point).

I'm really looking forward to seeing what will bring the next one !!!

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

DFSORT Developer


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

PostPosted: Tue Nov 29, 2005 4:33 am
Reply with quote

I think it will make you happy. icon_cool.gif
Back to top
View user's profile Send private message
lav

New User


Joined: 30 Nov 2005
Posts: 3

PostPosted: Wed Nov 30, 2005 9:33 pm
Reply with quote

Can anyone Explain how could this be achieved using Dynamic Sort card ?
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Nov 30, 2005 9:42 pm
Reply with quote

lav, could you explain what is a "Dynamic Sort card"?
Back to top
View user's profile Send private message
lav

New User


Joined: 30 Nov 2005
Posts: 3

PostPosted: Wed Nov 30, 2005 9:59 pm
Reply with quote

Even i am not sure of what this "dynamic sort card" is. Phantom had metioned this as 1 solution in his above post. Just wanted to know what he meant by that and how it can be done?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Nov 30, 2005 11:02 pm
Reply with quote

Phantom was talking about dynamically generating an INCLUDE or OMIT statement using the values from file2, and then using that INCLUDE or OMIT statement to select the records from file1. That method cannot be used for large files since there's a limit to the number of INCLUDE or OMIT conditions you can use. The SELECT method I showed can be used for large files.
Back to top
View user's profile Send private message
lav

New User


Joined: 30 Nov 2005
Posts: 3

PostPosted: Thu Dec 01, 2005 2:40 am
Reply with quote

How to generate an INCLUDE statement when the number of records that will be present in a file is not known?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Dec 01, 2005 2:53 am
Reply with quote

That's the dynamic part. You use OUTREC to create a "condition" line (e.g. p,m,CH,EQ,C'string',OR,) for each record in file2, and then pass that as a control statement to be used against file1. This method is very limited vs the general SELECT method I showed, so I won't bother to show it here.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top