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
 

 

find changed records

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

Active User


Joined: 05 Oct 2006
Posts: 141

PostPosted: Mon Sep 01, 2014 2:47 pm    Post subject: find changed records
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: 141

PostPosted: Tue Sep 02, 2014 11:05 am    Post subject:
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: 52
Location: Chennai

PostPosted: Tue Sep 02, 2014 12:54 pm    Post subject: Reply to: find changed records
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Sep 02, 2014 1:07 pm    Post subject: Reply to: find changed records
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Sep 02, 2014 1:08 pm    Post subject: Reply to: find changed records
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: 52
Location: Chennai

PostPosted: Tue Sep 02, 2014 1:26 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Sep 02, 2014 1:46 pm    Post subject: Reply to: find changed records
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    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 How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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