Using Repeat Block example

In this example, the user has a file that has a tape header. This is followed by a company header of 189 characters.

Under the company segment there is a repeating detail record, followed by the next company, and so on.

What is required is to have it repeating to the end of the first company detail, repeating over multiple companies. That is, the header line is followed by an iteration of companies. Each company consists of a company line followed by an iteration of detail lines. In essence, an iteration within an iteration.

(These are all FRL fields.)

"TAPE HEADER" 
"Company A " 
"detail1 0" 
"detail2 0" 
. 
. 
. 
"Company B" 
"detail1 0" 
...

To have it repeat over the companies, another HRL is required that contains the HRL already made.

Create HRL called Company:
1 * Name: comp_line 
   * File Name: comp.frl 
   * No Repeat 
2 * Name detail_line 
   * File Name: det.frl 
   * Repeat While Field: detail_line.indicator_field 
          Value: DETAIL 
Create another HRL called Total: 
1 * Name: header_line 
   * File Name: head.frl 
   * No Repeat 
2 * Name Company_hrl 
   * File Name: Company.hrl 
   * Repeat While Field: Company_hrl.indicator_field 
          Value: COMPANY 

If you are creating precisely one message per company, then use TCL to first get rid of the header line. Then, split the rest of the message in separate messages, one message per company. You can then use the company HRL to process these separate messages.