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

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
Rajesh Kumar Sakthivel
Member
Posts: 2
Joined: Sat Dec 27, 2008 12:26 pm
Location: India

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

Post by Rajesh Kumar Sakthivel » Sat Dec 27, 2008 12:57 pm

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

User avatar
Natarajan
Moderator
Posts: 537
Joined: Fri Oct 10, 2008 12:57 pm
Location: chennai
Contact:

ICETOOL help

Post by Natarajan » Sun Dec 28, 2008 11:13 am

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.
Natarajan
Chennai

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Sun Dec 28, 2008 9:24 pm

That's a cartesian join. DFSORT/ICETOOL doesn't have any built-in functions to do that.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Rajesh Kumar Sakthivel
Member
Posts: 2
Joined: Sat Dec 27, 2008 12:26 pm
Location: India

Post by Rajesh Kumar Sakthivel » Mon Dec 29, 2008 1:09 am

Thanks Frank. I will manage this with SELCOPY.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Nov 17, 2009 5:52 am

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
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others