Key data to be reapeat in rows



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

Key data to be reapeat in rows

Postby trilochan_p » Sat Apr 14, 2012 10:25 am

Hi,

I have to repeat the key field in all rows as metioned below.
Please guide me on this.

INPUT DATA-- starting from 2 to 31
---+----1----+----2----+----3-
0077777777  G   345     261228
            G   780     954902
            G   780     959135
0088888888  G   345     261228
            G   780     954902
            G   780     959135


OUTPUT DATA-- starting from 2 to 31
---+----1----+----2----+----3-
0077777777  G   345     261228
0077777777  G   780     954902
0077777777  G   780     959135
0088888888  G   345     261228
0088888888  G   780     954902
0088888888  G   780     959135
trilochan_p
 
Posts: 15
Joined: Tue Dec 06, 2011 2:37 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Key data to be reapeat in rows

 

Re: Key data to be reapeat in rows

Postby Frank Yaeger » Mon Apr 16, 2012 10:50 pm

Assuming that each "group" starts with non-blanks in 1-10, you can use a DFSORT job like the following to do what you asked for:

//S1 EXEC PGM=SORT                                             
//SYSOUT DD SYSOUT=*                                           
//SORTIN DD *                                                 
0077777777  G   345     261228                                 
            G   780     954902                                 
            G   780     959135                                 
0088888888  G   345     261228                                 
            G   780     954902                                 
            G   780     959135                                 
//SORTOUT DD SYSOUT=*                                         
//SYSIN DD *                                                   
  OPTION COPY                                                 
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,10,CH,NE,C' '),           
    PUSH=(1:1,10))                                             


If the groups are defined a different way, you need to explain the exact "rules" for selecting the records of a group.
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