Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Comparing Keys in Different Datasets and copy records
Goto page Previous  1, 2
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
ranjitbhingare

New User


Joined: 30 Nov 2005
Posts: 94
Location: PUNE

PostPosted: Wed May 22, 2013 10:44 pm    Post subject:
Reply with quote

I got it !

Thanks a lot for your help Bill ! I really appreciate all suppport.

The issue was after using FILL=C'$', The '$' was filled only in F1 and not in F2 thus the conditions were not working correctly.

Thus I changed to following :-
Code:
//SYSIN    DD  *                                                       
   JOINKEYS FILE=F1,FIELDS=(5,15,A)                                     
   JOINKEYS FILE=F2,FIELDS=(5,15,A)                                     
   JOIN UNPAIRED,F1,F2                                                 
   REFORMAT FIELDS=(F1:1,4,5,129,F2:1,4,5),FILL=C'$'                   
   SORT FIELDS=COPY                                                     
   OUTFIL VLTRIM=C'$',                                                 
          IFTHEN=(WHEN=(5,1,CH,NE,C'$',AND,138,1,CH,NE,C' '),           
                       BUILD=(1,4,C'F1F2-',138,129)),                   
          IFTHEN=(WHEN=(5,1,CH,NE,C'$',AND,138,1,CH,EQ,C' '),           
                       BUILD=(1,4,C'F1-',5,129)),                       
          IFTHEN=(WHEN=(5,1,CH,EQ,C'$',AND,138,1,CH,NE,C' '),           
                       BUILD=(1,4,C'F2-',138,129))                     
/*   


and now I got the desired result.

Output -
Code:

F1F2-XXXXXXX|2002|1|.00|.00|0|2003-08-01-15.18.28.265416
F1F2-XXXXXXX|2003|1|.00|.00|0|2003-08-01-15.18.28.265527
F1-XXXXXXX|2007|1|.00|.00|2|2007-07-14-15.46.59.513033   
F2-XXXXXXX|2007|2|.00|.00|2|2007-07-14-15.46.59.513033   
F1-XXXXXXX|2008|1|.00|.00|1|2008-03-29-17.49.24.833665   
F2-XXXXXXX|2008|2|.00|.00|1|2008-03-29-17.49.24.833665 



Now the question is, why FILL=C'$' did not fill the F2 rec with '$' ? Is there any other parameter missing in the card ?
Back to top
View user's profile Send private message

Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu May 30, 2013 5:08 pm    Post subject:
Reply with quote

Syncsort manual wrote:
Binary zeros will be used instead of the FILL character for the first four bytes of a variable-length record requiring FILL processing
Looks like it is enough to check the first 4 bytes of the Variable length records(RDW) of each file to know if there is a matching record or not.
I just ran a test for the OPs requirement and it works well!
Code:
//SYSIN   DD *                                     
  JOINKEYS FILE=F1,FIELDS=(5,15,A)                 
  JOINKEYS FILE=F2,FIELDS=(5,15,A)                 
  JOIN UNPAIRED,F1,F2                               
  REFORMAT FIELDS=(F1:1,4,1,133,F2:1,4,5)           
  SORT FIELDS=COPY                                 
  OUTFIL VLTRIM=C' ',                               
         IFTHEN=(WHEN=(138,4,CH,EQ,X'00'),         
                      BUILD=(1,4,C'F1-',9,129)),   
         IFTHEN=(WHEN=(005,4,CH,EQ,X'00'),         
                      BUILD=(1,4,C'F2-',142,129)), 
         IFTHEN=(WHEN=NONE,   
                      BUILD=(1,4,C'F1F2-',142,129))


Quote:
Now the question is, why FILL=C'$' did not fill the F2 rec with '$' ? Is there any other parameter missing in the card ?
I ran a test and noticed that, as the OP suggests the FILL option does not actually 'FILL' the missing F2 fields in case no match exists in file2, where as it does 'FILL' the F1 fields if file1 has no matching key record.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7312

PostPosted: Fri May 31, 2013 11:42 am    Post subject: Reply to: Comparing Keys in Different Datasets and copy reco
Reply with quote

Arun, I think testing the record-length (or the whole RDW) is the best way with SyncSort. I suggested it here, but difficult to know from that particular TS whether it worked :-)

I don't know why the FILL should not apply to both records. If it is documented differently and the problem is repeatable, then it should be passed on to SyncSort.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri May 31, 2013 2:15 pm    Post subject:
Reply with quote

Quote:
testing the record-length (or the whole RDW) is the best way with SyncSort
Yes Bill, I have checked the RDW in my test above and looks like that is the only way out for Syncsort (at least for now until the '?' function gets included).

As for the 'FILL' the manual says two things.
- It will FILL the unused bytes of a variable length record.
- It will FILL the missing fields in a REFORMAT when there is no matching key.

But it does not mention anything about a variable length file JOIN when both the scenarios can occur simultaneously, but our tests show that it does not FILL the missing file2 fields for VB JOINs. May be Alissa could have a look at this or someone can send a note to Syncsort to bring this to their attention.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7312

PostPosted: Fri May 31, 2013 3:24 pm    Post subject: Reply to: Comparing Keys in Different Datasets and copy reco
Reply with quote

Here is one from Alissa with two VB and JOINKEYS.

The difference is that the full length is specified on the REFORMAT for both files, rather than just one. Maybe with the "start-position-only" it does not "qualify" for the FILL?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri May 31, 2013 10:25 pm    Post subject:
Reply with quote

Thanks for the link, Bill. That may very well be the reason. Anyways I would like to check it out first thing when I get to work, so to be sure. Have I gone off-topic? icon_biggrin.gif .

Have a nice weekend icon_smile.gif
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7312

PostPosted: Fri May 31, 2013 10:43 pm    Post subject: Reply to: Comparing Keys in Different Datasets and copy reco
Reply with quote

Of course it is not off-topic. I don't just let things go, either :-)

The fine manual wrote:
The FILL parameter defines a fill byte to be used for any missing p,l field bytes


So, a just p "field" will not be FILLed. One of those cases where you can know what the manual is saying when you already know what is happening :-)

Have a good one yourself :-)
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 -> JCL & VSAM All times are GMT + 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IEBGENER to copy from FB to VB and re... Mike.Fulton All Other Mainframe Topics 3 Sat Aug 24, 2019 7:20 am
No new posts Compare duplicate records in same file pshongal DFSORT/ICETOOL 3 Fri Aug 09, 2019 9:37 am
No new posts How to count duplicate key records co... sergeyken SYNCSORT 0 Thu Jul 25, 2019 8:03 pm
No new posts Sort records within a data block rajiv rengasamy DFSORT/ICETOOL 0 Fri Jul 12, 2019 3:25 pm
No new posts Copy physical Tape files to a Mainfra... Dadi Krishna Teja JCL & VSAM 11 Thu May 16, 2019 10:25 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us