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

Finding difference between two PS files!!!


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Vignesh Sid

New User


Joined: 04 Sep 2017
Posts: 43
Location: India

PostPosted: Mon Oct 30, 2017 1:13 pm
Reply with quote

Hi all,

I have the following file:

File 1:

Code:
"STARTOFDATA","FILE_GENERATION_TIMESTAMP={20171025_004001_EST};APPLICATION_MNEMO
"ENDOFDATA","RECORDCOUNT={115501};PRINCIPAL_RECORDCOUNT={0};GROUP_RECORDCOUNT={7998

File2:

Code:
"STARTOFDATA","FILE_GENERATION_TIMESTAMP={20171026_004001_EST};APPLICATION_MNEMO
"ENTITLEMENT","PERSON","50027SCOTT23","50027SCOTT23","ACCOUNT RECON","RESOURCE",
"ENTITLEMENT","PERSON","50027VIKK123","50027VIKK123","ACCOUNT RECON","RESOURCE",
"ENDOFDATA","RECORDCOUNT={115501};PRINCIPAL_RECORDCOUNT={0};GROUP_RECORDCOUNT={8000


Both the files are of same record length 850 and FB. I need to write the unmatched records in file 2 to a PS. Here we can see the time stamp, two additional records and record count differs.

Code:
//SORTTSC  EXEC PGM=SORT                                     
//SORTJNF1 DD DSN=G0435V00,DISP=SHR
//SORTJNF2 DD DSN=G0436V00,DISP=SHR
//UNMATCH  DD DSN=UNMATCH,         
//            DISP=(OLD,CATLG,CATLG),                         
//            UNIT=,                                         
//            DATACLAS=TST090P5,                             
//            DCB=(LRECL=850,BLKSIZE=0,RECFM=FBS),           
//            SPACE=                                         
//SYSOUT   DD SYSOUT=*                                       
//SYSIN    DD *                                               
  OPTION COPY                                                 
  JOINKEYS F1=SORTJNF1,FIELDS=(1,850,A)                       
  JOINKEYS F1=SORTJNF1,FIELDS=(1,850,A)
  JOINKEYS F2=SORTJNF2,FIELDS=(1,850,A)
  JOIN UNPAIRED,F2,ONLY               
  OUTFIL FNAMES=UNMATCH,BUILD=(1,850) 
/*                   


I used the above JCL and got the below output:

Code:
"ENDOFDATA","RECORDCOUNT={115501};PRINCIPAL_RECORDCOUNT={0};GROUP_RECORDCOUNT={8
"ENTITLEMENT","PERSON","50027SCOTT23","50027SCOTT23","ACCOUNT RECON","RESOURCE",
"ENTITLEMENT","PERSON","50027VIKK123","50027VIKK123","ACCOUNT    RECON","RESOURCE",
"STARTOFDATA","FILE_GENERATION_TIMESTAMP={20171026_004001_EST};APPLICATION_MNEMO

I have got the unmatched records, but the start and end records are swapped.

Can anyone help me with this sort?

Thanks!

CODE' D
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Moderator


Joined: 14 Mar 2007
Posts: 10712
Location: italy

PostPosted: Mon Oct 30, 2017 2:34 pm
Reply with quote

why did You post into the JCL section when there are specific section for the sort questions?

tell what sort product You are using and the topic will be moved to the proper section

messages starting with
WER... ==> SYNCSORT
ICE... ==> IBM DFSORT
Back to top
View user's profile Send private message
Vignesh Sid

New User


Joined: 04 Sep 2017
Posts: 43
Location: India

PostPosted: Mon Oct 30, 2017 3:18 pm
Reply with quote

We use syncsort. Sorry for the inconvenience caused!
Thanks!
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Moderator


Joined: 14 Mar 2007
Posts: 10712
Location: italy

PostPosted: Mon Oct 30, 2017 3:37 pm
Reply with quote

moved!
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 924
Location: Maryland

PostPosted: Mon Oct 30, 2017 6:39 pm
Reply with quote

Vignesh Sid wrote:
I have got the unmatched records, but the start and end records are swapped.

Can anyone help me with this sort?

Your JOINKEYS statements do not specify SORTED option. That's why the sort utility performs its internal sort before attempting to join both inputs (FYI: there is no other way to join long files unless they are either sorted, or assumed to be sorted).

When just adding SORTED option you'll get the error "Fx FILE IS NOT SORTED", or similar.
You can try to play with the options "SORTED,NOSEQCK" but the desired output is not guaranteed since the input comes in random order.

Another method:
1) re-number input records from F2 on input (using //CTL2CNTL DD),
2) then SORT by this sequenced field after JOIN (to restore the original order), and
3) finally truncate this field in either OUTREC, or OUTFIL statement.
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 924
Location: Maryland

PostPosted: Mon Oct 30, 2017 7:03 pm
Reply with quote

A typo in my previous message:

It must be //JNF2CNTL DD instead of //CTL2CNTL DD

Sorry for that
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
This topic is locked: you cannot edit posts or make replies. Copy list of files from PS to another... CLIST & REXX 11
No new posts JOINKEYS to match two input files on ... DFSORT/ICETOOL 3
No new posts can someone please help me in finding... IBM Tools 9
No new posts Group comparison/update between two f... DFSORT/ICETOOL 10
No new posts Need assistance formatting when joini... SYNCSORT 8
Search our Forums:

Back to Top