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

find changed records


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

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Mon Sep 01, 2014 2:47 pm
Reply with quote

hi,
i am facinfg a tricky problem .

problem:
i have a file with record 10. (1-4 is key)


say for example:
input file1:

Code:
KEY1AAA111
KEY1AAA222
KEY1BBB333

KEY2MMM888
KEY2MMM888
KEY2MMM888

KEY3PPP333
KEY3PPP444



for the key if there are no changes in the data fields i should write it into unique file.

for the key if any changes in the any of the field i should write it into differ file.


so my unique outfile should have:

Code:
KEY2MMM888
KEY2MMM888
KEY2MMM888




and my defer file should have

Code:
KEY1AAA111
KEY1AAA222
KEY1BBB333

KEY3PPP333
KEY3PPP444



could you please suggest me how can this be achieved through jcl?? using join keys or any other utility?

regds,
useit
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Tue Sep 02, 2014 11:05 am
Reply with quote

hi,
could someone please suggest me some approach?


Regds,
useit
Back to top
View user's profile Send private message
Ramsee

New User


Joined: 06 Jan 2011
Posts: 53
Location: Chennai

PostPosted: Tue Sep 02, 2014 12:54 pm
Reply with quote

Hi Useit,

Please use the below work around of this requirement,

If its an ADHOC request or requirement you can try in SORT, Else you can go for a COBOL PGM.

Code:

//STEP01   EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD *                                     
KEY1AAA111                                           
KEY1AAA222                                           
KEY1BBB333                                           
KEY2MMM888                                           
KEY2MMM888                                           
KEY2MMM888                                           
KEY3PPP333                                           
KEY3PPP444                                           
//SORTOUT  DD SYSOUT=*                               
//SORTXSUM DD DSN=USER.TEST.FILE.XSUM,               
//           DISP=(,CATLG,DELETE),                   
//           SPACE=(CYL,(10,10),RLSE),               
//           DCB=(LRECL=10,BLKSIZE=0,RECFM=FB)       
//SYSIN    DD *                                     
  SORT FIELDS=(1,10,CH,A)                         
  SUM FIELDS=NONE,XSUM                           
/*                                               
//STEP02   EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD DSN=USER.TEST.FILE.XSUM,DISP=SHR   
//SORTOUT  DD DSN=USER.TEST.FILE.XSUM1,           
//           DISP=(,CATLG,DELETE),               
//           SPACE=(CYL,(10,10),RLSE),           
//           DCB=(LRECL=10,BLKSIZE=0,RECFM=FB)   
//SYSIN    DD *                                   
  SORT FIELDS=(1,10,CH,A)                         
  SUM FIELDS=NONE                                 
/*                                               
//STEP03   EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTJNF1 DD *                                   
KEY1AAA111                                       
KEY1AAA222                                       
KEY1BBB333                                       
KEY2MMM888                                       
KEY2MMM888                                       
KEY2MMM888                                       
KEY3PPP333                                       
KEY3PPP444                                       
//SORTJNF2 DD DSN=USER.TEST.FILE.XSUM1,DISP=SHR   
//MTCH01   DD DSN=USER.JOIN.MATCH,               
//      DISP=(,CATLG,DELETE),                     
//      SPACE=(CYL,(10,10),RLSE),                 
//      DCB=(LRECL=10,BLKSIZE=0,RECFM=FB)         
//UNMTCH01 DD DSN=USER.JOIN.UNMATCH.F1,           
//      DISP=(,CATLG,DELETE),                     
//      SPACE=(CYL,(10,10),RLSE),                 
//      DCB=(LRECL=10,BLKSIZE=0,RECFM=FB)         
//UNMTCH02 DD DSN=USER.JOIN.UNMATCH.F2,           
//      DISP=(,CATLG,DELETE),                     
//      SPACE=(CYL,(10,10),RLSE),                 
//      DCB=(LRECL=10,BLKSIZE=0,RECFM=FB)         
//SYSIN    DD *                                   
   OPTION COPY                                   
   JOINKEYS FILES=F1,FIELDS=(1,10,A)                               
   JOINKEYS FILES=F2,FIELDS=(1,10,A)                   
   JOIN UNPAIRED                                       
   REFORMAT FIELDS=(F1:01,15,F2:01,15)                 
   OUTFIL FNAMES=MTCH01,                               
     INCLUDE=(1,1,CH,NE,C' ',AND,11,1,CH,NE,C' '),     
     BUILD=(1,10)                                     
   OUTFIL FNAMES=UNMTCH01,                             
     INCLUDE=(1,1,CH,NE,C' ',AND,11,1,CH,EQ,C' '),     
     BUILD=(1,10)                                     
   OUTFIL FNAMES=UNMTCH02,                             
     INCLUDE=(1,1,CH,EQ,C' ',AND,11,1,CH,NE,C' '),     
     BUILD=(11,10)   



Please verify the details of USER.JOIN.MATCH and USER.JOIN.UNMATCH.F1.

I dont feel this is the right solution to this requirement, please guide me if i am wrong.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Sep 02, 2014 1:07 pm
Reply with quote

I think you'll have to look at this one.

How many records on the file?

It can be done., but I think it is quite complex.

Once you get to the end of a key, you need to know if all your data is the same for the key. At the start of a key, you need to know where to write the data.

In a general programming language you'd store in a table and process "one behind" (processing key at "break" of key or end-of-file).

Both parts of that can be done with JOINKEYS - just not at the same time.

So I'd suggest working on the left/right from the link and using the JOINKEYS for the extract.

You need three things: record-to-recod, is the data the same (watch out for data of one key accidentally matching data of another); end of key, here's the record I want; the JOINKEYS with the records you want to extract the data you want.

If you concentrate on the matches, they go to one OUTFIL and on the other OUTFIL you just use SAVE (which gets everything which has not beem written to another OUTFIL). So you don't need to code for mismatches, just for matches.

This task is easy in a gpl.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Sep 02, 2014 1:08 pm
Reply with quote

Ramsee,

DFSORT does not have XSUM. Mind you, does useit have DFSORT?
Back to top
View user's profile Send private message
Ramsee

New User


Joined: 06 Jan 2011
Posts: 53
Location: Chennai

PostPosted: Tue Sep 02, 2014 1:26 pm
Reply with quote

Hi Bill,

Thanks for educating me that DFSORT will not support XSUM.

Hi Useit,

You can try to filter the DUPLICATE Records via the following steps as well. DUPKEYS
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Sep 02, 2014 1:46 pm
Reply with quote

Ramsee,

Sorry, no DUPKEYS either.

Don't have time to look closely, but the requirement is: mixture of data (5,6) per key (1,4), records for that key go to one file, else records for that key go to another.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top