CFF master record

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
NSIT-DVP-01
Premium Member
Premium Member
Posts: 46
Joined: Wed May 16, 2007 1:54 am
Location: Paris
Contact:

CFF master record

Post by NSIT-DVP-01 »

Hi,

Can anybody give me an explanation to the "master record" in CFF? In Parallel Job Developer Guide, it says that you can toggle a master record when you define multiple record types but doesn't mention the usage of master record. I wonder what is the master record supposed to do? What can we do with it. And what's the difference with or without master record toggled.

Thanks in advance!

Regards
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I'm guessing that the master record is the level 01 item.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
NSIT-DVP-01
Premium Member
Premium Member
Posts: 46
Joined: Wed May 16, 2007 1:54 am
Location: Paris
Contact:

Post by NSIT-DVP-01 »

Posted: Tue Dec 15, 2009 10:23 pm
I'm guessing that the master record is the level 01 item.
Hi ray,

Thanks for your reply. I have checked the CFF stage "Layout" tab with COBOL format, I found that for every record definition (master record toggled or not), its level 01 item is always the name of the record. And this name is defined by myself in the tab "Records". I think that "master record" toggled or not doesn't influence the level 01 item. [/quote]
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

OK that was a guess. But it still works - the level 01 item "contains" (in some sense) all the higher-numbered-level items. I'd be happy to learn, if anyone knows the real answer, especially if they can back it up with a reference.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bpsprecher
Premium Member
Premium Member
Posts: 21
Joined: Mon Mar 08, 2004 11:42 am

Post by bpsprecher »

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!
Brian Sprecher
IBM
Lenexa, KS
NSIT-DVP-01
Premium Member
Premium Member
Posts: 46
Joined: Wed May 16, 2007 1:54 am
Location: Paris
Contact:

Post by NSIT-DVP-01 »

To dt12946:

Thanks a lot for your so detailed information!

Cordialment
NSIT
bpsprecher
Premium Member
Premium Member
Posts: 21
Joined: Mon Mar 08, 2004 11:42 am

Post by bpsprecher »

You're very welcome NSIT.

I stumbled on your post while searching for CFF array handling. I actually found very good information in IBM's Parallel Job Developer's Guide in Chapter 10. Also, Appendix C does a great job explaining FILLER creation.

Now I'm just wondering why I subconsciously gave Ray more money than Bob in my example...
Brian Sprecher
IBM
Lenexa, KS
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Currency fluctuation... :wink:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply