Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us