View previous topic :: View next topic
|
Author |
Message |
ssprabhu
New User
Joined: 25 Apr 2005 Posts: 67 Location: pune
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
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 |
|
|
ssprabhu
New User
Joined: 25 Apr 2005 Posts: 67 Location: pune
|
|
|
|
Miss Alissa,
Many many thanks. Really much apreciated ..
thanks for understanding my requirements clearly... :-)
i never expect such reply.. |
|
Back to top |
|
|
ssprabhu
New User
Joined: 25 Apr 2005 Posts: 67 Location: pune
|
|
|
|
But Alissa, i have to delete the matched entries from SORTJNF1 file. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
ssprabhu
New User
Joined: 25 Apr 2005 Posts: 67 Location: pune
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
ssprabhu
New User
Joined: 25 Apr 2005 Posts: 67 Location: pune
|
|
|
|
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 |
|
|
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
ssprabhu,
You're welcome. |
|
Back to top |
|
|
|