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
 

 

JCL - file comparision

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: JCL - file comparision
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    Post subject: Re: JCL - file comparision
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    Post subject:
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 Moderator


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

PostPosted: Tue Nov 22, 2005 9:31 pm    Post subject:
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:

http://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 Moderator


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

PostPosted: Tue Nov 22, 2005 9:36 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Tue Nov 29, 2005 4:33 am    Post subject:
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    Post subject:
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

Moderator Team Head


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

PostPosted: Wed Nov 30, 2005 9:42 pm    Post subject: Re: JCL - file comparision
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    Post subject:
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 Moderator


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

PostPosted: Wed Nov 30, 2005 11:02 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Thu Dec 01, 2005 2:53 am    Post subject:
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    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 Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
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


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