i have fil1 with record length 260 and file2 with record length 200.requirement id to compare the records from both the files based on data in different position (like file1-1,10 and file2 111-10 should match).
if records are matching then write data from file2(1:191(191bytes from position 1)) and from file1(13:15) as a single record in output file kindly help me out..this is very much needed(ASAP).
here iam pasting the jcl i've written(i need icetool since dfsort's joinkey is not working here).
hi ,
thank you very much for your reply.
but the problem here is iam not understanding where is the comparision of data happening here?...u hv mentioned ON (261,10)..but with what?
anyhow i tried running jcl provided by u but the output file is empty.where there are records matching criteria.
In CTL1 and CTL2, I am copying key fields (which is to be matched) to position 261,10. That's the reason for splicing on 261,10. There was a small mistake in previously posted control card. I've used file2 in place of file1. Corrected control cards as below:
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
bhavya_sha,
Showing a job you wrote that doesn't work without telling us clearly what you want to do does not help us help you.
You need to step back and describe what you want to do with a good example of input and expected output. Specifically:
Please show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.
File1 is with record length 260.
File2 is with record length 200.
Outputfile is of record length 250.
Requirement is to compare the data i.e,
data @ position 1-10 from file1 should match with data at position 111-10 in file2 and entire record need not match.
if data is matching then write data i.e, 1-191 bytes from file2(to 1-191 bytes in outputfile) and data from
13th position to 15 bytes from file1(to 192-197 in outputfile) as a single record in to output file .
Duplicates doesn't matter they can be present @ any file.
Notepad is having data at proper position .since it was not clear in web site i've attached file.
EX:
Code:
FILE1:(1 record of length 260)
20211Z5271 TUBE ASSY-TAIL STKM A1 AB3751971218J1A960711 T2021009Z66 A2 AB3751 9609 2021009Z66 00AB375101
FILE2:(2 records of length 200)
0MKB210KHHB 1CH 10011U1681CB201C1U0 010001 20211Z5271 111QCG09123 20211Z5271 20211Z5271 01100111QCG09123 4370251 00020101G2 9 11112 MS31091217
20211Z5271 @ 111 position in file2 is matching with first 10 bytes in file1 hence output file is having first 191 bytes
from file2 and 192 onwards 15 bytes from file1.
file2 is having another record whose key is not having matching record in file1 hence the data from file2(1-192) is written
and position where data from file1 has to be picked is empty.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
FILE1:(1 record of length 260)
Does FILE1 really only have 1 record, or can it have more than one record?
Quote:
Duplicates doesn't matter they can be present @ any file.
Are you saying that input file1 can have duplicates within it and input file2 can have duplicates within it? If so, please show an example of input and expected output that covers all of those cases. Your download file doesn't work for me, so please send me a .txt file offline (yaeger@us.ibm.com) instead.
You're splicing with 271,200 which is suppose to be your file2's data. When there is a match, 271 to 200 bytes will come to file1 data, but which will still have '11' at 471 as you've not used 471st or 472nd bytes in splicing. Also, you're not using 'KEEPNODUPS'. Hence all unmatched records will be removed. As a result, after splicing only matched records will remain and which you're extracting using CTL3.
Try the following JCL to get matched/unmatched records and duplicates within file2. (Changes from your JCL are, modfied the WITH condition and included two new files).
Franks's question still remains as you've not confirmed on kind of duplicates...
how do i get the records in outputfile in the same order as that of file2(matching and nonmatching)
Note:
edited to lower case
please do not use all caps (UPPER CASE)(*)
using all caps is equivalent to shouting
it' s not our fault if You do not get the expected results
(*) not shouting, just showing the difference between lower and upper case :D
but for a record in FILE2 and not in file1 1-191 chars should be from file2 and 191onwards it has to be blank but with this job it's taking some data from file1 to fill in.
Could u pls clarify what does SS do here.It would be great if you can tell me what each value here in include does
INCLUDE=(251,2,SS,EQ,C'VB,VV'),
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
I'm having a hard time recreating your data and figuring out what you want for output. It would have helped if you'd shown an example of input and output with just the relevant fields.
I see I also had an error - WITH(251,9) should have been WITH(251,1). I've corrected that in the example above and in the new one here.
Try this DFSORT/ICETOOL job and see if it does what you want:
hi Frank & Lijo,
I am really sorry if i've troubled you guys . Thank you very much for your precious time and inpupts,
i got required result with below job.