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

write one output file from 2 innput files with the same key


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

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Thu Sep 24, 2009 11:18 pm
Reply with quote

hello everyone...i need help with icetool.
i have two input files with the same keys. In the output file I have to write ONLY the first part of the key (if at least some of the key changes).


ex.

file1
000000000000 2009/08/31 50
000000000001 2009/07/31 20
000000000002 2009/06/30 10
000000000003 2009/05/31 30


file2
000000000000 2009/08/31 50
000000000001 2009/08/31 20 date changed
000000000002 2009/06/30 30 changed the 3 part of the key(10->30)
000000000003 2009/05/31 30


fileout
000000000001
000000000002


i hope you understand!


thank you
icon_biggrin.gif
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 Sep 24, 2009 11:24 pm
Reply with quote

What is the RECFM and LRECL of each input file?

What is the starting position, length and format of each field?

Can input file1 have duplicates within it? Can input file2 have duplicates within it? If either file can have dups within it, show a better example of input and expected output with dups.
Back to top
View user's profile Send private message
theone1987

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Fri Sep 25, 2009 12:17 am
Reply with quote

I need only three fields of the entire records.

input file 1 (LRECL = 290 FB)
field1: from position 10 long 40 (char)
field2: from position 52 long 10 (char)
field3: from position 62 long 10 (zoned)
input file1 can't have duplicates within it

input file 2 (LRECL = 290 FB)
field1: from position 1 long 40 (char)
field2: from position 10 long 10 (char)
field3: from position 32 long 10 (zoned)
input file2 can't have duplicates within it
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 Sep 25, 2009 1:12 am
Reply with quote

Sigh. What does "10 long 40" mean? What is "long"? Does it mean 10-40, or starting position is 10 and length is 40? Or what?

For input file 2, does 10 long 10 overlap 1 long 40?

Please use standard, understandable notation like:

Positions 1-40 (char)

or

starting position 1 and length 40 (char)
Back to top
View user's profile Send private message
theone1987

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Fri Sep 25, 2009 1:17 am
Reply with quote

sorry!

I need only three fields of the entire records.

input file 1 (LRECL = 290 FB)
field1:starting position 10 and length 40 (char)
field2:starting position 52 and length 10 (char)
field3:starting position 62 and length 10 (zoned)
input file1 can't have duplicates within it

input file 2 (LRECL = 290 FB)
field1:starting position 1 and length 40 (char)
field2:starting position 10 and length 10 (char)
field3:starting position 32 and length 10 (zoned)
input file2 can't have duplicates within it

i hope is clear now!
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Sep 25, 2009 1:36 am
Reply with quote

Quote:

I need only three fields of the entire records.

input file 1 (LRECL = 290 FB)
field1:starting position 10 and length 40 (char)
field2:starting position 52 and length 10 (char)
field3:starting position 62 and length 10 (zoned)
input file1 can't have duplicates within it

input file 2 (LRECL = 290 FB)
field1:starting position 1 and length 40 (char)
field2:starting position 10 and length 10 (char)
field3:starting position 32 and length 10 (zoned)
input file2 can't have duplicates within it


theone1987,

Arent the file 2 key values overlapping each other (field 2 and field 3 overlap field 1)? (highlighted in bold) . How can you compare the first file key of 40 bytes with file2 ?
Back to top
View user's profile Send private message
theone1987

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Fri Sep 25, 2009 2:09 am
Reply with quote

Skolusu wrote:
Quote:

I need only three fields of the entire records.

input file 1 (LRECL = 290 FB)
field1:starting position 10 and length 40 (char)
field2:starting position 52 and length 10 (char)
field3:starting position 62 and length 10 (zoned)
input file1 can't have duplicates within it

input file 2 (LRECL = 290 FB)
field1:starting position 1 and length 40 (char)
field2:starting position 10 and length 10 (char)
field3:starting position 32 and length 10 (zoned)
input file2 can't have duplicates within it


theone1987,
Arent the file 2 key values overlapping each other (field 2 and field 3 overlap field 1)? (highlighted in bold) . How can you compare the first file key of 40 bytes with file2 ?




sorry again,
input file 2 (LRECL = 290 FB)
field1:starting position 1 and length 40 (char)
field2:starting position 42 and length 10 (char)
field3:starting position 53 and length 10 (zoned)
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 Sep 25, 2009 3:11 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=*
//CON DD DSN=...  input file1 (FB/290)
//    DD DSN=...  input file2 (FB/290)
//OUT DD DSN=...  output file (FB/40)
//TOOLIN DD *
SELECT FROM(CON) TO(OUT) ON(1,40,CH) ON(41,10,CH) ON(51,10,ZD) -
  NODUPS USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=(56,1,CH,EQ,C'/'),
    BUILD=(1:10,40,41:52,10,51:62,10,61:C'1')),
   IFTHEN=(WHEN=NONE,
    BUILD=(1:1,40,41:42,10,51:53,10,61:C'2'))
  OUTFIL FNAMES=OUT,INCLUDE=(61,1,CH,EQ,C'1'),BUILD=(1,40)
/*
Back to top
View user's profile Send private message
theone1987

New User


Joined: 14 Sep 2009
Posts: 60
Location: Milan

PostPosted: Fri Sep 25, 2009 12:41 pm
Reply with quote

THANK YOU VERY MUCH!
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 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
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top