Copy Alternate Records from 2 Input files in to the Single O

IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER
nrvedula
Posts: 4
Joined: Sun Jan 03, 2010 9:42 am
Skillset: Mainframes - COBOL, JCL, VSAM, DB2, IMS DB, IDMS, CICS
Referer: Website

Copy Alternate Records from 2 Input files in to the Single O

Postby nrvedula » Sun Jan 03, 2010 11:06 am

Suppose there are 2 Input files A & B. Below are the records in the Input files

File A
-------
Record-1
Record-2
Record-3
Record-4

File B
------
Record-5
Record-6
Record-7
Record-8


The O/P in the Single Output file C should be as below.

File C
-------
Record-1
Record-5
Record-2
Record-6
Record-3
Record-7
Record-4
Record-8

How can we do this? Please let me know.


Regards,
Nageshwar

User avatar
dick scherrer
Global moderator
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am

Re: Copy Alternate Records from 2 Input files in to the Single O

Postby dick scherrer » Mon Jan 04, 2010 6:20 am

Hello and welcome to the forum,

To do what you want, you will use some utility - which one do you want to use?

No, this cannot be done with "a JCL" - because jcl does nothing except execute programs (many of which are utlities).
Hope this helps,
d.sch.

nrvedula
Posts: 4
Joined: Sun Jan 03, 2010 9:42 am
Skillset: Mainframes - COBOL, JCL, VSAM, DB2, IMS DB, IDMS, CICS
Referer: Website

Re: Copy Alternate Records from 2 Input files in to the Single O

Postby nrvedula » Mon Jan 04, 2010 7:10 am

I want to do using SORT Utility.

User avatar
dick scherrer
Global moderator
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am

Re: Copy Alternate Records from 2 Input files in to the Single O

Postby dick scherrer » Mon Jan 04, 2010 9:42 am

Hello,

Which sort product is being used? There are separate parts of the forum for DFSORT and Syncsort.

When you post which is being used, your topic will be moved to the appropriate part of the forum.
Hope this helps,
d.sch.

nrvedula
Posts: 4
Joined: Sun Jan 03, 2010 9:42 am
Skillset: Mainframes - COBOL, JCL, VSAM, DB2, IMS DB, IDMS, CICS
Referer: Website

Re: Copy Alternate Records from 2 Input files in to the Single O

Postby nrvedula » Mon Jan 04, 2010 9:47 am

DFSORT pls

User avatar
Frank Yaeger
Global moderator
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Skillset: DFSORT, ICETOOL, ICEGENER
Referer: Search
Contact:

Re: Copy Alternate Records from 2 Input files in to the Single O

Postby Frank Yaeger » Mon Jan 04, 2010 10:41 pm

I need some more information before I can show you how to do this.

What is the RECFM and LRECL of each input file?

Please run this DFSORT job and show me the //SYSOUT messages so I can see what level you're at:

Code: Select all

//S1    EXEC  PGM=SORT           
//SYSOUT    DD  SYSOUT=*         
//SORTIN DD *                   
RECORD                           
//SORTOUT DD DUMMY               
//SYSIN    DD    *               
  OPTION COPY                   
/*
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

upendra_water
Posts: 33
Joined: Wed Nov 25, 2009 10:58 pm
Skillset: JCL,COBOL and DB2
Referer: google

Re: Copy Alternate Records from 2 Input files in to the Single O

Postby upendra_water » Tue Jan 05, 2010 3:01 pm

Hello Frank, I am curious to know if this can be achieved in less than 3 steps :D
I think this is feasable in 3 steps by using SEQNUM syntax ;)

nrvedula
Posts: 4
Joined: Sun Jan 03, 2010 9:42 am
Skillset: Mainframes - COBOL, JCL, VSAM, DB2, IMS DB, IDMS, CICS
Referer: Website

Re: Copy Alternate Records from 2 Input files in to the Single O

Postby nrvedula » Tue Jan 05, 2010 10:35 pm

RECFM is FB and LRECL is 80 for all the files (Input & Output)

User avatar
Frank Yaeger
Global moderator
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Skillset: DFSORT, ICETOOL, ICEGENER
Referer: Search
Contact:

Re: Copy Alternate Records from 2 Input files in to the Single O

Postby Frank Yaeger » Tue Jan 05, 2010 10:44 pm

It can be done in one pass (step) using a DFSORT JOINKEYS job like the following (I assumed the input files have RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes):

Code: Select all

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//IN1 DD *
Record-1
Record-2
Record-3
Record-4
//IN2 DD *
Record-5
Record-6
Record-7
Record-8
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  JOINKEYS F1=IN1,FIELDS=(81,8,A),SORTED,NOSEQCK
  JOINKEYS F2=IN2,FIELDS=(81,8,A),SORTED,NOSEQCK
  REFORMAT FIELDS=(F1:1,80,F2:1,80)
  OPTION COPY
  OUTFIL BUILD=(1,80,/,81,80)
//JNF1CNTL DD *
  INREC OVERLAY=(81:SEQNUM,8,ZD)
//JNF2CNTL DD *
  INREC OVERLAY=(81:SEQNUM,8,ZD)
/*


The Nov, 2009 DFSORT PTF must be installed in order for JOINKEYS to be used.

It can also be done in 3 passes (one ICETOOL step) without using JOINKEYS.
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

upendra_water
Posts: 33
Joined: Wed Nov 25, 2009 10:58 pm
Skillset: JCL,COBOL and DB2
Referer: google

Re: Copy Alternate Records from 2 Input files in to the Single O

Postby upendra_water » Wed Jan 06, 2010 3:10 pm

Hi Frank, thank you for this sortcard.
Doing it in single step is really Great. It's really amazing. :o
Can you please provide more information Nov, 2009 DFSORT PTF software,because when I tried above syntax the job is getting abended.


  • Similar Topics
    Replies
    Views
    Last post