There are two files (VB) - source file and control file, which record length could be different for every run of required job. The position of the key for every file is known and permanent (source file - 4 chars in position 28 + 3 chars in position 46, control file - 7 chars in position 1). Both files can contain duplicate keys.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
You don't need 9 passes over the data to do what you want.
I've removed your job so nobody will try to copy it.
You can do what you want in 3 passes with a DFSORT/ICETOOL job like the following. I assumed your input file2 has LRECL=100, but the job can be changed appropriately for different LRECLs.
1. I'm afraid that you mixed up IN1(source file) and IN2(control file) writing the COPY... Also there should be INREC BUILD=(1,4,5:C'BB',32:5,4,50:9,3) as the key starts at 28(len=4) and 46(len=3).
2. I'm getting
ICE218A 6 5 BYTE VARIABLE RECORD IS SHORTER THAN 11 BYTE MINIMUM FOR FIELDS
even if I add OPTION VLSCMP,VLSHRT. Just adding of INCLUDE CONDITION to CTL1CNTL lets to get out of this error.
3. This is the start of T1:
Code:
********************************* Top of Data **********************************
BB H QM F 1
BB V 1 001
BB V 1 002
BB T 1 010
BB R C
..............................................
source file:
Code:
********************************* Top of Data **********************************
H QMF 14 R 01 E V W E R 02 03 08/01/10 10:43
V 1001 006 PERIOD
V 1002 003 016
T 1010 018 006 1013 005 1014 006 1015 006 1016 006 1017 006 1012 008
R C 000001 000003 000009 000001
..............................................
So the output files contains nothing valuable at all.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Sigh. You didn't say you had short records in input file1. I just went by your example which doesn't have short records. That makes a difference. It's not clear if you want these short records in OUT2. If you do, then adding OPTION VLSHRT to CTL3CNTL will take care of it. If you don't want the short records, then adding:
Code:
INCLUDE COND=(1,2,BI,GE,+52)
to CTL2CNTL will take care of it.
I assume you don't have any short records in input file2 ... right?
In the future, please show a more complete example of your input records.
1. No, I meant to have the input file2 records before the input file1 records in T1. The INRECs are correct too. We need to have the keys from both files in the same place.
3. For your original input example with the lengths I used for testing, T1 will have:
Thank you very much, Frank. I was confused, because I did not clearly understand what is input file1 and input file2 and mixed them up. The job works perfectly and three phases are better than nine for sure .
Wrt the short records in input file1. I haven't mentioned this case because for me the customer definition "file is VB" is equal to "the records could have any length" (it happens every time!) and I have to make my jobs more universal. Actually this file is not under our control, it is a report that comes to our system and it's possible to have absolutely anything inside. I have just one short copy as an example, but nobody can be firmly convinced that the short lines will not appear there in the future. Definitely I'll be more accurate with definitions on the forum from now.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
I don't understand what you're asking. If you want to sort a file, you need to supply a SORT statement to indicate the field(s) you want to sort on. Otherwise, how would DFSORT know which fields those are (by reading your mind?).
You don't have to use ICETOOL to do a SORT - you can do it directly with DFSORT, e.g.
I've asked taking into account a job above, in other case I would open another topic. There are 2 output files there - OUT1 and OUT2 as a result of SPLICE operation. As I understood from the doc it's not possible to use SORT FIELDS in xxxxCNTL card related to SPLICE, correct?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Yes, that's correct. SPLICE does a sort using the ON field(s). So if you have:
SPLICE FROM(T1) TO(OUT1) ON(34,4,CH) ...
SPLICE will do a sort on 34,4,CH,A. You can't override that with a SORT statement for 10,16,CH,A since that would put the records in the wrong order for splicing.