Hi
I have two files file 1 & file 2. File 1 has fields fd1,fd2 & fd3...fdn. File 2
has fields fd1,fd2,fd3,d4,d5.
Now, i have to compare whether
fd1(of file1) = fd1(file2) &
fd2(of file1) = fd2(file2) &
fd3(of file1) = fd3(file2)
If the above fields are equal, then i need to write the fields d4 & d5 into another file. Could any one of you please help me how to do this with SORT?
JCL is giving me error 'FIELD BEYOND MAXIMUM RECORD LENGTH'
Requirement:
--------------
TEST1 file contains customer number at 43(of length 10),Date at 65(of length 8), part no at 94(of length 5)
TEST1 file contains customer number at 48(of length 10),Date at 103(of length 8), part no at 58(of length 5)
if each of these fields are equal, then i need to extract
Code:
parameter 1 at 73(of length 10) from file 2,
parameter 2 at 83(of length 10) from file 2,
parameter 3 at 93(of length 10) from file 2,
then append the parameters to the output file from position 169, 179, & 189 respectively.
The contents of file1 from 1st position to 168 position should be copied as it is to the output file
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Your REFORMAT record is 30 bytes long.
What do you think INCLUDE=(1,168,anything after that) is going to do?
What are you trying to do with that?
I don't think you understand the REFORMAT. This is the layout of the record produced by the JOINKEYS. Forget any layout which existed for the JOINKEYS, this is what you extract from the matched/unmatched records.
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
Including fields from File1 was not in your original request - you only specified fd4 and fd5 to be output. What you now seem to want is to take 1,168 from File1 followed by 3 (not 2) fields from F2.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
mal_pra007 wrote:
The contents of file1 from 1st position to 168 position should be copied as it is to the output file
mal_pra007,
You need to tell us what you want clearly. Your initial post indicated that you wanted to extract just filed4 and Field5. If you want to copy the contents of file1 also you need to change your REFORMAT statement. Garry Carroll has provided you the syntax. Since your extract fields are continuous, you can club them as single field and code as 73,30
Code:
REFORMAT FIELDS=(F1:1,168,F2:73,30)
You need to get rid off the OUTFIL statement. You really don't need that anymore.
Thanks for your advise. Sorry for not giving you clear picture in my initial requirement.
As i mentioned earlier, i need to
compare the fields file1.field1, file1.field2, file1.field3 with file2.field1, file2.field2, file2.field3
If the fields are equal, then i need to write from 1 to 168 characters from file 1 & 30 characters from file 2 starting at 73 into a new file file3
How about you run the job and tell us what happened, whether you got the right results or not?
You are only creating 168+30 =198 bytes , why do you have LRECL=250 in your JCL? If you want to create a 250 byte file by padding spaces at the end then add the following to your control cards.
Code:
INREC OVERLAY=(250:X)
Remove the DCB parameters from JCL . SORT will automatically calculate the DCB.