IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SORT within a Group.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
alwaysjai

New User


Joined: 29 Nov 2007
Posts: 1
Location: Edison, NJ

PostPosted: Tue Dec 04, 2007 1:37 am
Reply with quote

Hi, I would like to know if we can SORT a flat file only for particular record types within a group.

I have a file which will have Record-types 1, 2 and 3 (in the first byte) for each set. The Types 1 and 3 will be present only once for a group. But, Record-types 2 could be multiple within a group. I would like to SORT only the Record-types 2. Can someone let me know if there is a way to sort this file.

I cannot use the INCLUDE/OMIT condition as it would sort all Record-types 2 together.

Input file:

1A
2Y
2X
3B
1P
2S
2R
3Q

Output file: In Required Format:

1A
2X
2Y
3B
1P
2R
2S
3Q

Thanks in advance.
Jai.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Dec 04, 2007 2:28 am
Reply with quote

Jai,

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

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
1A
2Y
2X
3B
1P
2S
2R
3Q
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,PD)),
        IFTHEN=(WHEN=(1,1,CH,EQ,C'1'),
                OVERLAY=(81:SEQNUM,8,PD)),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(89:SEQNUM,8,PD,
                         81:81,8,PD,SUB,89,8,PD,TO=PD,LENGTH=8))
  SORT FIELDS=(81,8,PD,A,1,1,CH,A,2,1,CH,A)
  OUTREC BUILD=(1,80)
/*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top