Want to exclude constants from SORT (but keep the data)



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

Want to exclude constants from SORT (but keep the data)

Postby D9988 » Fri Nov 09, 2007 11:02 pm

I'm sorting a work file by 2 fields:

//SYSIN DD *
SORT FIELDS=(1,2,CH,A,5,8,CH,A),
FILSZ=E10000

I want to exclude any lines that have '**' in positions 1-2 from being sorted. These lines are currently at the bottom of the work file and I want to keep them there. They currently get included in the sort and moved to the top of the output file.

I tried excluding it with "INCLUDE COND" but that removes the data completely. Is it possible to keep the data, but have the SORT ignore it so that it does not get included in the sort?
David
D9988
 
Posts: 34
Joined: Fri Nov 09, 2007 10:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Want to exclude constants from SORT (but keep the data)

Postby Frank Yaeger » Sat Nov 10, 2007 2:41 am

You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
BB000001
CC000005
AA000004
AA000002
RR000000
RR000005
RR000003
** 3
** 2
** 1
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'0')),
        IFTHEN=(WHEN=(1,2,CH,EQ,C'**'),
          OVERLAY=(81:C'1',82:SEQNUM,8,PD))
  SORT FIELDS=(81,1,CH,A,82,8,PD,A,1,2,CH,A,5,8,CH,A),
    FILSZ=E10000
  OUTREC BUILD=(1,80)
/*


SORTOUT would have:

AA000002
AA000004
BB000001
CC000005
RR000000
RR000003
RR000005
** 3
** 2
** 1
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
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Want to exclude constants from SORT (but keep the data)

Postby D9988 » Sat Nov 10, 2007 4:50 am

Works great, thanks Frank 8-)
David
D9988
 
Posts: 34
Joined: Fri Nov 09, 2007 10:55 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post