to merge 2 records of the input file using SORT

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

Moderators: Frank Yaeger, Moderator Group

kanna
Member
Posts: 4
Joined: Fri Jan 30, 2009 2:09 pm

to merge 2 records of the input file using SORT

Post by kanna » Fri Jan 30, 2009 3:50 pm

Hi ,
I am trying to concatenate the 2nd record of the input file to the first record.Ex:
Input records:
A1 ubi123445576667
A2 dcfregtttg0000000
A1 abggteghy888888
A2 reftehdys1111111

Expected Output is:
A1 ubi123445576667 A2 dcfregtttg0000000
A1 abggteghy888888 A2 reftehdys1111111

Both the records are present in the same file. That is the problem. :roll:
Can this be achieved using sort? Can somebody help me in this?

kanna
Member
Posts: 4
Joined: Fri Jan 30, 2009 2:09 pm

to merge 2 records of the input file using SORT

Post by kanna » Fri Jan 30, 2009 4:05 pm

I know that it can be achieved by split and merge. My question is, can we achieve this in 1 sort step? :roll:

User avatar
arrbee
Active Member
Posts: 144
Joined: Fri Feb 24, 2006 11:33 am

Post by arrbee » Fri Jan 30, 2009 7:46 pm

Hi,

What is the RECFM & LRECL of your file?

Thanks.
Arr Bee
-------------
?My joy in learning is partly that it enables me to teach? - Seneca(Roman philosopher, mid-1st century AD)

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

Post by Frank Yaeger » Fri Jan 30, 2009 8:43 pm

Kanna,

You can use a DFSORT job like the following to do what you asked for:

Code: Select all

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
A1 ubi123445576667
A2 dcfregtttg0000000
A1 abggteghy888888
A2 reftehdys1111111
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,BUILD=(20:1,20)),
        IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(1:20,18))
  OUTFIL STARTREC=2,SAMPLE=2
/*
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

kanna
Member
Posts: 4
Joined: Fri Jan 30, 2009 2:09 pm

to merge 2 records of the input file using SORT

Post by kanna » Mon Feb 02, 2009 9:39 am

Thanks Frank yeager! But how could i achieve the same in syncsort?

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

Post by Frank Yaeger » Mon Feb 02, 2009 9:21 pm

I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.
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

kanna
Member
Posts: 4
Joined: Fri Jan 30, 2009 2:09 pm

to merge 2 records of the input file using SORT

Post by kanna » Tue Feb 03, 2009 8:24 am

Thanks Frank!

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Re: to merge 2 records of the input file using SORT

Post by Anuj Dhawan » Tue Feb 03, 2009 1:29 pm

kanna wrote:how could i achieve the same in syncsort?
You may try the given JCL as is by replacing PGM=ICEMAN to PGM=SORT.
Regards,
Anuj

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 Feb 03, 2009 9:37 pm

Anuj,

PGM=ICEMAN and PGM=SORT are equivalent for both products. There's no need to do that replacement. If the job won't work on Syncsort with PGM=ICEMAN, then it won't work with PGM=SORT.
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

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Wed Feb 04, 2009 12:36 pm

Yes Big B,

I understand this & follow you - but I've seen (met even) some "idiots" who are beaten by the word "ICEXXXX" where XXXX can be MAN, TOOL..this philosphy of them I never understand..and that's why my previous reply comes in.
Regards,
Anuj

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

Post by Frank Yaeger » Wed Feb 04, 2009 8:14 pm

Yes, I understand. But if you're going to suggest they try PGM=SORT instead of PGM=ICEMAN, you should indicate there's no difference between the two rather then imply there is.
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

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Thu Feb 05, 2009 10:12 am

Taken your words Big B, will keep these in mind for future suggestions, Thanks.

Have a good one.. :)

Ad

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

Post by Frank Yaeger » Fri Feb 06, 2009 3:53 am

Big B?
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

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Fri Feb 06, 2009 10:08 am

oh ..Big B= Big Brother= Elder Brother..

hope it's not a bother ..I use this salutation affectionately for those who I respect .. :).

Regards,
Ad

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

Post by Frank Yaeger » Fri Feb 06, 2009 9:04 pm

Oh, it's not a bother. I just hadn't heard the term before so was curious what it meant.
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