View previous topic :: View next topic
|
Author |
Message |
ap_mainframes
Active User
Joined: 29 Dec 2005 Posts: 181 Location: Canada
|
|
|
|
Hi,
I have two input files, file A and file B.
File A has records in following format
1100500000195616 1234
1100500000195616 9999
1100500000195616 0000
1100500000260444 1234
1100500000264225 1234
1100500000264999 7867
File B has records in following format
1100500000195616 4568
1100500000260444 4534
1100500000264225 7867
1100500000264999 7867
I need the output file in this format.
1100500000195616 1234 4568
1100500000195616 9999 4568
1100500000195616 0000 4568
Can we do this in SORT ???
thanks
ap_mainframes |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You need to explain the rules you are using to go from input to output.
If your expected output was:
Code: |
1100500000195616 1234 4568
1100500000195616 9999 4568
1100500000195616 0000 4568
1100500000260444 1234 4534
1100500000264225 1234 7867
1100500000264999 7867 7867
|
then I'd guess you're trying to add the second field from fileB to the end of fileA for records that match on the first field, and I could show you how to do that.
But since you show your expected output as:
Code: |
1100500000195616 1234 4568
1100500000195616 9999 4568
1100500000195616 0000 4568
|
I can't figure out what you're trying to do. What happened to the other records? What are the rules? Also, what is the RECFM and LRECL of your input files? |
|
Back to top |
|
|
ap_mainframes
Active User
Joined: 29 Dec 2005 Posts: 181 Location: Canada
|
|
|
|
Hi Frank,
Sorry for the incomplete " expected Output" . Actually the expected output is
1100500000195616 1234 4568
1100500000195616 9999 4568
1100500000195616 0000 4568
1100500000260444 1234 4534
1100500000264225 1234 7867
1100500000264999 7867 7867
Basically the rules are
1. To add the second field from fileB to the end of fileA for records that match on the first field.
2. Only those records should be written to output file where column A of file B that is 4568 is greater than column A of file A that is 1234.
Thanks
ap_mainframes |
|
Back to top |
|
|
IQofaGerbil
Active User
Joined: 05 May 2006 Posts: 183 Location: Scotland
|
|
|
|
re rule 2
still trying to figure out how ;
4568 is greater than 9999 and
7867 is greater than 7867
maybe I have misubderstood the rule![/quote] |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
ap,
I'm guessing you want to apply rule 2 after the records are joined, and that your final output should be:
Code: |
100500000195616 1234 4568
100500000195616 0000 4568
100500000260444 1234 4534
100500000264225 1234 7867
|
Given that assumption, here's a DFSORT/ICETOOL job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1
//IN2 DD DSN=... input file2
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,16,CH) -
WITHALL WITH(1,21) USING(CTL3)
/*
//CTL1CNTL DD *
OUTREC BUILD=(1,16,23:18,4)
/*
//CTL2CNTL DD *
OUTREC OVERLAY=(26:X)
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(23,4,ZD,GT,18,4,ZD)
/*
|
|
|
Back to top |
|
|
|