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

Comparing Keys in Different Datasets and copy records


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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
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

Moderator Emeritus


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

PostPosted: Fri May 31, 2013 11:42 am
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
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

Moderator Emeritus


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

PostPosted: Fri May 31, 2013 3:24 pm
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
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

Moderator Emeritus


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

PostPosted: Fri May 31, 2013 10:43 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM Goto page 1, 2  Next

 


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 VB to VB copy - Full length reached SYNCSORT 8
Search our Forums:

Back to Top