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
 

 

Sort and add separtaor between different sorted blocks

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

New User


Joined: 19 Aug 2005
Posts: 48

PostPosted: Tue Mar 16, 2010 11:42 am    Post subject: Sort and add separtaor between different sorted blocks
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    Post subject:
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: 48

PostPosted: Tue Mar 16, 2010 1:52 pm    Post subject:
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    Post subject:
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    Post subject:
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: 48

PostPosted: Wed Mar 17, 2010 11:20 am    Post subject:
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    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 to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Db2 load job abending in SORT mistah kurtz DB2 4 Mon Jun 05, 2017 3:58 pm


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