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
 
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 records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am

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