Filling a sequential file from an array

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
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

You can do this from a Routine called from a Batch or Sequence job. The OpenSeq statement opens a sequential file, Writeseq outputs a row to the file. Page 13-24 of the Server Developers manual contains the commands for Sequential File Processing. Here is an example from the manual, you just need to convert it to loop through the array or add the output commands to the code that creates the array:

OpenSeq PathName To FileVar Then
WeofSeq FileVar ;* write end-of-file mark immediately
WriteSeq "First line" To FileVar Else
On Error
Call DSLogWarn("Error from ":PathName:" status=":Status(),"MyRoutine")
GoTo ErrorExit
End
Call DSLogFatal("Cannot write to ":Pathname, "MyRoutine")
GoTo ErrorExit
End
End Else
Call DSLogFatal("Cannot open file ":Pathname, "MyRoutine")
GoTo ErrorExit
End

regards
Vincent
Post Reply