How to detect end of file

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
sbass1
Premium Member
Premium Member
Posts: 211
Joined: Wed Jan 28, 2009 9:00 pm
Location: Sydney, Australia

How to detect end of file

Post by sbass1 »

(I did search before posting...if I've missed it just tell me the text to search for...)

Seq file --> xfm --> Seq file

xfm has the constraint: NewKey

NewKey is determined by RowProcCompareWithPrevValue.

All is good except for the last record in the file. Does DS provide a variable for EOF condition? In pseudocode, I would change my constraint to:

NewKey or DSEof

Same question if source is a RDBMS table.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Short answer? Nope. :(

Sometimes you can 'pre-count' the data and pass the number in as a parameter for use in a constraint or derivation. Some people will cat a known 'end of file' record onto the source or into the stream so you can tell when you've hit the end. Another thought relates to 'group change detection', sometimes you can order descending and key off the first group item rather than the last and avoid the need to know when you've hit the end.

Hope something there helps.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sbass1
Premium Member
Premium Member
Posts: 211
Joined: Wed Jan 28, 2009 9:00 pm
Location: Sydney, Australia

Post by sbass1 »

Thanks Craig. The question was in relation to viewtopic.php?t=126366&highlight=.

My workaround was essentially the 'pre-count' approach, joining the table back with itself based on the RowNum.
Post Reply