Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Consolidate two files into a single file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Consolidate two files into a single file
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: 3158
Location: Tucson AZ

PostPosted: Fri Jul 13, 2007 6:57 pm    Post subject:
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 Moderator


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

PostPosted: Fri Jul 13, 2007 8:44 pm    Post subject:
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    Post subject:
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    Post subject: Re: Consolidate two files into a single file
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Mon Jul 16, 2007 9:06 pm    Post subject:
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    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Tue Jul 17, 2007 2:43 pm    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Tue Jul 17, 2007 3:28 pm    Post subject:
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    Post subject: Re: Consolidate two files into a single file
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: 1439
Location: Bangalore,India

PostPosted: Tue Jul 17, 2007 4:17 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us