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

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


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 2146
Location: At my coffee table

PostPosted: Thu May 22, 2008 1:41 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top