IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

need to add new fields to variable dataset using icetool


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Tue Aug 15, 2006 11:26 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Aug 15, 2006 11:40 pm
Reply with quote

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
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Tue Aug 15, 2006 11:56 pm
Reply with quote

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
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Wed Aug 16, 2006 12:18 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Aug 16, 2006 1:29 am
Reply with quote

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
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Wed Aug 16, 2006 1:34 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Aug 16, 2006 3:52 am
Reply with quote

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
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Wed Aug 16, 2006 6:19 pm
Reply with quote

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
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Aug 16, 2006 8:00 pm
Reply with quote

kalukakkad, please post the ENTIRE error messages with the error codes intact.
Back to top
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Wed Aug 16, 2006 8:08 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Aug 16, 2006 8:43 pm
Reply with quote

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
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Wed Aug 16, 2006 8:57 pm
Reply with quote

Thanks Frank for all the help u provided....
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Allocated cylinders of a dataset DB2 12
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top