Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Unmatched records needed
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Tue Nov 20, 2012 8:55 pm    Post subject: Unmatched records needed
Reply with quote

File-1:Recordlength-5,Recordformat-FB
Code:
1234Y
2345N
5674Y
2378Y


File-2:Recordlength-5,Recordformat-FB
Code:
1234Y
1345Y
5074Y
2308Y


Output:Recordlength-5,Recordformat-FB
Code:
1345Y
5074Y
2308Y
5674N
2378N


Here all unmatched records from file2 and unmatched records from file1 but 'Y' of file1 records is to be replaced with 'N'.Also here all the matched records is to be eliminated and records with 'N' value from file1 is to be also eliminated. for e.g:2345N

Join Key is the complete record length :5.


Could you please suggest the sort card for this?
Back to top
View user's profile Send private message

dick scherrer

Site Director


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

PostPosted: Tue Nov 20, 2012 9:37 pm    Post subject:
Reply with quote

Hello,

Why is the sequence of the input and the output not consistent?
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Tue Nov 20, 2012 9:47 pm    Post subject:
Reply with quote

Code:
File1:
1234Y
2345N
2378Y
5674Y


Code:
File:2
1234Y
1345Y
2308Y
5074Y


Code:
Output:
1345Y
2308Y
2378N
5074Y
5674N


Dick: Thanks for the correction.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Tue Nov 20, 2012 9:49 pm    Post subject:
Reply with quote

Rohit,

Your explanation is pretty bad

I am pretty confused with what you want

WHY NOT REUSE YOUR OLD POST AND EXPERIENCE icon_evil.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Tue Nov 20, 2012 9:59 pm    Post subject:
Reply with quote

1)Match F1 and F2 based on 1-5 position
2)Get all unmatched records from F1 into output file
3)Get all unmatched records from F2 but replace 'Y' by 'N'
4)Eliminate blindly if any records from F1 is suffixed with 'N'.

@Pandora: Is this make sense now?
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Tue Nov 20, 2012 10:09 pm    Post subject:
Reply with quote

ok As said above what did you try ?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Tue Nov 20, 2012 10:38 pm    Post subject:
Reply with quote

Rohit Umarjikar wrote:
1)Match F1 and F2 based on 1-5 position
2)Get all unmatched records from F1 into output file
3)Get all unmatched records from F2 but replace 'Y' by 'N'
4)Eliminate blindly if any records from F1 is suffixed with 'N'.


So, you already know you want JOINKEYS.
Code:
  JOIN UNPAIRED,F1,F2,ONLY


Will get you all the unmatched records.

In the JNFN1CNTL you can INCLUDE/OMIT the 'N's blindly.

From the REFORMAT record, replace any 'Y' on F2 by 'N'.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Tue Nov 20, 2012 10:45 pm    Post subject:
Reply with quote

Code:
//S1     EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTJFN1 DD DSN=Input.File1
//SORTJNF2 DD DSN=Input.File2
//SORTOUT DD DSN=Unmatched.Records from F2
//SYSIN    DD *
  JOINKEYS FILE=F1,FIELDS=(1,5,A)
  JOINKEYS FILE=F2,FIELDS=(1,5,A)
  JOIN UNPAIRED,F2                     
  REFORMAT FIELDS=(F2:1,5)             
  SORT FIELDS=COPY


This will be for file 2 and same I have to do it for File1 as well and then concatenate both the files. But I was looking somitng to do it in one step.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Tue Nov 20, 2012 10:46 pm    Post subject:
Reply with quote

Thanks Bill for the directions, I will try to write a card.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Tue Nov 20, 2012 11:36 pm    Post subject: Reply to: Unmatched records needed
Reply with quote

OK, let us know if you get problems.

Did you run the step you showed? What did it do for you with the matched records?
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Wed Nov 21, 2012 12:22 am    Post subject:
Reply with quote

Bill: I should have written ,

Code:
JOINKEYS FILE=F1,FIELDS=(1,5,A)
  JOINKEYS FILE=F2,FIELDS=(1,5,A)
  JOIN UNPAIRED,F2,Only                     
  REFORMAT FIELDS=(F2:1,5)             
  SORT FIELDS=COPY


If I do not write 'ONLY' then it gives matched and unmatched records from file2
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Wed Nov 21, 2012 12:39 am    Post subject:
Reply with quote

Code:
//PS010    EXEC PGM=SORT         
//SORTJNF1 DD *                   
1114Y                             
1117Y                             
2346N                             
//SORTJNF2 DD *                   
1114Y                             
1119Y                             
2347Y                             
//SORTOUT  DD SYSOUT=*           
//SYSUDUMP DD SYSOUT=*           
//SYSPRINT DD SYSOUT=*           
//SYSOUT   DD SYSOUT=*           
//SYSIN    DD *                   
  JOINKEYS FILE=F1,FIELDS=(1,5,A)
  JOINKEYS FILE=F2,FIELDS=(1,5,A)
  JOIN UNPAIRED,F1,F2,ONLY       
  REFORMAT FIELDS=(F2:1,5)       
  SORT FIELDS=COPY               
           
