View previous topic :: View next topic
|
Author |
Message |
krishnasaikiah
New User
Joined: 14 Mar 2007 Posts: 24 Location: gurgaon
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Use a sort /join, there are plenty of examples in the sort manuals and on this forum. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
krishnasaikiah
New User
Joined: 14 Mar 2007 Posts: 24 Location: gurgaon
|
|
|
|
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 |
|
|
ibmmainframesyntel
Active User
Joined: 26 Feb 2007 Posts: 126 Location: Chennai
|
|
|
|
could u explain the input files by giving example seperately and expected o/p |
|
Back to top |
|
|
krishnasaikiah
New User
Joined: 14 Mar 2007 Posts: 24 Location: gurgaon
|
|
|
|
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
krishnasaikiah
New User
Joined: 14 Mar 2007 Posts: 24 Location: gurgaon
|
|
|
|
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 |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
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 |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Krishna,
Remvoe the spaces and try running the job. |
|
Back to top |
|
|
ibmmainframesyntel
Active User
Joined: 26 Feb 2007 Posts: 126 Location: Chennai
|
|
|
|
Give a space before the SELECT statement.
//TOOLIN DD *
SELECT FROM (CON) TO (SORTOUT) ON (1,13,CH) FIRSTDUP
/* |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
ibmmainframesyntel,
Quote: |
Give a space before the SELECT statement. |
Not required. |
|
Back to top |
|
|
krishnasaikiah
New User
Joined: 14 Mar 2007 Posts: 24 Location: gurgaon
|
|
|
|
Thanks Murali , it is working.
thanks,
Krishna |
|
Back to top |
|
|
|