SORT using WHEN=GROUP



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

SORT using WHEN=GROUP

Postby djprakash1ml » Thu Mar 10, 2011 12:24 pm

Hi,

Could someone help me with this please?

Input:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
14 Feb 00:43:51.7967 => ****GI Identifier= 20111111111111111111
14 Feb 00:43:51.7967 => SORTWORKSFORUAAAAAAAAAAAAAAAAccountKey/Output Validation error
14 Feb 00:43:51.7967 => XXXXXXXXXXXXXXXXXXXXXXXXXNo Data XXXXXXXXXXXXXXXXXXXXXXXXXXX
14 Feb 00:43:51.7967 => SIMPLECHARLIE
14 Feb 00:43:52.3124 => ****GI Identifier= 20112222222222222222
14 Feb 00:43:52.3124 => B1234567890AAAAAAAAAAAAAAAAccountKey/Output Validation error
14 Feb 00:43:52.3124 => XXXXXXXXXXXXXXXXXXNo Data XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
14 Feb 00:43:52.3124 => SIMPLECHARLIE


Expected Output:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
20111111111111111111 SORTWORKSFORU
20112222222222222222 B1234567890AA


Important Points:
1. The length of the Input file is 251 and it's a FB file.
2. The number in the input (Eg.. 20111111111111111111 always starts with "2011" and starts from the 44th position.LENGTH = 20
3. The text in the input (Eg.. SORTWORKSFORU) always starts from the 25th position in the line next to the number (2011..).
LENGTH=13

4. The text in the output should start from 22nd position after the number.

Query:

I know I need to use IFTHEN(WHEN=GROUP).
Not sure how to do it?
djprakash1ml
 
Posts: 17
Joined: Mon Jun 28, 2010 6:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SORT using WHEN=GROUP

Postby skolusu » Thu Mar 10, 2011 10:52 pm

djprakash1ml,

Use the following DFSORT JCL which will give you the desired results.

//STEP0100 EXEC PGM=SORT     
//SYSOUT   DD SYSOUT=*       
//SORTIN   DD DSN=Your Input Fb 251 byte file,DISP=SHR
//SORTOUT  DD SYSOUT=* 
//SYSIN    DD *                                                       
  SORT FIELDS=COPY                                                   
  INREC IFTHEN=(WHEN=GROUP,RECORDS=2,                                 
  BEGIN=(25,18,CH,EQ,C'****GI IDENTIFIER='),PUSH=(252:44,20,SEQ=1))   
  OUTFIL INCLUDE=(272,1,ZD,EQ,2),BUILD=(252,20,X,25,13)               
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: SORT using WHEN=GROUP

Postby djprakash1ml » Thu Mar 31, 2011 8:38 pm

Thanks a lot !!

SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,RECORDS=2,
BEGIN=(25,18,CH,EQ,C'****GI IDENTIFIER='),PUSH=(252:44,20,SEQ=1))
OUTFIL INCLUDE=(272,1,ZD,EQ,2),BUILD=(252,20,X,25,13)

In this case the SOROUT dataset can a record lenght of 34
Is this because we use BUILD?

Any alternatives in this case?

Thanks
djprakash1ml
 
Posts: 17
Joined: Mon Jun 28, 2010 6:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SORT using WHEN=GROUP

Postby skolusu » Thu Mar 31, 2011 10:32 pm

djprakash1ml wrote:In this case the SOROUT dataset can a record lenght of 34 Is this because we use BUILD?


Yes that is you showed as the desired output in your original post. Do you want the output to be different?
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: SORT using WHEN=GROUP

Postby djprakash1ml » Fri Apr 01, 2011 7:58 pm

No this is fine.
But I was having lenght of the output dataset as 80 and the job was abending.
Is there anyway we can avoid the record length restriction?
djprakash1ml
 
Posts: 17
Joined: Mon Jun 28, 2010 6:33 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SORT using WHEN=GROUP

Postby skolusu » Fri Apr 01, 2011 9:27 pm

djprakash1ml,

I am assuming you hard coded the LRECL of 80 in your JCL. You really don't have to code the DCB parameters for a sort job as sort products are capable of calculating them from the input or by the INREC/OUTREC statements. So remove the hard coded values in your JCL. Alternatively if you DO want to create a 80 byte file by padding them with spaces , then change your BUILD statement to the following
  BUILD=(252,20,X,25,13,80:X)
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: SORT using WHEN=GROUP

Postby djprakash1ml » Mon Apr 04, 2011 2:58 pm

Thanks for your patient reply. My sincere thanks.
So dumb of me (I am referring to the BUILD statement change..)

Thanks again,
David
djprakash1ml
 
Posts: 17
Joined: Mon Jun 28, 2010 6:33 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post