View previous topic :: View next topic
|
Author |
Message |
chatterjesis
New User
Joined: 31 Aug 2008 Posts: 31 Location: hyderabad
|
|
|
|
I have 2 PS files.
And I need to create 3rd file with entries which are present in file 1 but not in file 2, using syncsort.
File 1 structure is as below,
Code: |
12345678901234567890 <== just the scale
ABCD 1234
5678
9233
EFGH 1111
3333
ABCD 6767 |
File 2 structure is as below,
Code: |
12345678901234567890 <== just the scale
ABCD 1234
ABCD 5678
ABCD 9233
EFGH 1111
EFGH 3333 |
Is there any way to Sort the first file and create a loop for file 1 to match with file 2?
Expected output is F3:
Code: |
12345678901234567890 <== just the scale
ABCD 6767 |
Both are PS files,
File1 LRECL = 32
File2 LRECL = 80
File3 LRECL = 80
Please let me know if you need any more details.
Thanks in advance. |
|
Back to top |
|
|
chatterjesis
New User
Joined: 31 Aug 2008 Posts: 31 Location: hyderabad
|
|
|
|
The structure got distorted in the above post
FIXED
Column 1 starts at position 1 and column 2 starts are position 16 for both F1 and F2.
I am really sorry for the formatting error. |
|
Back to top |
|
|
rmaruri
New User
Joined: 29 Jun 2005 Posts: 13 Location: USA
|
|
|
|
Use SORT JOIN.
Here is the sample. Change it as per the requirement.
JOINKEYS FILES=F1,FIELDS=(1,6,A)
JOINKEYS FILES=F2,FIELDS=(1,6,A)
JOIN UNPAIRED F1,ONLY
REFORMAT FIELDS=(F1:1,6)
SORT FIELDS=COPY |
|
Back to top |
|
|
chatterjesis
New User
Joined: 31 Aug 2008 Posts: 31 Location: hyderabad
|
|
|
|
I was using the same code as suggested but this one gives, along with ABC 6767
5678
9233
3333
comes in the output, but i need only the below entry
ABCD 6767 |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I suppose if you don't want the blank keys at all, just OMIT them.
If the blank keys are supposed to inherit the key value of the previous non-blank key, then you'll need to do a bit of tinkering. |
|
Back to top |
|
|
chatterjesis
New User
Joined: 31 Aug 2008 Posts: 31 Location: hyderabad
|
|
|
|
Thanks Bill for the reply...
Yes, you got it correct, the blank fields should retain the previous non blank values. Is there any looping facility? or something to keep it stored?
Thanks in advance. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I don't think there is any "looping" available. I think you can define groups of records such that they can be processed with the key from the first record in the group.
I'd look at the manual Table of Contents and Index. Search this forum. Search the internet. Hope that someone with more specific knowledge than I have picks this up again :-)
Unfortunately, SYNCSORT manuals are not generally available unless you are entitled to one, which I'm not. |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
chatterjesis,
Tried on DFSort but should work on Syncsort. AFAIK, Syncsort doesn't allow "subtasking".
Also,why do you need output with 80 bytes? If you are just selecting unmatched records from file1, shouldn't your output be 32 bytes only?
Code: |
//STEP0001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=YOUR INPUT1 FB32
//SORTOUT DD DISP=(NEW,PASS),DSN=&&T1
//SYSIN DD *
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(1,4,CH,GT,C' '),PUSH=(1:1,4))
/*
//STEP0002 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD DISP=SHR,DSN=&&T1
//SORTJNF2 DD DISP=SHR,DSN=YOUR INPUT2 FB80
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(01,04,A,16,04,A)
JOINKEYS FILES=F2,FIELDS=(01,04,A,16,04,A)
JOIN UNPAIRED,F1,ONLY
REFORMAT FIELDS=(F1:01,32)
INREC OVERLAY=(80:X)
SORT FIELDS=COPY |
OUTPUT
Thanks, |
|
Back to top |
|
|
chatterjesis
New User
Joined: 31 Aug 2008 Posts: 31 Location: hyderabad
|
|
|
|
Thanks a lot!
This one worked like wonder! |
|
Back to top |
|
|
prasanth_thavva
New User
Joined: 28 Jul 2005 Posts: 86 Location: Chennai
|
|
|
|
Even we can use OMIT COND to eliminate the records which has spaces in first 4 bytes and then in the next step we can use join keys to un matched records from file A i think achieve the results |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Prasanth
chatterjesis wrote: |
Thanks Bill for the reply...
Yes, you got it correct, the blank fields should retain the previous non blank values. Is there any looping facility? or something to keep it stored?
Thanks in advance. |
Thanks, |
|
Back to top |
|
|
prasanth_thavva
New User
Joined: 28 Jul 2005 Posts: 86 Location: Chennai
|
|
|
|
Sql'
Thanks, but actually i would like to figure out what exactly below card does when it executes
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(1,4,CH,GT,C' '),PUSH=(1:1,4))
I have got it like if the first 4 bytes are spaces push, but exactly what push command does ? can you explain me
whether it will write this in temporary area if it a has spaces in first 4 bytes |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I have got it like if the first 4 bytes are spaces push, |
Try working with the code - i believe this is incorrect.
Suggest you look at other topics that have done GROUPing. . . |
|
Back to top |
|
|
|