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
 

 

How to tell if file changed using DFSORT

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

New User


Joined: 15 Dec 2005
Posts: 72
Location: RALEIGH NC, USA

PostPosted: Thu Apr 19, 2007 5:41 pm    Post subject: How to tell if file changed using DFSORT
Reply with quote

Hope you can help me icon_smile.gif

I have a file (FILE X) on DAY 1 that may have changed on DAY 2 (FILE Y).

I would like to write the records to FILE Z any records that have changed
from FILE Y to FILE Z

Code:

FILE X
------------
AAAABBBB
BBBBAAAA
BBBBDDDD
CCCCEEEE

FILE Y
------------
AAAABBBC
BBBBAAAA
BBBBDDDD
CCCCEEEX

OUTPUT FILE Z (I want to keep CHANGED RECORDS from File Y)
AAAABBBC
CCCCEEEX
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Apr 19, 2007 5:52 pm    Post subject:
Reply with quote

In your example, are the first four characters the key? Or are the first seven characters? How would you know that the BBBBDDDD in file Y is not a changed BBBBAAAA in file X?
Back to top
View user's profile Send private message
srj1957

New User


Joined: 15 Dec 2005
Posts: 72
Location: RALEIGH NC, USA

PostPosted: Thu Apr 19, 2007 6:00 pm    Post subject:
Reply with quote

William Thompson wrote:
How would you know that the BBBBDDDD in file Y is not a changed BBBBAAAA in file X?


Thank you for replying so quickly and finding my error in example.
There isn't a key as such, The first 4 will stay constant, but bytes 5-8 could change

This is what I meant to submit

Code:

FILE X
------------
AAAABBBB
BBBBAAAA
CCCCDDDD
DDDDEEEE

FILE Y
------------
AAAABBBC
BBBBAAAA
CCCCDDDD
DDDDEEEX

OUTPUT FILE Z (I want to keep CHANGED RECORDS from File Y)
AAAABBBC
DDDDEEEX
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Apr 19, 2007 6:27 pm    Post subject:
Reply with quote

Then the first four are unique keys, no duplicates, right?
for every unique key in file X will there be a matching key in file Y? Or could there be a key in X that was deleted from Y? Or a key in Y that was just added and not present in X?
Back to top
View user's profile Send private message
srj1957

New User


Joined: 15 Dec 2005
Posts: 72
Location: RALEIGH NC, USA

PostPosted: Thu Apr 19, 2007 6:31 pm    Post subject:
Reply with quote

William Thompson wrote:
Then the first four are unique keys, no duplicates, right?
for every unique key in file X will there be a matching key in file Y? Or could there be a key in X that was deleted from Y? Or a key in Y that was just added and not present in X?


William,
I appreciate your questions to clarify the data.

Unique Key and No Duplicates
Yes, for every unique key in file X will there be a matching key in file Y.
There will be only updates, - no additions or deletes
Back to top
View user's profile Send private message
srj1957

New User


Joined: 15 Dec 2005
Posts: 72
Location: RALEIGH NC, USA

PostPosted: Thu Apr 19, 2007 6:37 pm    Post subject:
Reply with quote

William Thompson wrote:
Or could there be a key in X that was deleted from Y? Or a key in Y that was just added and not present in X?


William,
What effect would there be if BOTH the above statements were to happen ?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Apr 19, 2007 6:54 pm    Post subject:
Reply with quote

srj1957 wrote:
Quote:
Or could there be a key in X that was deleted from Y? Or a key in Y that was just added and not present in X?
What effect would there be if BOTH the above statements were to happen ?
You are asking me?
You need to decide what you want on file Z in each case. In other words, is an unmatched key a "changed" record? Or only if it is on Y?
Are you still standing by
Quote:
Unique Key and No Duplicates
Yes, for every unique key in file X will there be a matching key in file Y.
There will be only updates, - no additions or deletes

lrecl and recfm?
Back to top
View user's profile Send private message
srj1957

New User


Joined: 15 Dec 2005
Posts: 72
Location: RALEIGH NC, USA

PostPosted: Thu Apr 19, 2007 7:06 pm    Post subject:
Reply with quote

You need to decide what you want on file Z in each case. In other words, is an unmatched key a "changed" record?

William,

Thanks your questions are excellent...

OK..lets say I want any unmatched key to be out put aswell as

Code:
FILE X
------------
AAAABBBB
BBBBAAAA
CCCCDDDD
DDDDEEEE


FILE Y
------------
AAAABBBC
BBBBAAAA
CCCCDDDD
DDDDEEEX
FFFFJJJJ

OUTPUT FILE Z (I want to keep CHANGED RECORDS and any unmatched from File Y)
-----------------------
AAAABBBC
DDDDEEEX
FFFFJJJJ

LRECL = 8
RECFM = FB
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Apr 19, 2007 7:11 pm    Post subject:
Reply with quote

What would file Z look like if there was a"GGGG????" in file X but not in Y?
Back to top
View user's profile Send private message
srj1957

New User


Joined: 15 Dec 2005
Posts: 72
Location: RALEIGH NC, USA

PostPosted: Thu Apr 19, 2007 7:37 pm    Post subject:
Reply with quote

William Thompson wrote:
What would file Z look like if there was a"GGGG????" in file X but not in Y?


GGGG in file X could be ignored...
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 Apr 19, 2007 8:56 pm    Post subject:
Reply with quote

srj1957,

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

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/8)
//IN2 DD DSN=...  input file2 (FB/8)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/8)
//TOOLIN   DD    *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,4,CH) KEEPNODUPS -
  WITH(9,4) WITH(17,1) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(1,8,17:C'1')
/*
//CTL2CNTL DD *
  INREC BUILD=(1,4,9:5,4,17:C'2')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,
    INCLUDE=(17,1,CH,EQ,C'2',AND,
      5,4,BI,NE,9,4,BI),
    BUILD=(1,4,9,4)
/*
Back to top
View user's profile Send private message
srj1957

New User


Joined: 15 Dec 2005
Posts: 72
Location: RALEIGH NC, USA

PostPosted: Thu Apr 19, 2007 10:19 pm    Post subject:
Reply with quote

Thank you all so much for help... icon_biggrin.gif

Even though I read the DFSORT tricks and the other DFSORT links I find it hard to come up with a solution... icon_neutral.gif

Thanks again

Steve
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
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


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