Page 1 of 1

Key data to be reapeat in rows

PostPosted: Sat Apr 14, 2012 10:25 am
by trilochan_p
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

Re: Key data to be reapeat in rows

PostPosted: Mon Apr 16, 2012 10:50 pm
by Frank Yaeger
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.