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
 

 

How to sort a file in one order and flag in another order

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
subinraj

New User


Joined: 04 Sep 2007
Posts: 16
Location: Bangalore

PostPosted: Thu May 22, 2008 11:04 am    Post subject: How to sort a file in one order and flag in another order
Reply with quote

I have a requirement to sort a file in one specific order and to flag the last record based on another key.

Input file.
subin 111
jibin 222
subin 111
jibin 111
subin 222
subin 333

The requirement is to sort the file based on the first 5 fields and to flag the last record based on the keys(8,3).
The output file should look like
jibin 222
jibin 111 F
subin 111
subin 111
subin 222
subin 333 F
Back to top
View user's profile Send private message

CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Thu May 22, 2008 1:41 pm    Post subject: Re: How to sort a file in one order and flag in another orde
Reply with quote

Is this what your input looks like?
subinraj wrote:
Input file.
subin 111
jibin 222
subin 111
jibin 111
subin 222
subin 333
Or is this what your input looks like?
Code:
subin 111
jibin   222
subin 111
jibin   111
subin 222
subin 333
Or is this what your input looks like?
Code:
subin 111
jibin 222
subin 111
jibin 111
subin 222
subin 333

Quote:
The requirement is to sort the file based on the first 5 fields and to flag the last record based on the keys(8,3).
Sort with EQUALS and some sort of trailer processing?
Have you looked at the Sort Manual?
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu May 22, 2008 9:41 pm    Post subject: Reply to: How to sort a file in one order and flag in anothe
Reply with quote

Subinraj,


The following DFSORT/ICETOOL JCl will give you desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                           
//IN       DD *                                                 
SUBIN 111                                                       
JIBIN 222                                                       
SUBIN 111                                                       
JIBIN 111                                                       
SUBIN 222                                                       
SUBIN 333                                                       
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)       
//T2       DD DSN=&&T2,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)       
//CON      DD DSN=&&T2,DISP=OLD,VOL=REF=*.T2                     
//         DD DSN=&&T1,DISP=OLD,VOL=REF=*.T1                     
//OUT      DD SYSOUT=*                                           
//TOOLIN   DD *                                                 
  SELECT FROM(IN) TO(T1) ON(1,5,CH) LAST DISCARD(T2) USING(CTL1)
  SORT FROM(CON) USING(CTL2)                                     
//CTL1CNTL DD *                                                 
  OUTFIL FNAMES=T1,OVERLAY=(11:C'F')                             
  OUTFIL FNAMES=T2                                               
//CTL2CNTL DD *                                                 
  OPTION EQUALS                                                 
  SORT FIELDS=(1,5,CH,A)                                         
  OUTFIL FNAMES=OUT                                             
/*                                                               
Back to top
View user's profile Send private message
subinraj

New User


Joined: 04 Sep 2007
Posts: 16
Location: Bangalore

PostPosted: Fri May 23, 2008 9:48 am    Post subject: Thanks.....
Reply with quote

Thanks Skolusu,

The Icetool steps works fine.
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 Card to Remove Duplicate records... raj4neo SYNCSORT 2 Wed Jan 25, 2017 4:44 am
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Order BY AND Index Nileshkul DB2 2 Sat Dec 31, 2016 6:33 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


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