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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


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