Reading input conditionally

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
poornimasai
Participant
Posts: 6
Joined: Mon Aug 02, 2010 2:38 pm

Reading input conditionally

Post by poornimasai »

Can datastage read input from the source conditionally? That is, can it make a 'decision' to read or not read the line based on the value of a field in the current line. I know some programming languages have the capability to do this.

Recently, I was told datastage would read its input completely and then a 'decision' can be made only in the consequent stages. Is this true?
I am what I am, even when I am not myself.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Seems to me you'd have to read the record first to get the value in the field to make this decision on. :?

Regardless, to answer your generic question, yes - entire records are read and then decisions on how the parse different layouts can be made after that in subsequent stages. As an 'additional info' note, the ability to read 'mainframe files with different record layouts' is built into the CFF (Complex Flat File) stage.
-craig

"You can never have too many knives" -- Logan Nine Fingers
poornimasai
Participant
Posts: 6
Joined: Mon Aug 02, 2010 2:38 pm

Post by poornimasai »

Thank you, Craig! :) I checked the documentation for the mainframe file stages and found it can read multiple 'occur depending on'(though our developer insists 8.1 cannot :? ). Now, my mainframe file has different record layouts within the same file and the header record tells me the following records are of some particular layout. I would have to read in my header record and accordingly, change layout! :roll:

Can I do the decision making if I read the file in sequentially?
I am what I am, even when I am not myself.
poornimasai
Participant
Posts: 6
Joined: Mon Aug 02, 2010 2:38 pm

Post by poornimasai »

Oh, I read the documentation again and it has only said a CFF can contain multiple 'Occurs depending on' clauses. Not that the CFF stage can read it. :roll:

My bad! :)
I am what I am, even when I am not myself.
FranklinE
Premium Member
Premium Member
Posts: 739
Joined: Tue Nov 25, 2008 2:19 pm
Location: Malvern, PA

Post by FranklinE »

Without knowing the details, the following criti... um, commentary should be taken with a grain of salt.

Number one: Using a single dataset to contain variable-length/blocked records with multiple data definitions (schemas, copybooks) is insane. It's lazy design to avoid making the coders do standard work. It's just sane to use fixed-width records on a consistent schema (copybook). :(

The only reliable way to read mainframe data into DataStage is to import that consistent schema. If you have mutiple record types identified in the first 1 or 2 bytes, you can use a filter or transformer contraint to use or skip them accurately.
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson

Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post by arunkumarmm »

If it is Variable block file in binary format, each and every record will have the record length in the begining. You can read in that and route your records... We have jobs like that in DS 390 but it should work the same way in parallel
Arun
Post Reply