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

Match unmatc from single file


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

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Thu Nov 28, 2013 7:03 pm
Reply with quote

I have a input file where there are two types of records
1. Records from position 1-30 (rest are blank)
2. Records from position 41-80 (rest are blank)

Now there is comman key in both these two type of records of 10 bytes
11-20 (in first type of record)
51-60 (in second type of records)


I want the output as below
1. if the key is match, i want consolidated record of two records means from pos 1-80 where 11-20 and 51-60 will have same value as key is matched
2. if the key is not matching then i want to retain both the records as it is

Input

Code:
54545022  JOHNS   12     54775                                         
54545022  FACT005 89     88545                                         
54545022  GTOP    88     54566                                         
                                        STREET 15 MILLER5589 652 5398566
                                        STREET 15 FACT005 89 652 5398FSD
                                        STREET 15 GTOP    88 652 5398TRE



Output

Code:
54545022  JOHNS   12     54775                                         
54545022  FACT005 89     88545          STREET 15 FACT005 89 652 5398FSD
54545022  GTOP    88     54566          STREET 15 GTOP    88 652 5398TRE
                                        STREET 15 MILLER5589 652 5398566



Here FACT005 89,GTOP 88 are matching keys

As the volume of records is huge i need to do it in single step.
Hope i am clear with reuirement
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: Thu Nov 28, 2013 7:22 pm
Reply with quote

As the volume of records is huge, you need to do it efficiently. Efficiently dictates how many steps, not the other way around.

JOINKEYS with the same DSN as both inputs

In JNF1CNTL create a record only containing the "left side" data.

In JNF2CNTL create a record only containing the "right side" data.

JOIN UNPAIRED,F1,F2

REFORMAT with F1:entire-record,F2:entire-record

That's about it.

Unless you can have duplicate keys in either or both sets of data...
Back to top
View user's profile Send private message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Thu Nov 28, 2013 7:30 pm
Reply with quote

But unpaired will retain only unmatch records but i want both match and unmatch records
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: Thu Nov 28, 2013 7:32 pm
Reply with quote

Well, instead of asserting that, why don't you read the manual? If you don't believe the manual, why don't you experiment? If you then sill feel the need to make the same objection, by all means do so.
Back to top
View user's profile Send private message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Fri Nov 29, 2013 7:16 pm
Reply with quote

for the same requirement mentioned above i am using the same file in
SORTJNF1,SORTJNF2 and keys are starting at position 34 and 75 both are of 10 bytes.Keys are alphanumeric

i am using below sort card

Code:
JOINKEYS FILE=F1,FIELDS=(34,10,A)                         
 JOINKEYS FILE=F2,FIELDS=(75,10,A)                         
 JOIN UNPAIRED,F1,F2                                       
 REFORMAT FIELDS=(F1:1,45,F2:47,58)                       
  SORT FIELDS=COPY                                         



But in output i am getting only spaces,but i want a consolidated record for both match and unmatch keys
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: Sat Nov 30, 2013 4:25 am
Reply with quote

Quote:
where 11-20 and 51-60 will have same value as key is matched


Quote:
JOINKEYS FILE=F1,FIELDS=(34,10,A)
JOINKEYS FILE=F2,FIELDS=(75,10,A)
Back to top
View user's profile Send private message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Sat Nov 30, 2013 1:23 pm
Reply with quote

Hi Bill

Sorry for confusion this file has different layout but the requirement is same

keys start from position 34 and 75
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: Sat Nov 30, 2013 5:52 pm
Reply with quote

What happened to your JNFnCTNL files? You have probably included blank data for all the blank keys, which will match before the match you want.

When creating the "left side" data, you remove all the keys which are blank. When creating the "right side" data you do the same. You need to have the JOINKEYS sort the data for the match, so the sort will be more efficient the less data you give it. Cut down the records, as I suggested.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Dec 03, 2013 12:47 am
Reply with quote

It can be done in a single step itself instead of joinkeys. Just use an IFTHEN validating the space for record type 1 and place the key at the end of the record.

Now sort on the key value at the end and use WHEN=GROUP on OUTREC to push the value for matched records. Use OUTFIL sections with Trailer3 to get just 1 record per key.
Back to top
View user's profile Send private message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Tue Dec 03, 2013 3:45 pm
Reply with quote

Hi Skolusu

Thanks for reply

I am unable to understand WHEN=GROUP logic
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Dec 03, 2013 8:03 pm
Reply with quote

Hello,

There are several examples in previous topics.

Suggest you use the SEARCH facility (in the blue line near the top) to locate some. Most have sample data and the sort code to do this.
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top