View previous topic :: View next topic
Author
Message
venkatatcts New User Joined: 16 Mar 2009Posts: 55 Location: India
Hi,
I have three input file and it as a common key. The key starts from position 17 for the first input file and for the third input file it starts from position 53.
I need to extract the key alone from the 3 files and write it to a separate file.
I tried the following,
Code:
//SORTJNF1 DD DSN=XXXXXX.XXXXX.XXX(0),DISP=SHR - Key from 17 and length of 8
// DD DSN=XXXXX.XXXXXX.XX(0),DISP=SHR -Key from 17 and length of 8
//SORTJNF2 DD DSN=XXXXX.XXXXXX.XXX(0),DISP=SHR - Key from 53 and length of 8
//SORTOUT DD DSN=XXXXX.XXXXXX.XXXX,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSALLDA,SPACE=(CYL,(10,5),RLSE),
// DCB=(LRECL=8,BLKSIZE=0,RECFM=FB)
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//CAIPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//*
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(17,8,A)
JOINKEYS FILES=F2,FIELDS=(53,8,A)
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F1:17,8,F2:53,8)
SORT FIELDS=COPY,
DYNALLOC=(SYSDA,32),SIZE=E50000
OUTFIL FILES=(OUT),
OUTREC=(1,8)
/*
But I am not getting the expected result. I could guess that join reformat is not the correct syntax. But Please let me know any good idea to do this.
Thanks,
Venkat
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
Hello,
You mention 3 files - but do not explain three, only 2.
The explanation is completely lacking. . . What are the recfm and lrecls of the files? What is the "expected result"?
Suggest you show some sample input data and the output you want from that input. Show the informational output generated by the job.
Saying "it doesn't work" just wastes everyone's time. . .
Back to top
Alissa Margulies SYNCSORT Support Joined: 25 Jul 2007Posts: 496 Location: USA
Dick - Venkat has concatentated 2 datasets in SORTJNF1. I believe those 2 files plus the SORTJNF2 file makes up the 3 input files he is referring to.
Venkat - Your control statements can be simplified as follows:
Code:
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(17,8,A)
JOINKEYS FILES=F2,FIELDS=(53,8,A)
JOIN UNPAIRED
REFORMAT FIELDS=(F1:17,8)
SORT FIELDS=COPY,
DYNALLOC=(SYSDA,32)
/*
However, since your JCL was not giving you the expected output, please show us some sample input records (from each of the 3 files) and what your desired output would be from those records as Dick had requested. This will help us to better assist you.
Regards,
Back to top
Alissa Margulies SYNCSORT Support Joined: 25 Jul 2007Posts: 496 Location: USA
If all you want is the 8-byte field from the unpaired records, these control statements should work for you:
Code:
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(17,8,A)
JOINKEYS FILES=F2,FIELDS=(53,8,A)
JOIN UNPAIRED,ONLY
REFORMAT FIELDS=(F1:17,8,F2:53,8)
SORT FIELDS=COPY
OUTFIL OUTREC=(1,8,/,9,8)
/*
Give that a try and let us know if that gives you the desired output. If not, please see the previous posts.
Regards,
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
Hi Alissa,
Quote:
I believe those 2 files plus the SORTJNF2 file makes up the 3 input files he is referring to.
I believe so also now that you mention it. . .
I was reading the comments rather than the jcl. . .
d
Back to top
Please enable JavaScript!