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
 

 

compare 2 files and how to extract the records.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Fri Sep 26, 2008 8:21 pm    Post subject: compare 2 files and how to extract the records.
Reply with quote

Hi ,

I have 2 files say X and Y. both contains customer numbers.

If a customer number in file X matches in file Y and with a specific indicator embedded wtih the record, like cust no details from 1 to 4 th coloumn and 5 th coloumn an indicator N is associated with the customer in file Y so only in that case i need to cut(remove the details ) the whole cutomer details from file X and report in to a new file.

Please could you advise me how to do using JCL stmts.
Back to top
View user's profile Send private message

Arun Raj

Moderator


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

PostPosted: Fri Sep 26, 2008 8:31 pm    Post subject:
Reply with quote

Quote:
Please could you advise me how to do using JCL stmts

JCL as such does nothing. you can achieve this using any of the sort products installed at your shop(DFSORT or SYNCSORT). Can you post some sample input/output records
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Sat Sep 27, 2008 3:04 am    Post subject:
Reply with quote

If I understood your requirements correctly, here is a sample SyncSort for z/OS job that will do what you asked:
Code:
//SORT1 EXEC PGM=SORT                   
//SORTJNF1 DD *                         
1111 DETAILS DETAILS DETAILS             
2222 DETAILS DETAILS DETAILS             
3333 DETAILS DETAILS DETAILS             
4444 DETAILS DETAILS DETAILS             
5555 DETAILS DETAILS DETAILS             
6666 DETAILS DETAILS DETAILS             
7777 DETAILS DETAILS DETAILS         
//SORTJNF2 DD *                                             
1111N
2222                                                     
3333                                                       
4444N                                                       
6666N                                                       
8888N                                                       
//SORTOUT DD SYSOUT=*                                       
//SYSOUT DD SYSOUT=*                                       
//SYSIN DD *                                               
   JOINKEYS FILES=F1,FIELDS=(1,4,A)                         
   JOINKEYS FILES=F2,FIELDS=(1,4,A)                         
   REFORMAT FIELDS=(F1:1,80,F2:5,1)                         
   SORT FIELDS=COPY                                         
   OUTFIL FILES=OUT,INCLUDE=(81,1,CH,EQ,C'N'),OUTREC=(1,80)   
/*

The following output is produced:
Code:
1111 DETAILS DETAILS DETAILS
4444 DETAILS DETAILS DETAILS
6666 DETAILS DETAILS DETAILS
Back to top
View user's profile Send private message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Mon Sep 29, 2008 12:29 pm    Post subject:
Reply with quote

Miss Alissa,

Many many thanks. Really much apreciated ..
thanks for understanding my requirements clearly... :-)
i never expect such reply..
Back to top
View user's profile Send private message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Mon Sep 29, 2008 1:08 pm    Post subject:
Reply with quote

But Alissa, i have to delete the matched entries from SORTJNF1 file.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Mon Sep 29, 2008 4:38 pm    Post subject:
Reply with quote

Quote:
i need to cut(remove the details ) the whole cutomer details from file X and report in to a new file.

The job posted by Alissa does exactly what you asked for in your initial post given above. You just need to route your SORTOUT dd to a new file. If you want to replace your SORTJNF1 file with the current output, you can always one more step to do a copy.
Back to top
View user's profile Send private message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Mon Sep 29, 2008 6:48 pm    Post subject:
Reply with quote

Arun yes it works ...but the one more thing is have to delete the matched entries from SORTJNF1 file. that is the below entries should be removed from SORTJNF1 file.

1111 DETAILS DETAILS DETAILS
4444 DETAILS DETAILS DETAILS
6666 DETAILS DETAILS DETAILS

How we can do that...
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Mon Sep 29, 2008 7:19 pm    Post subject:
Reply with quote

ssprabhu,

You can use the below Syncsort job to write two output files like this.

MATCH - matched records from both the files.
NOMATCH1 - unmatched records from file-1.
Code:
//STEP1    EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//NOMATCH1 DD SYSOUT=*                                   
//MATCH    DD SYSOUT=*                                   
//SORTJNF1 DD *                                           
1111 DETAILS DETAILS DETAILS                             
2222 DETAILS DETAILS DETAILS                             
3333 DETAILS DETAILS DETAILS                             
4444 DETAILS DETAILS DETAILS                             
5555 DETAILS DETAILS DETAILS                             
6666 DETAILS DETAILS DETAILS                             
7777 DETAILS DETAILS DETAILS                             
//SORTJNF2 DD *                                           
1111N                                                     
2222                                                     
3333                                                     
4444N                                                     
6666N                                                     
8888N                                                     
//SYSIN    DD *                                           
  JOINKEYS FILE=F1,FIELDS=(1,4,A)                         
  JOINKEYS FILE=F2,FIELDS=(1,4,A),INCLUDE=(5,1,CH,EQ,C'N')
  JOIN UNPAIRED,F1                                             
  REFORMAT FIELDS=(F1:1,80,F2:5,1),FILL=X'FF'                   
  SORT FIELDS=COPY                                             
  OUTFIL FNAMES=NOMATCH1,INCLUDE=(81,1,BI,EQ,X'FF'),BUILD=(1,80)
  OUTFIL FNAMES=MATCH,SAVE,BUILD=(1,80)                         

MATCH
Code:
1111 DETAILS DETAILS DETAILS
4444 DETAILS DETAILS DETAILS
6666 DETAILS DETAILS DETAILS

NOMATCH1
Code:
2222 DETAILS DETAILS DETAILS
3333 DETAILS DETAILS DETAILS
5555 DETAILS DETAILS DETAILS
7777 DETAILS DETAILS DETAILS
Back to top
View user's profile Send private message
ssprabhu

New User


Joined: 25 Apr 2005
Posts: 67
Location: pune

PostPosted: Mon Sep 29, 2008 8:08 pm    Post subject:
Reply with quote

Many Many Many thanks Arun...

Please could you send me the documents having basic details about
JOINKEYS ,REFORMAT FIELDS , JOIN UNPAIRED

i have searched in google but i didn't get anything...
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Mon Sep 29, 2008 8:26 pm    Post subject:
Reply with quote

ssprabhu,

You can contact me offline at alissa.margulies@syncsort.com and I would be happy to assist you with acquiring the manuals.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Sep 30, 2008 9:15 am    Post subject:
Reply with quote

ssprabhu,

You're welcome. icon_smile.gif
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
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm


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