View previous topic :: View next topic
Author
Message
kalukakkad New User Joined: 10 Mar 2005Posts: 81
I need to extract 2 fields from file1 and add these two to file2 if the key matches,how can i do this using icetool
File1-variable length-28
field-11
field-12
field-13
field-14
File2-variable length-110
field-21
field-22
field-23...till
field-29
now i need to add field-13 and field-14 from File1 to File2 so that the output file length = length of File2 + length(Field-13+field-14)
how can i use ICETOOL to accomplish this.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
You need to give more details.
What is the starting position, length and format of each field in file1, file2 and the output file? Remember that the RDW is in positions 1-4 and the first data byte starts in position 5.
What is the starting position, length and format of the key you want to match on in file1 and in file2?
Where exactly do you want to insert the fields in the output record?
Are all of the VB records in file1 the same length or do the lengths vary?
Are all of the VB records in file2 the same length or do the lengths vary?
It would help if you showed an example of the records in each input file and the expected output records.
Back to top
kalukakkad New User Joined: 10 Mar 2005Posts: 81
Code:
01 WS-FILE1.
05 FILE1-LENGTH PIC 9(04) COMP.
05 FILLER PIC X(02).
05 FIELD-11 PIC X(03).
05 FILLER PIC X(01).
05 FIELD-12 PIC S9(13)V9(02) COMP-3.
05 FIELD-13 PIC S9(13)V9(02) COMP-3.
05 FIELD-14 PIC S9(13)V9(02) COMP-3.
05 FIELD-15 PIC S9(13)V9(02) COMP-3.
05 FIELD-16 PIC X(01).
05 FILLER PIC X(03).
05 FIELD-17 PIC X(03).
05 FILLER PIC X(01).
05 FIELD-18 PIC S9(13)V9(02) COMP-3.
05 FIELD-19 PIC S9(13)V9(02) COMP-3.
05 FIELD-20 PIC S9(13)V9(02) COMP-3.
05 FIELD-21 PIC S9(13)V9(02) COMP-3.
05 FIELD-22 PIC S9(13)V9(02) COMP-3.
05 FIELD-23 PIC S9(09)V9(08) COMP-3.
05 FIELD-24 PIC S9(09)V9(08) COMP-3.
FIELD-17 -- KEY FOR FILE1
Code:
01 WS-FILE2.
05 FILE2-LENGTH PIC 9(04) COMP.
05 FILLER PIC X(02).
05 FIELD-91 PIC X(03).
05 FILLER PIC X(01).
05 FIELD-92 PIC S9(13)V9(02) COMP-3.
05 FIELD-93 PIC S9(13)V9(02) COMP-3.
05 FIELD-94 PIC X(01).
05 FILLER PIC X(03).
FIELD-91 -- KEY FOR FILE2
now, i need to compare FIELD-91 and FIELD-17, if same, need to add the fields FIELD-92,FIELD-93 from FILE2 to FILE-1.
e.g
FILE-1
XYZ +12345.00 +2345.00 +334.00 +5678.00 AAA....
kkk +12345.00 +2345.00 +334.00 +5678.00 AAA....
FILE-2
AAA +9999.99 +8888.88....
OUTPUT FILE
XYZ +12345.00 +2345.00 +334.00 +5678.00 AAA....+9999.99 +8888.88
kkk +12345.00 +2345.00 +334.00 +5678.00 AAA....+9999.99 +8888.88
the '+' indicates COMP-3 values
Back to top
kalukakkad New User Joined: 10 Mar 2005Posts: 81
I tried with this:
Code:
//STEP01 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=FILE-1,
// DISP=SHR
//IN2 DD DSN=FILE-2,
// DISP=SHR
//OUT11 DD DSN=OUT-FILE,
// SPACE=(TRK,(10,10),RLSE),
// DISP=(NEW,CATLG,DELETE)
//T1 DD DSN=&&TEMP,DISP=(MOD,PASS),
// SPACE=(TRK,(10,10),RLSE)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT11) ON(41,3,CH) WITHALL -
WITH(107,16) USING(CTL3)
/*
//CTL1CNTL DD *
OUTREC FIELDS=(1:5,40,
41:45,3,
44:48,59,
107:16X),CONVERT
/*
//CTL2CNTL DD *
OUTREC FIELDS=(1:40X,
41:5,3,
44:63X,
107:9,16),CONVERT
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT11,FTOV,OUTREC=(1,122)
/*
But i am getting output as
XYZ +12345.00 +2345.00 +334.00 +5678.00 AAA....00000
XYZ +12345.00 +2345.00 +334.00 +5678.00 AAA....00000
The record KKK is missing and XYZ is repeated...
The key is 'AAA'
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
It appears that file1 has duplicate keys within it - right (AAA in both records)?
It appears that file2 does NOT have duplicate keys within it - right? If file2 can have duplicate keys within it, then show an example of input and output for that case.
Based on your COBOL layouts, the DFSORT position and lengths are as follows:
Code:
Pos Len 01 WS-FILE1.
1 2 05 FILE1-LENGTH PIC 9(04) COMP.
3 2 05 FILLER PIC X(02).
5 3 05 FIELD-11 PIC X(03).
8 1 05 FILLER PIC X(01).
9 8 05 FIELD-12 PIC S9(13)V9(02) COMP-3.
17 8 05 FIELD-13 PIC S9(13)V9(02) COMP-3.
25 8 05 FIELD-14 PIC S9(13)V9(02) COMP-3.
33 8 05 FIELD-15 PIC S9(13)V9(02) COMP-3.
41 1 05 FIELD-16 PIC X(01).
42 3 05 FILLER PIC X(03).
45 3 05 FIELD-17 PIC X(03). *
48 1 05 FILLER PIC X(01).
49 8 05 FIELD-18 PIC S9(13)V9(02) COMP-3.
57 8 05 FIELD-19 PIC S9(13)V9(02) COMP-3.
65 8 05 FIELD-20 PIC S9(13)V9(02) COMP-3.
73 8 05 FIELD-21 PIC S9(13)V9(02) COMP-3.
81 8 05 FIELD-22 PIC S9(13)V9(02) COMP-3.
89 9 05 FIELD-23 PIC S9(09)V9(08) COMP-3.
98 9 05 FIELD-24 PIC S9(09)V9(08) COMP-3.
Total length = 106
FIELD-17 -- KEY FOR FILE1 -> 45,3
Pos Len 01 WS-FILE2.
1 2 05 FILE2-LENGTH PIC 9(04) COMP.
3 2 05 FILLER PIC X(02).
5 3 05 FIELD-91 PIC X(03). *
8 1 05 FILLER PIC X(01).
9 8 05 FIELD-92 PIC S9(13)V9(02) COMP-3.
17 8 05 FIELD-93 PIC S9(13)V9(02) COMP-3.
25 1 05 FIELD-94 PIC X(01).
26 3 05 FILLER PIC X(03).
Total length = 28
FIELD-91 -- KEY FOR FILE2 -> 5,3
And for matching keys, you want the output to contain positions 1-106 from the file1 record followed by positions 9-24 from the file2 record - right?
Back to top
kalukakkad New User Joined: 10 Mar 2005Posts: 81
File-1 has duplicate keys
File-2 does not have duplicate keys
Yes, the output should have 1-106 from File-1 and 9-24 from File-2
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
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 (VB)
//IN2 DD DSN=... input file2 (VB)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file (VB)
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(47,3,BI) KEEPNODUPS -
WITHALL WITH(6,103) USING(CTL3)
/*
//CTL1CNTL DD *
OUTREC BUILD=(1,4,C'BB',47:5,3,109:9,16)
/*
//CTL2CNTL DD *
OUTREC BUILD=(1,4,C'VV',5,102,124:X)
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(5,2,CH,EQ,C'BV'),
BUILD=(1,4,7)
/*
Back to top
kalukakkad New User Joined: 10 Mar 2005Posts: 81
i am getting syntax error in OUTREC
Error description in DFSMSG
CTL1CNTL :
OUTREC BUILD=(1,4,C'BB',47:5,3,109:9,16)
*
OUTREC STATEMENT : SYNTAX ERROR
Error description in JESMSGLG
STEP01 , -OUTREC STATEMENT : SYNTAX ERROR
STEP01 - ABEND=S000 U0016 REASON=00000000
Back to top
superk Global Moderator Joined: 26 Apr 2004Posts: 4652 Location: Raleigh, NC, USA
kalukakkad, please post the ENTIRE error messages with the error codes intact.
Back to top
kalukakkad New User Joined: 10 Mar 2005Posts: 81
PARMEXIT : SIZE=MAX-64K
CTL1CNTL :
OUTREC BUILD=(1,4,C'BB',47:5,3,109:9,16)
*
WER428I CALLER-PROVIDED IDENTIFIER IS "0001"
WER161B ALTERNATE PARM USED
WER268A OUTREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
kalukakkad,
The WER messages indicate you're using Syncsort, not DFSORT. The job works fine with DFSORT.
I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.
Back to top
kalukakkad New User Joined: 10 Mar 2005Posts: 81
Thanks Frank for all the help u provided....
Back to top
Please enable JavaScript!