Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
SORT within a Group.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: SORT within a Group.
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 Moderator


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

PostPosted: Tue Dec 04, 2007 2:28 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Increment number for every group of r... srajendran2 DFSORT/ICETOOL 7 Thu Nov 09, 2017 10:31 pm
No new posts JOINKEYS Paired and Unpaired Sort on ... MFwhiz DFSORT/ICETOOL 7 Tue Nov 07, 2017 2:46 am
This topic is locked: you cannot edit posts or make replies. Can a alphanumeric data be moved to a... nico_neoz COBOL Programming 10 Mon Oct 30, 2017 8:28 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us