View previous topic :: View next topic
Author
Message
Ravi Kirti New User Joined: 24 Mar 2012Posts: 17 Location: pune
Hi,
I have below requirements..
There are 2 seq files..having comparing filed say of 5 places,numeric...but it start for first file is from 10-14 and for 2nd file from 20-24..
i.e
file 1
12345
22222
14852
78965
file2
12345
78965
98745
56987
so I need 3 output file having:
output1: Present only in first file i.e
22222
14852
output2: Present only in second file i.e
98745
56987
output3:Present in both file i.e
12345
78965
Regards,
-Ravi
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
It it required to be in that output order?
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
Ravi Kirti,
Use the following DFSORT JCL which will give you the desired results
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD *
----+----1----+----2----+----3----+----4----+----5----+----6----
12345
22222
14852
78965
//INB DD *
12345
78965
98745
56987
//ONLYF1 DD SYSOUT=*
//ONLYF2 DD SYSOUT=*
//BOTH DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(10,5,A)
JOINKEYS F2=INB,FIELDS=(20,5,A)
JOIN UNPAIRED
REFORMAT FIELDS=(F1:1,80,F2:1,80,?)
OUTFIL FNAMES=ONLYF1,BUILD=(01,80),INCLUDE=(161,1,CH,EQ,C'1')
OUTFIL FNAMES=ONLYF2,BUILD=(81,80),INCLUDE=(161,1,CH,EQ,C'2')
OUTFIL FNAMES=BOTH,BUILD=(1,80),SAVE
//*
Back to top
Ravi Kirti New User Joined: 24 Mar 2012Posts: 17 Location: pune
Bill Woodger wrote:
It it required to be in that output order?
Hi Bill,
I need the comparing filed in respective files.
Thanks!
-Ravi
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Quote:
I need the comparing filed in respective files.
Huh? What does that mean?
A better answer to Bill's question would be "Yes" or "No".
Back to top
Ravi Kirti New User Joined: 24 Mar 2012Posts: 17 Location: pune
Skolusu wrote:
Ravi Kirti,
Use the following DFSORT JCL which will give you the desired results
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD *
----+----1----+----2----+----3----+----4----+----5----+----6----
12345
22222
14852
78965
//INB DD *
12345
78965
98745
56987
//ONLYF1 DD SYSOUT=*
//ONLYF2 DD SYSOUT=*
//BOTH DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(10,5,A)
JOINKEYS F2=INB,FIELDS=(20,5,A)
JOIN UNPAIRED
REFORMAT FIELDS=(F1:1,80,F2:1,80,?)
OUTFIL FNAMES=ONLYF1,BUILD=(01,80),INCLUDE=(161,1,CH,EQ,C'1')
OUTFIL FNAMES=ONLYF2,BUILD=(81,80),INCLUDE=(161,1,CH,EQ,C'2')
OUTFIL FNAMES=BOTH,BUILD=(1,80),SAVE
//*
Thanks Skolusu for prompt!
I just need some clarifications:
"
REFORMAT FIELDS=(F1:1,80,F2:1,80,?)
OUTFIL FNAMES=ONLYF1,BUILD=(01,80),INCLUDE=(161,1,CH,EQ,C'1')
"
why we should quote
REFORMAT FIELDS=(F1:1,80,F2:1,80,?)
BUILD=(01,80)
And in INCLUDE, why we will compare one character position from 161 with char is '1' or '2'.
Will the JCL affect(other than in JOINKEYS statement) if I say my comparing field start from 567 position for first and 678 for 2nd file?
Back to top
Ravi Kirti New User Joined: 24 Mar 2012Posts: 17 Location: pune
Frank Yaeger wrote:
Quote:
I need the comparing filed in respective files.
Huh? What does that mean?
A better answer to Bill's question would be "Yes" or "No".
Sorry, I mean to say Yes.
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
Ravi Kirti wrote:
Thanks Skolusu for prompt!
I just need some clarifications:
"
REFORMAT FIELDS=(F1:1,80,F2:1,80,?)
OUTFIL FNAMES=ONLYF1,BUILD=(01,80),INCLUDE=(161,1,CH,EQ,C'1')
"
why we should quote
REFORMAT FIELDS=(F1:1,80,F2:1,80,?)
BUILD=(01,80)
And in INCLUDE, why we will compare one character position from 161 with char is '1' or '2'.
Start reading about JOINKEYS which is explained in detail here
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA60/4.0
Ravi Kirti wrote:
Will the JCL affect(other than in JOINKEYS statement) if I say my comparing field start from 567 position for first and 678 for 2nd file?
Depends what the RECFM of the input files is. Why do you have to lead us on a wild goose chase? How hard is it post the actual requirement ? Post detailed information on what you're trying to accomplish. Do not make people guess what you mean. This will give you a much better chance of getting a good answer to your question.
Back to top
Ravi Kirti New User Joined: 24 Mar 2012Posts: 17 Location: pune
Hi Skolusu,
I tested the code as per your suggestion. Getting abend..
Below is the SYSOUT result.
[
SYNCSORT LICENSED FOR CPU SERIAL NUMBER 41BA6, MODEL 2817 602
SYSIN :
OPTION COPY
JOINKEYS F1=INA,FIELDS=(10,5,A)
*
JOINKEYS F2=INB,FIELDS=(20,5,A)
*
JOIN UNPAIRED
REFORMAT FIELDS=(F1:1,80,F2:1,80,?)
*
OUTFIL FNAMES=ONLYF1,BUILD=(01,80),INCLUDE=(161,1,CH,EQ,C'1')
OUTFIL FNAMES=ONLYF2,BUILD=(81,80),INCLUDE=(161,1,CH,EQ,C'2')
OUTFIL FNAMES=BOTH,BUILD=(1,80),SAVE
WER268A JOINKEYS STATEMENT: SYNTAX ERROR
WER268A JOINKEYS STATEMENT: SYNTAX ERROR
WER268A REFORMAT STATEMENT: SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
]
I appologies for insufficiet details I povided earlier.
Actual file details is as follow:
file1
Organization . . . : PS
Record format . . . : FB
Record length . . . : 678
Block size . . . . : 27798
and the comparing field start from position 459.
file2
Organization . . . : PS
Record format . . . : FB
Record length . . . : 847
Block size . . . . : 9317
and the comparing field starts from position 496.
In output files i need comparing fields as requested above.
Please let me know where the code needs to be changed.
Thanks!
Ravi
Back to top
xknight Active User Joined: 22 Jan 2008Posts: 117 Location: Liberty city
Hello,
Indicates Syncsort is installed at your site.
Back to top
Ravi Kirti New User Joined: 24 Mar 2012Posts: 17 Location: pune
xknight wrote:
Hello,
Indicates Syncsort is installed at your site.
So Can you please suggest any thing to resolve it...
Back to top
Ravi Kirti New User Joined: 24 Mar 2012Posts: 17 Location: pune
I missed one thing to say that the input files may have different counts of records...
say file 1 has 10,000.
file2 has 50,000.
Thanks!
Back to top
enrico-sorichetti Superior Member Joined: 14 Mar 2007Posts: 10889 Location: italy
Quote:
So Can you please suggest any thing to resolve it...
Kolusu and Frank are DSFORT developers,
they are happy to give advice on DFSORT, it is improper to expect their help on a competitor' s product!
topic moved where it belongs... JCL
it would be a demonstration of good manners and intelligence to find out, before posting, the sort product being used
JCL for SYNCSORT issues ( WER... messages )
DFSORT for IBM DFSORT ( ICE... messages )
in order to post in the proper section of the forum
and in order not to have people waste time on topics they are not <supposed> to answer!
Back to top
bodatrinadh Active User Joined: 05 Jan 2007Posts: 101 Location: chennai (India)
You can try this code Ravi. Change it according to your requirement.
Code:
//S1 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD *
12345
22222
14852
78965
//SORTJNF2 DD *
12345
78965
98745
56987
//ONLYF1 DD SYSOUT=*
//ONLYF2 DD SYSOUT=*
//ONLYF3 DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS FILE=F1,FIELDS=(10,5,A)
JOINKEYS FILE=F2,FIELDS=(20,5,A)
REFORMAT FIELDS=(F1:1,80,F2:1,80)
JOIN UNPAIRED
OUTFIL FNAMES=ONLYF1,BUILD=(01,80),INCLUDE=(10,1,CH,NE,C' ',AND,
101,1,CH,NE,C' ')
OUTFIL FNAMES=ONLYF2,BUILD=(81,80),INCLUDE=(10,1,CH,EQ,C' ',AND,
101,1,CH,NE,C' ')
OUTFIL FNAMES=ONLYF3,BUILD=(1,80),SAVE
Thanks
-3nadh
Back to top
Please enable JavaScript!