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
Copy Alternate Records from 2 Input files in to the Single O
- 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
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).
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.
d.sch.
-
- 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
I want to do using SORT Utility.
- 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
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.
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.
d.sch.
- 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
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:
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
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- 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
Hello Frank, I am curious to know if this can be achieved in less than 3 steps
I think this is feasable in 3 steps by using SEQNUM syntax

I think this is feasable in 3 steps by using SEQNUM syntax

-
- 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
RECFM is FB and LRECL is 80 for all the files (Input & Output)
- 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
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):
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.
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
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- 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
Hi Frank, thank you for this sortcard.
Doing it in single step is really Great. It's really amazing.
Can you please provide more information Nov, 2009 DFSORT PTF software,because when I tried above syntax the job is getting abended.
Doing it in single step is really Great. It's really amazing.

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
-
-
How can I copy message queue files (LGMSG,SHMSG) in V9R1
by futohomok » Thu Jul 27, 2023 5:54 pm » in IMS DB/DC - 6
- 2053
-
by futohomok
View the latest post
Thu Aug 03, 2023 1:21 pm
-
-
-
File Handling 3 input files and 1 output file by using EZT
by pavan426 » Thu Sep 09, 2021 12:17 am » in CA-Easytrieve - 0
- 4421
-
by pavan426
View the latest post
Thu Sep 09, 2021 12:17 am
-
-
-
Convert fixed-length input records to variable-length output
by xcspg3 » Wed Oct 23, 2024 1:45 pm » in DFSORT/ICETOOL/ICEGENER - 5
- 1452
-
by sergeyken
View the latest post
Wed Oct 30, 2024 1:09 pm
-
-
-
Merging PDS members into single sequential file.
by jcbrotel » Thu Aug 18, 2022 7:27 pm » in IBM Cobol - 4
- 2908
-
by prino
View the latest post
Fri Aug 19, 2022 11:20 pm
-
-
-
Joining 2 vb files into vsam files ended error
by newbiemainframe » Thu Nov 12, 2020 7:59 am » in JCL - 1
- 1752
-
by NicC
View the latest post
Thu Nov 12, 2020 7:15 pm
-