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

Icetool : Overlay field in file with field from another file


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

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Wed Mar 08, 2006 9:32 pm
Reply with quote

Firstly I have searched extensively for an answer but could not find one. My problem is, I have two files : File1 - Key sequential and File2 - Relative Record. What I need to do is this (1). Build a key from file2 to read File 1
(2). Compare two fields one in File1 and the other in File2 with each other.
If the fields differ I need to overlay the field in File2 with the value
of the field in File1.
If the fields are the same, ignore.
(3). The key from File2 is not unique, there are duplicates.
(4). The key in File1 will always be in File2 also.

Any thoughts? Thanks.
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 Mar 08, 2006 10:04 pm
Reply with quote

Please show an example of the input records in each file and what you want for the output records. Are the records in VSAM input file1 variable length or fixed length - give the maximum length. Are the records in VSAM input file2 variable length or fixed length - give the maximum length. What is the starting position, length and format of the key and any other relevant fields in input file1 and the key and any other relevant fields in input file2? You talk about a key and compare fields ... is the key field the same as the compare field, or are they two different fields?
Back to top
View user's profile Send private message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Thu Mar 09, 2006 1:04 pm
Reply with quote

Hi Frank.

File1 :Fixed length, Key sequential, Record length = 1980, Key starting position = 1, Length = 11.

Input example:

Code:

key           fld1 fld2  fld3
------------  ---- ----- -----
1234567 8901  ABCD 12345 aaaaa


File2 :Fixed length, Relative Record, Record length = 3780, Fld1 starts at position 1 in record, Key is record number as you know.

Input example:

Code:

fld1        fld2 fld3  fld4   
----------- ---- ----- -----
1234567bbbb 8901 aaaaa 11111
1234567cccc 8901 aaaaa 54321


These are the most significant fields in the files. I hope I can explain my problem better this time 'round.
(1). I want to build a key from File2. It will be concatenated from the first 7 characters in fld 1 and the 4 characters from fld2.
(2). I want to use this key to read File1.
(3). When I find the record in File1, I want to compare File1(fld2) with File2(fld4). If The fields are the same ignore, else if the fields are different I want to overlay File2(fld4) with the value of File1(fld2).

I really hope it's clearer now Frank.
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: Thu Mar 09, 2006 9:31 pm
Reply with quote

No, it's still not clear. Would the output file have all of the file2 records with some of the fld4 values overlayed, or would it be something else? You need to show more records for each input file and what you expect for the output records. If either file can have duplicates within it, show that in your example of input and output.

Also, for File1 you say the key is 11 bytes, but you show

Code:

1234567 8901 


which is 12 bytes. Is the space really not there or what?
Back to top
View user's profile Send private message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Fri Mar 10, 2006 12:23 pm
Reply with quote

Hi Frank

I'll try to treat each of your concerns separately.

(1). Yes the output file must have all the File2 records.
(2). Yes only the File2(fld4) values that are different from the File1(fld2) values must be overlayed with the value from File1(fld2).
(3). The File2(fld4) values that are the same as the File1(fld2) values must remain unchanged.
(4). File1 does not have duplicate keys because as I said it is a Key Sequential file.
(5). The key that is being build from File2 does have duplicates.
(6). My apologies regarding File1's key, it is without the space so it is 11 bytes.

Extended version of File1:

Code:

key          fld1 fld2  fld3
------------ ---- ----- -----
12345678901  ABCD 12345 aaaaa 
12345678911  ABCD 32451 aaaaa
23456789211  ABCD 11111 aaaaa


Extended version of File2.

Code:


fld1        fld2 fld3  fld4   
----------- ---- ----- -----
1234567bbbb 8901 aaaaa 11111
1234567cccc 8901 aaaaa 54321 
1234567eeee 8911 aaaaa 11111
2345678dddd 9211 aaaaa 54321 


Required output must be :

Code:

fld1        fld2 fld3  fld4   
----------- ---- ----- -----
1234567bbbb 8901 aaaaa 12345
1234567cccc 8901 aaaaa 12345 
1234567eeee 8911 aaaaa 32451
2345678dddd 9211 aaaaa 11111 
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: Fri Mar 10, 2006 11:43 pm
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 (F/1980)
//IN2 DD DSN=...  input file2 (F/3780)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (F/3780)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1) VSAMTYPE(F)
COPY FROM(IN2) TO(T1) USING(CTL2) VSAMTYPE(F)
SPLICE FROM(T1) TO(OUT) ON(1,7,CH) ON(13,4,CH) -
  KEEPNODUPS WITHALL WITH(1,23) WITH(29,3752) WITH(3781,1) -
  USING(CTL3)
/*
//CTL1CNTL DD *
  OUTREC FIELDS=(1,7,13:8,4,24:19,5,3781:C'11')
/*
//CTL2CNTL DD *
  OUTREC OVERLAY=(3781:C'22')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,OMIT=(3781,2,CH,EQ,C'11'),
    OUTREC=(1,3780)
/*
Back to top
View user's profile Send private message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Wed Mar 15, 2006 1:38 am
Reply with quote

Thanx a million Frank, I'll take it from here. As always your efforts are deeply appreciated.
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 Mar 15, 2006 1:57 am
Reply with quote

Glad I could help.
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 FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top