Copy n paste n times

I have one mainframe copy book where I want to copy n times depend on occurs which mention below.
Example:
Below highlighted row mention �occurs 2 times� so I need to copy 2 times till next label 10.

 
C14992     10   FILLER                           PIC X(2835).                   
       01   EDW-EXTR-DETAIL-RECORD.                                             
           10     EDW-EXTR-BANK                  PIC X(10).                     
           10     EDW-EXTR-APPL                  PIC 9(03).                     
           10     EDW-EXTR-OUT-OF-STATE-REASON   PIC X(100).    
           10     FILLER                         PIC X(178).                    
       10     EDW-EXTR-ARRAY   OCCURS 2 TIMES.                             
             11     EDW-EXTR-TYPE                PIC X(30).                     
             11     EDW-EXTR-VOLUME              PIC X(30).                     
             11     EDW-EXTR-RANGE               PIC X(30).                     
             C14992       11     EDW-EXTR-CNTRY-CD            PIC X(40).
           10     FILLER                         PIC X(178).                    
Output should be:
C14992     10   FILLER                           PIC X(2835).                   
       01   EDW-EXTR-DETAIL-RECORD.                                             
           10     EDW-EXTR-BANK                  PIC X(10).                     
           10     EDW-EXTR-APPL                  PIC 9(03).                     
           10     EDW-EXTR-OUT-OF-STATE-REASON   PIC X(100).                    
           10     FILLER                         PIC X(178).                    
           10     EDW-EXTR-ARRAY   .                             
            11     EDW-EXTR-TYPE                PIC X(30).                     
            11     EDW-EXTR-VOLUME              PIC X(30).                     
            11     EDW-EXTR-RANGE               PIC X(30).                     
            C14992       11     EDW-EXTR-CNTRY-CD            PIC X(40).
           10     EDW-EXTR-ARRAY   .                             
            11     EDW-EXTR-TYPE                PIC X(30).                     
            11     EDW-EXTR-VOLUME              PIC X(30).                     
            11     EDW-EXTR-RANGE               PIC X(30).                     
            C14992       11     EDW-EXTR-CNTRY-CD            PIC X(40).
       10     FILLER                         PIC X\(178\).       

Is there any unix command achieve above task.

This is an unspecific specification. Can we rely on "occurs n times" to occur reliably? Where does the block to be copied n times stop? Is there always a "10 FILLER" line?

occurance will change from copy book to copybook but that will not be issue,help me to get 14 occurs itslef and always it will be 10 filler line only.

awk     '/OCCURS .+ TIMES/ {n = $4; NF-=3; L=1}
         /10 + FILLER/  {for (i=1;i<n;i++) for (j=1;j<=c;j++) print B[j]; L=c=0}
         L              {B[++c]=$0}
         1
        ' file

Below code is not working.

 
awk     '/OCCURS .+ TIMES/ {n = $4; NF-=3; L=1}
         /10 + FILLER/  {for (i=1;i<n;i++) for (j=1;j<=c;j++) print B[j]; L=c=0}
         L              {B[++c]=$0}
         1
        ' sam.txt

It is.

Maybe your sam.txt is not what you posted before.

We are not a coding service here. RudiC's code WILL work with the partial specifications you gave. Please post the EXACT input and EXACT output you expect.

And note: 'is not working' == 'is not getting help'

Sorry,i didnt mean it.