|
View previous topic :: View next topic
|
| Author |
Message |
rguhanath
New User

Joined: 16 Oct 2006 Posts: 81 Location: chennai
|
|
|
|
I have two input files F1 (LRECL = 100) and F2 (LRECL = 80) and have one output file OF1 (LRECL = 100). All three are FB.
Input file 1 : F1
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
ABC ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
ABC ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
ABC ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
ABC ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
DEF ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
DEF ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
GHI ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
JKL ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
JKL ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
MNO ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
MNO ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
|
Input file 2 : F2
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
ABC 123 ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
DEF 456 ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
RST 631 ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
JKL 654 ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
XYZ 854 ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
|
Output file : OF1
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
ABC ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------ 123
ABC ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------ 123
ABC ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------ 123
ABC ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------ 123
DEF ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------ 456
DEF ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------ 456
GHI ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
JKL ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------ 654
JKL ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------ 654
MNO ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
MNO ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
|
Output file OF1 should include the corresponding numbers from F2 file after 55th location of F1. In F1 file, we have SPACES after 55th location.
Regards,
Nath. |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
rguhanath,
What's the matching key on both the files? First 3 bytes? Is it possible to have duplicates in File1 or File2 for the key?
Thanks, |
|
| Back to top |
|
 |
rguhanath
New User

Joined: 16 Oct 2006 Posts: 81 Location: chennai
|
|
|
|
Hi sqlcode1,
Yes, First 3 bytes are the matching key for F1 and F2. In this F1 having duplicates and F2 having the unique values for the first 3 bytes.
Thanks,
Nath. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
rguhanath,
Looking back at your previous posts, I am assuming you don't have new PTF for joinkeys installed.
See if below jcl works for you...
| Code: |
//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=YOUR FB80 FILE
//SORTOUT DD DSN=&&T1,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(56:6,3,100:X)
OUTFIL REMOVECC,HEADER1=(3C'$'),
TRAILER1=(3C'$')
//*
//STEP02 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&T1,DISP=SHR,VOL=REF=*.STEP01.SORTOUT
// DD DISP=SHR,DSN=YOUR FB100 FILE
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'$$$'),
PUSH=(101:ID=1))
SORT FIELDS=(1,3,CH,A),EQUALS
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(102:SEQNUM,8,ZD,RESTART=(1,3))),
IFTHEN=(WHEN=GROUP,BEGIN=(102,8,ZD,EQ,1),PUSH=(111:56,3))
OUTFIL INCLUDE=(101,1,ZD,EQ,2,AND,1,3,CH,NE,C'$$$'),
BUILD=(1,55,111,3,59,42)
//*
|
OUTPUT
| Code: |
ABC ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------123
ABC ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------123
ABC ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------123
ABC ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------123
DEF ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------456
DEF ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------456
GHI ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
JKL ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------654
JKL ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------654
MNO ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------
MNO ------SOME DATA WHICH IS UNIQUE OR NON-UNIQUE------ |
Thanks, |
|
| Back to top |
|
 |
rguhanath
New User

Joined: 16 Oct 2006 Posts: 81 Location: chennai
|
|
|
|
Hi sqlcode,
Many Thanks to you!!!... its working fine... Thanks for remembering my previous posts.
Regards,
Nath. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|