Trailer Record

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
tjmeichen
Participant
Posts: 14
Joined: Wed Aug 14, 2002 7:43 am
Location: USA

Trailer Record

Post by tjmeichen »

Hi,

I am trying to put a trailer record onto a sequential file after I have gone through the transform. I can create the record, but I am unsure of how to append it to the file that it needs to go onto. If someone could enlighten me, I would appreciate it.

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

Post by ray.wurlod »

Probably the easiest way is to use an after-stage subroutine in the final Transformer stage of your job, or an after-job subroutine.
Use the ExecSH subroutine (or ExecDOS if on a Windows platform) and use the echo command with a >> redirection operator. You can use job parameters. For example, the command executed might be:
echo Trailer Record >> #OutputFile#
This appends the text "Trailer Record" to the file whose (path)name is given in the job parameter OutputFile.
If you need to include values or other job-related information you can readily extend the concept into your own before-after subroutine which assembles the echo command in code, and then executes it via DSExecute() function. Or you can use the sequential file I/O statements in the DataStage BASIC programming language, but this would be daunting for a new DataStage user which you claim to be.
Post Reply