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

Sort and add separtaor between different sorted blocks


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
autobox

New User


Joined: 19 Aug 2005
Posts: 51

PostPosted: Tue Mar 16, 2010 11:42 am
Reply with quote

Hi,

Please advise if MF SORT can do this:
Sort a PS file and then add separators between different blocks sorted. For example, the original file looks like:
Code:
AAAA...........
BBBB...........
AAAA...........
CCCC...........
BBBB...........
I want the results look like (sorted by first 4 characters):
Code:
AAAA...........
AAAA...........
------------------- <- a separator line
BBBB...........
BBBB...........
------------------- <- a separator line
CCCC...........

Thanks.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Mar 16, 2010 11:55 am
Reply with quote

Quote:
Please advise if MF SORT can do this:

Yes It can be done with DFSORT like below.
I have assumed LRECL 80
Code:

//S1    EXEC  PGM=SORT             
//SYSOUT    DD  SYSOUT=*           
//SORTIN DD *                     
AAAA...........                   
BBBB...........                   
AAAA...........                   
CCCC...........                   
BBBB...........                   
//SORTOUT DD SYSOUT=*             
//SYSIN    DD    *                 
  SORT FIELDS=(1,4,CH,A)           
  OUTFIL REMOVECC,                 
  SECTIONS=(1,4,TRAILER3=(80C'-'))


Outptu will be:
Code:

AAAA...........                                                         
AAAA...........                                                         
-------------------------------------------------------------------------------
BBBB...........                                                         
BBBB...........                                                         
-------------------------------------------------------------------------------
CCCC...........                                                         
-------------------------------------------------------------------------------
Back to top
View user's profile Send private message
autobox

New User


Joined: 19 Aug 2005
Posts: 51

PostPosted: Tue Mar 16, 2010 1:52 pm
Reply with quote

Hi Sambhaji,

Thanks for your help. I tried your control statements, and it works for the example I posted here.

Actually, the field I sorted is nearly 4000 bytes (3954 bytes exactly, the file LRECL is 4000, FB), and I need to add separator lines according to that 3954-byte-long field. I tried 'SECTIONS=(46,3954,TRAILER3=(4000C'-')) ', but it seems that did not work.
Code:
            SORT FIELDS=(46,3954,CH,A)           
            OUTFIL REMOVECC,                     
            SECTIONS=(46,3954,TRAILER3=(4000C'-'))
                                      $                       
ICE223A F REPORT FIELD ERROR                     
ICE052I 3 END OF DFSORT                           

Please advise if there's a length limitation of the 'SECTIONS=' control statement.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Mar 16, 2010 3:25 pm
Reply with quote

Code:
SECTIONS=(p,m,...


I think m can be upto 256
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Mar 16, 2010 9:39 pm
Reply with quote

autobox,

Use the following Control cards

Code:

//SYSIN    DD *                     
  SORT FIELDS=(46,3954,CH,A)       
  OUTFIL REMOVECC,                 
  SECTIONS=(0046,256,SKIP=0L,       
            0302,256,SKIP=0L,       
            0558,256,SKIP=0L,       
            0814,256,SKIP=0L,       
            1070,256,SKIP=0L,       
            1326,256,SKIP=0L,       
            1582,256,SKIP=0L,       
            1838,256,SKIP=0L,       
            2094,256,SKIP=0L,       
            2350,256,SKIP=0L,       
            2606,256,SKIP=0L,       
            2862,256,SKIP=0L,       
            3118,256,SKIP=0L,       
            3374,256,SKIP=0L,       
            3630,256,SKIP=0L,       
            3886,115,SKIP=0L,       
            TRAILER3=(4000C'-'))   
//*
Back to top
View user's profile Send private message
autobox

New User


Joined: 19 Aug 2005
Posts: 51

PostPosted: Wed Mar 17, 2010 11:20 am
Reply with quote

Hi Skolusu,

Thanks for your advise. Everything works now!
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top