//*                             
//JNF1CNTL DD *                 
  INCLUDE COND=(5,1,CH,NE,C'N') 
//*                             


Bill: Can you please suggest about
Quote:
From the REFORMAT record, replace any 'Y' on F2 by 'N'.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Wed Nov 21, 2012 12:42 am    Post subject:
Reply with quote

Rohit Umarjikar wrote:
1)Match F1 and F2 based on 1-5 position
2)Get all unmatched records from F1 into output file
3)Get all unmatched records from F2 but replace 'Y' by 'N'
4)Eliminate blindly if any records from F1 is suffixed with 'N'.

To cover point #2 from your requirement, you would need JOIN UNPAIRED,F1,F2,ONLY as communicated earlier.

Thanks,
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Wed Nov 21, 2012 12:46 am    Post subject:
Reply with quote

@sqlcode1
:That is what I included already, can you suggest on point#3?
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Wed Nov 21, 2012 12:53 am    Post subject:
Reply with quote

See if below UNTESTED helps...
Code:
//PS010    EXEC PGM=SORT                                         
//SORTJNF1 DD *                                                   
1114Y                                                             
1117Y                                                             
2346N                                                             
//SORTJNF2 DD *                                                   
1114Y                                                             
1119Y                                                             
2347Y                                                             
//SORTOUT  DD SYSOUT=*                                           
//SYSOUT   DD SYSOUT=*                                           
//SYSIN    DD *                                                   
  JOINKEYS FILE=F1,FIELDS=(1,5,A)                                 
  JOINKEYS FILE=F2,FIELDS=(1,5,A)                                 
  JOIN UNPAIRED,F1,F2,ONLY                                       
  REFORMAT FIELDS=(F1:1,5,F2:1,5,?)                               
  INREC IFTHEN=(WHEN=(11,1,CH,EQ,C'2',AND,10,1,CH,EQ,C'Y'),       
        OVERLAY=(10:C'N'))                                       
  SORT FIELDS=COPY                                               
  OUTREC IFOUTLEN=5,IFTHEN(WHEN=(11,1,CH,EQ,C'2'),OVERLAY=(1:6,5))
                                                                 
//*                                                               
//JNF1CNTL DD *                                                   
  INCLUDE COND=(5,1,CH,NE,C'N')                                   
//*                                                               

Thanks,
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Wed Nov 21, 2012 1:02 am    Post subject:
Reply with quote

output is :
Code:
1117Y
1119N
2347N


Can you please tell me what is

Code:
11,1,CH,EQ,C'2'
used for?

Thanks for the help
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Wed Nov 21, 2012 2:50 am    Post subject:
Reply with quote

Rohit Umarjikar wrote:
output is :
Code:
1117Y
1119N
2347N


Isn't this what you expected?

11,1,CH,EQ,C'2' tells you that it is unpaired record from file2 defined by SORTJNF2. More information can be found here

Thanks,
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Wed Nov 21, 2012 2:56 am    Post subject:
Reply with quote

Output should have been,

Code:
1117N
1119Y
2347Y


Thanks for the other information.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Wed Nov 21, 2012 3:09 am    Post subject:
Reply with quote

Rohit Umarjikar wrote:
1)Match F1 and F2 based on 1-5 position
2)Get all unmatched records from F1 into output file
3)Get all unmatched records from F2 but replace 'Y' by 'N'

4)Eliminate blindly if any records from F1 is suffixed with 'N'.

Code:
//SORTJNF1 DD *                   
1114Y                             
1117Y                             
2346N                             
//SORTJNF2 DD *                   
1114Y                             
1119Y                             
2347Y

Rohit Umarjikar wrote:
Output should have been,

Code:
1117N
1119Y
2347Y


1117(Y/N) is an unpaired record from file1. Your requirement doesn't state anything about replacing unpaired records from file1 with Y to N. Rather it is to do the same for file2 records. Same with the other 2 records. 1119(Y/N) and 2347(Y/N) are unpaired records from File2 with Y and you wanted Y be replaced with N for unmatched FILE2 records.

Am I missing something here?

Thanks,
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Wed Nov 21, 2012 3:35 am    Post subject:
Reply with quote

Quote:
1)Match F1 and F2 based on 1-5 position
2)Get all unmatched records from F2 into output file
3)Get all unmatched records from F1but replace 'Y' by 'N'
4)Eliminate blindly if any records from F1 is suffixed with 'N'.


Amended.

Sorry for all the confusion.Your understanding is perfectly right,
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us