sort - to insert a comment in file



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

sort - to insert a comment in file

Postby sjrcreation » Tue Oct 11, 2011 2:08 pm

Can we insert a comment line in a file before a fixed content, Eg

my file
*********
**********
****
1******
********
1*****
*******

requirement :
*********
**********
****
**comment**
1******
********
**comment**
1*****
*******
**comment**

i need to inset a comment before a constant 1 in 1st col.
sjrcreation
 
Posts: 30
Joined: Sat Dec 11, 2010 9:44 am
Has thanked: 0 time
Been thanked: 0 time

Re: sort - to insert a comment in file

 

Re: sort - to insert a comment in file

Postby Frank Yaeger » Tue Oct 11, 2011 11:43 pm

Your "rules" don't match your example. Why do you have the last **comment** when there's no 1 in the last record?

At any rate, if you want to insert a comment before each '1' record, you can use a DFSORT job like the following:

//S1 EXEC PGM=SORT                                 
//SYSOUT DD SYSOUT=*                               
//SORTIN DD *                                     
*********                                         
**********                                         
****                                               
1******                                           
********                                           
1*****                                             
*******                                           
//SORTOUT DD SYSOUT=*                             
//SYSIN DD *                                       
  OPTION COPY                                     
  OUTFIL IFTHEN=(WHEN=(1,1,CH,EQ,C'1'),           
    BUILD=(C'**comment**',/,1,80))                 


SORTOUT would have:

*********       
**********       
****             
**comment**     
1******         
********         
**comment**     
1*****           
*******         
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post