Creation of the Text File ....

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

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

Post by ray.wurlod »

OpenSeq opens a channel to the I/O system.
It is possible, therefore, to "open a file for writing" even though the file does not yet exist. In this case, the ELSE clause of the OpenSeq statement is executed, and the STATUS() function returns 0.
If the channel is closed (CloseSeq) without any form of Write statement (that is, WeofSeq, WriteSeq or WriteBlk) having been performed, the file will still not exist.
If the channel is closed and any form of Write statement has been executed, then the file will exist (provided permissions, etc., allow it).
If you want to guarantee the creation of a zero length file, even though you end up writing nothing to it, you can simply write an end of file mark (WeofSeq). Another way is to use the CREATE statement inside the ELSE clause of the OpenSeq statement.
You can find all of these statements in the BASIC manual.
Alternately, prior to opening the file, you can use the touch command at the operating system level to create it. This command exists for all UNIX platforms, and ships with DataStage (as touch.exe) for Windows platforms.


Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I am concerned that you are writing routines to do what DataStage stages can probably do with much less development cost to you.
Is there some good reason why you can't use the Designer to create a job to read from one sequential file and write to another?
[?]
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can read the structured flat file with a Sequential File stage as if it had one column per line, and use a Transformer stage to decompose the structure(s) and possibly to direct them to different outputs.

Check out the complex flat file (CFF) and multi-format file (MFF)stage types. (You will need to create a "mainframe" job to use these, but they perform the task you seem to be describing.) Output could use a Delimited Flat File (DFF) stage type.


Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
Post Reply