Page 1 of 2

to merge 2 records of the input file using SORT

Posted: Fri Jan 30, 2009 3:50 pm
by kanna
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?

to merge 2 records of the input file using SORT

Posted: Fri Jan 30, 2009 4:05 pm
by kanna
I know that it can be achieved by split and merge. My question is, can we achieve this in 1 sort step? :roll:

Posted: Fri Jan 30, 2009 7:46 pm
by arrbee
Hi,

What is the RECFM & LRECL of your file?

Thanks.

Posted: Fri Jan 30, 2009 8:43 pm
by Frank Yaeger
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
/*

to merge 2 records of the input file using SORT

Posted: Mon Feb 02, 2009 9:39 am
by kanna
Thanks Frank yeager! But how could i achieve the same in syncsort?

Posted: Mon Feb 02, 2009 9:21 pm
by Frank Yaeger
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.

to merge 2 records of the input file using SORT

Posted: Tue Feb 03, 2009 8:24 am
by kanna
Thanks Frank!

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

Posted: Tue Feb 03, 2009 1:29 pm
by Anuj Dhawan
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.

Posted: Tue Feb 03, 2009 9:37 pm
by Frank Yaeger
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.

Posted: Wed Feb 04, 2009 12:36 pm
by Anuj Dhawan
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.

Posted: Wed Feb 04, 2009 8:14 pm
by Frank Yaeger
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.

Posted: Thu Feb 05, 2009 10:12 am
by Anuj Dhawan
Taken your words Big B, will keep these in mind for future suggestions, Thanks.

Have a good one.. :)

Ad

Posted: Fri Feb 06, 2009 3:53 am
by Frank Yaeger
Big B?

Posted: Fri Feb 06, 2009 10:08 am
by Anuj Dhawan
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

Posted: Fri Feb 06, 2009 9:04 pm
by Frank Yaeger
Oh, it's not a bother. I just hadn't heard the term before so was curious what it meant.