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

Consolidate two files into a single file


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

New User


Joined: 14 Mar 2007
Posts: 24
Location: gurgaon

PostPosted: Fri Jul 13, 2007 5:00 pm
Reply with quote

I need to write one file from two files ie i need to write the common names between the two input files into a single file.

Thanks,
Krishna
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Jul 13, 2007 6:57 pm
Reply with quote

Use a sort /join, there are plenty of examples in the sort manuals and on this forum.
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 Jul 13, 2007 8:44 pm
Reply with quote

Krishna,

Please show an example of the records in your input files (relevant fields only) and the expected output records. If input file1 can have duplicates within it, show that in your example. If input file2 can have duplicates within it, show that in your example. Give the RECFM and LRECL of the input files. Give the starting position, length and format of the relevant fields.
Back to top
View user's profile Send private message
krishnasaikiah

New User


Joined: 14 Mar 2007
Posts: 24
Location: gurgaon

PostPosted: Mon Jul 16, 2007 9:49 am
Reply with quote

My input files look like this...i wont have duplicates in my input files...both the input files are exactly alike.

First input file 2nd input file

KAO 0
ARN007KAO 1
JFK185HKG
ACH334CCU 1
ACH337CCU 1
XRN128CCU 2
SKY308KND 1


LRECL = 100 for both
RECFM= FB for both
Starting position will be 1.
And the length will be char (3) and then char (3) and then char (6) and the last one will be smallint.

Thanks,
Krishna
Back to top
View user's profile Send private message
ibmmainframesyntel

Active User


Joined: 26 Feb 2007
Posts: 126
Location: Chennai

PostPosted: Mon Jul 16, 2007 10:24 am
Reply with quote

could u explain the input files by giving example seperately and expected o/p
Back to top
View user's profile Send private message
krishnasaikiah

New User


Joined: 14 Mar 2007
Posts: 24
Location: gurgaon

PostPosted: Mon Jul 16, 2007 12:11 pm
Reply with quote

Ya.
My first input file looks like this....both the files are exactly the same

ACH007CCU 1
KAS032HKG 1
JFK044CCU 1

2nd input file will be like this suppose

ACH007CCU 1
JFK044CCU 1
HGF052SIN 2

So my desired output should look like

ACH007CCU 1
JFK044CCU 1

My input files are not sorted.

Thanks,
Krishna
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Jul 16, 2007 1:21 pm
Reply with quote

krishnasaikiah
Here you go...
Code:
//*******************************************************               
//GETMATCH EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD *                                                         
ACH007CCU 1                                                             
KAS032HKG 1                                                             
JFK044CCU 1                                                             
/*                                                                     
//IN2      DD *                                                         
ACH007CCU 1                                                             
JFK044CCU 1                                                             
HGF052SIN 2                                                             
/*                                                                     
//TMP1     DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA 
//OUT      DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
   COPY FROM(IN1) TO(TMP1)                                             
   COPY FROM(IN2) TO(TMP1)                                             
         SELECT FROM(TMP1) TO(OUT) ON(1,3,CH) FIRSTDUP USING(COP3)     
/*                                                                     
//COP3CNTL DD *                                                         
   OUTREC BUILD=(1,80)                                                 
/*                                                                     
//*                                                                     

OUT
Code:
----+----1----+
ACH007CCU 1   
JFK044CCU 1 
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: Mon Jul 16, 2007 9:06 pm
Reply with quote

Krisprems's "solution" is inefficient and unnecessarily complicated. Here's a simpler, more efficient DFSORT/ICETOOL solution using concatenated input.

Code:

//GETMATCH EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//CON DD DSN=...   input file1                                                       
//    DD  DSN=...  input file2                                                         
//OUT      DD DSN=...  output file                                                 
//TOOLIN   DD *                                                         
SELECT FROM(CON) TO(OUT) ON(1,3,CH) FIRSTDUP       
/*               
Back to top
View user's profile Send private message
krishnasaikiah

New User


Joined: 14 Mar 2007
Posts: 24
Location: gurgaon

PostPosted: Tue Jul 17, 2007 2:31 pm
Reply with quote

Frank I tried the following code but its showing me an error...which i am unable to make out...


Code:
//PS010   EXEC PGM=ICETOOL                                 
//TOOLMSG  DD SYSOUT=*                                   
//DFSMSG    DD SYSOUT=*                                   
//CON          DD DSN=APASPUB.TAS.TSWPBC66.WPCOST,           
//                      DISP=SHR                                   
//                DD DSN=APASPUB.TAS.TSWPBC66.WPREV,             
//                      DISP=SHR                                   
//SORTOUT  DD DSN=APASPUB.TAS.TSWPBC66.SORTOUT,           
//                      DISP=SHR,                                   
//                      UNIT=(SYSDA,30),SPACE=(CYL,(200,200),RLSE),
//                       DCB=(RECFM=FB,LRECL=100,BLKSIZE=0)         
//TOOLIN     DD *                                           
SELECT FROM (CON) TO (SORTOUT) ON (1,13,CH) FIRSTDUP       
/* 

The spool is showing these statements and a return code of 12.

[color=orange]
Code:
ICE600I 0 DFSORT ICETOOL UTILITY RUN STARTED                     
                                                                 
ICE632I 0 SOURCE FOR ICETOOL STATEMENTS:  TOOLIN                 
                                                                 
                                                                 
ICE630I 0 MODE IN EFFECT:  STOP                                 
                                                                 
          SELECT FROM (CON) TO (SORTOUT) ON (1,13,CH) FIRSTDUPS 
                     $                                           
ICE604A 0 ERROR IN KEYWORD, PARAMETER, OR DELIMITER             
ICE602I 0 OPERATION RETURN CODE:  12       [/color]                     
                                                                 
                                                                 
ICE601I 0 DFSORT ICETOOL UTILITY RUN ENDED - RETURN CODE:  12   


Thanks,
Krishna
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Jul 17, 2007 2:43 pm
Reply with quote

Krishna,

Quote:
SELECT FROM (CON) TO (SORTOUT) ON (1,13,CH) FIRSTDUP


I see spaces between FROM (CON), TO (SORTOUT) & ON (1,13,CH). Is it a typo error? If not, remove the spaces
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Jul 17, 2007 3:28 pm
Reply with quote

Krishna,

Remvoe the spaces and try running the job.
Back to top
View user's profile Send private message
ibmmainframesyntel

Active User


Joined: 26 Feb 2007
Posts: 126
Location: Chennai

PostPosted: Tue Jul 17, 2007 3:57 pm
Reply with quote

Give a space before the SELECT statement.

//TOOLIN DD *
SELECT FROM (CON) TO (SORTOUT) ON (1,13,CH) FIRSTDUP
/*
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Jul 17, 2007 4:17 pm
Reply with quote

ibmmainframesyntel,
Quote:
Give a space before the SELECT statement.

Not required.
Back to top
View user's profile Send private message
krishnasaikiah

New User


Joined: 14 Mar 2007
Posts: 24
Location: gurgaon

PostPosted: Tue Jul 17, 2007 4:34 pm
Reply with quote

Thanks Murali , it is working.

thanks,
Krishna
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