Yeah -- the Parallel CFF is very powerful, but it's so different from the Server CFF and it isn't documented very well. For that reason I cannot supply a reference; only hard-learned experience.
The CFF processes one record at a time, but you've probably figured out by now that the CFF can "buffer" data from previous rows. You are only allowed to select one Master record type per CFF. Set a record type as Master, and when it is read, the output buffer will be emptied.
So how about a simple example? Suppose we have a file with a Header (H record type), Detail (D), Transaction (X) and Trailer (T). Each Detail can have multiple Transactions.
The COBOL copybook will look like the following (by the way, I find it much easier to create each record type as its own 01-level in the same *.cfd file, and import all at the same time!):
Code: Select all
01 CFF_HEADER.
05 RECORD_TYPE PIC X(1).
05 FILLER PIC X(1).
05 FILENAME PIC X(10).
01 CFF_DETAIL.
05 RECORD_TYPE PIC X(1).
05 FILLER PIC X(1).
05 CUST_NAME PIC X(4).
01 CFF_TRANSACTION.
05 RECORD_TYPE PIC X(1).
05 FILLER PIC X(1).
05 TXN_AMT PIC 9(3).
01 CFF_TRAILER.
05 RECORD_TYPE PIC X(1).
05 FILLER PIC X(1).
05 NAME_CNT PIC 9(1).
The data in the input file:
Code: Select all
H File1.dat
D Ray
X 750
X 999
D Bob
X 500
X 499
T 2
We are going to build 1 output stream that will have Detail and Transaction information (RECORD_TYPE, CFF_DETAIL-FILLER, CFF_DETAIL-CUST_NAME, CFF_TRANSACTION-TXN_AMT). We will NOT select any record types as Master, and our constraint will be for record types = "D" and "X":
Code: Select all
D Ray
X Ray 750
X Ray 999
D Bob 999
X Bob 500
X Bob 499
Notice how the first Detail row's CFF_TRANSACTION-TXN_AMT value is empty -- we expect that since we hadn't read in a Transaction row yet. But look at Bob's first Detail row -- he inherited the value from Ray's last Transaction Amount!
So now if we select the CFF_DETAIL as Master, the CFF_TRANSACTION-TXN_AMT will be emptied every time a CFF_DETAIL row is read:
Code: Select all
D Ray
X Ray 750
X Ray 999
D Bob
X Bob 500
X Bob 499
Of course, the situation could be avoided by setting the constraint just for record types = "X" (i.e. just spit out Transaction rows). I would guess you would code your CFF like I did above if you were going to run a single stream through a Transformer to split the output by constraints on the record type. However, you could just as easily have 2 output streams from the CFF; one for each record type (Detail and Transaction).
It just depends on what type of output you need. The CFF is very flexible, and I wish more people were using it so I can get more information from DSXchange!