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

Matching two files, matched and unmatched


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

Active User


Joined: 06 Jun 2009
Posts: 115
Location: UK

PostPosted: Wed Oct 31, 2012 4:34 pm
Reply with quote

Hi,

Some questions on REFORMAT statement.

SORT Manual says:
The REFORMAT statement indicates the fields from the F1 file and/or the F2 file you want to include in the joined records, and the order in which you want the fields to appear. You can also include an indicator of where the key was found in the joined records ('B' for key found in F1 and F2, '1' for key found in F1 only, or '2' for key found in F2 only).

Method1:
Code:
REFORMAT FIELDS=(F1:1,60,F2:1,1)
OUTFIL FILES=01,INCLUDE=(61,1,CH,NE,X'40'),BUILD=(1,60)

Question1 - Why it is F2:1,1 (pos 1, length 1 from file2)? How come file2 first byte has indicator?

Method2:
Code:
REFORMAT FIELDS=(F1:1,60,?)
OUTFIL FILES=01,INCLUDE=(61,1,CH,EQ,C'B'),BUILD=(1,60)

Can I reformat joined record from both the files? I mean:
Code:
REFORMAT FIELDS=(F1:1,25,F2:1,15,?)

first 25 bye from F1 + First 15 bytes from F2 + Indicator

provided, I have done JOIN UNPAIRED,F1,F2

Question2: Would this have still worked for Indicator identification in INCLUDE COND used in OUTFIL?

Many thanks.
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: Wed Oct 31, 2012 4:42 pm
Reply with quote

The Fn:1,1 and then test for space is a SyncSort technique because SyncSort does not have the ? marker. You need to choose a location which cannot possibly have that value, so doesn't need to be 1,1, you can change the fill character (used to create "no data" for a mismatch) to another value as well.

Yes, your REFORMAT can contain data from both files. Most often it will. Where there is a mismatch, the data from the file which did not match gets set to a "pad" value.

Yes, the ? indicator will still tell you the "condition" of the JOIN. B, 1 or 2, and this is 100% reliable without expending effort choosing a location/different pad value.
Back to top
View user's profile Send private message
zh_lad

Active User


Joined: 06 Jun 2009
Posts: 115
Location: UK

PostPosted: Wed Oct 31, 2012 5:18 pm
Reply with quote

Many thanks for addressing these questions. I have tried REFORMAT having fields from both the files - it works very well.

It has been two good days of learning SORT/JOINKEYS.

Cheers!
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 Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top