Page 1 of 1

Create upto n x m records from Input files N and M

Posted: Sat Dec 27, 2008 12:57 pm
by Rajesh Kumar Sakthivel
Hi,

I have 2 input files anf File N has 'n' records and File '2' has 'm' records.

LRECL is 20 for both files.

FILE N

Code: Select all

xxxxxxxxkey1
xxxxxxxxkey1
yyyyyyyykey1
uuuuuuuukey1
xxxxxxxxkey2
yyyyyyyykey2
FILE M

Code: Select all

        key1dat1
        key1dat2
        key1dat3
        key1dat4
        key1dat5
        key1dat6
        key2dat7
        key2dat8
        key2dat9
Expected Output file

Code: Select all

xxxxxxxxkey1dat1
xxxxxxxxkey1dat2
xxxxxxxxkey1dat3
xxxxxxxxkey1dat4
xxxxxxxxkey1dat5
xxxxxxxxkey1dat6
xxxxxxxxkey1dat1
xxxxxxxxkey1dat2
xxxxxxxxkey1dat3
xxxxxxxxkey1dat4
xxxxxxxxkey1dat5
xxxxxxxxkey1dat6
yyyyyyyykey1dat1
yyyyyyyykey1dat2
yyyyyyyykey1dat3
yyyyyyyykey1dat4
yyyyyyyykey1dat5
yyyyyyyykey1dat6
uuuuuuuukey1dat1
uuuuuuuukey1dat2
uuuuuuuukey1dat3
uuuuuuuukey1dat4
uuuuuuuukey1dat5
uuuuuuuukey1dat6
xxxxxxxxkey2dat7
xxxxxxxxkey2dat8
xxxxxxxxkey2dat9
yyyyyyyykey2dat7
yyyyyyyykey2dat8
yyyyyyyykey2dat9
If there is only one Key value (say key1) is present in both the files, the max number of records expected is n x m.
I don't have maximum limit for the number records in each file as they change on a daily base.

Is this possible using ICETOOL? :?: Please Help.

Thanks in advance.
Rajesh

ICETOOL help

Posted: Sun Dec 28, 2008 11:13 am
by Natarajan
It needs control to be passed back in file2 multiple times. i suggest to write a Easytrieve program / cobol program instead of using any tools.

Anyway, Let us wait for comments from Frank - ICETOOL guru.

Posted: Sun Dec 28, 2008 9:24 pm
by Frank Yaeger
That's a cartesian join. DFSORT/ICETOOL doesn't have any built-in functions to do that.

Posted: Mon Dec 29, 2008 1:09 am
by Rajesh Kumar Sakthivel
Thanks Frank. I will manage this with SELCOPY.

Posted: Tue Nov 17, 2009 5:52 am
by Frank Yaeger
With z/OS DFSORT V1R5 PTF UK51706 or z/OS DFSORT V1R10 PTF UK51707 (Nov, 2009), you can do this with the new JOINKEYS function. Here's the DFSORT job:

Code: Select all

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//FILEN DD DSN=...  input filen  (FB/20)
//FILEM DD DSN=...  input filem  (FB/20)
//SORTOUT DD DSN=...  output file (FB/20)
//SYSIN    DD    *
  JOINKEYS F1=FILEN,FIELDS=(9,4,A)
  JOINKEYS F2=FILEM,FIELDS=(9,4,A)
  REFORMAT FIELDS=(F1:1,12,F2:13,8)
  OPTION COPY
/*
If you prefer to use DFSORT's ICETOOL, here's an equivalent ICETOOL job:

Code: Select all

//S2    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYSOUT    DD  SYSOUT=*
//FILEN DD DSN=...  input filen  (FB/20)
//FILEM DD DSN=...  input filem  (FB/20)
//OUT DD DSN=...  output file (FB/20)
//TOOLIN   DD    *
COPY JKFROM TO(OUT) USING(CTL1)
/*
//CTL1CNTL DD *
  JOINKEYS F1=FILEN,FIELDS=(9,4,A)
  JOINKEYS F2=FILEM,FIELDS=(9,4,A)
  REFORMAT FIELDS=(F1:1,12,F2:13,8)
/*
For complete details on date conversion functions and the other new functions available with the Nov, 2009 DFSORT PTF, see:

http://www.ibm.com/support/docview.w...d=isg3T7000174