How to find EOF using DataStage

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
parag.s.27
Participant
Posts: 221
Joined: Fri Feb 17, 2006 3:38 am
Location: India
Contact:

How to find EOF using DataStage

Post by parag.s.27 »

Hello All,

Can you please tell me, whether there is any inbuilt function or routine in DS to find the end-of-file. Currently I am not able to find an economical way.

I am using ExecDOS before stage subroutine and calling a batch file that finds the EOF, also it is doing same in Command Stage, but the problem is, how can I use the output of this DOS command in my transformer.

For e.g. I have to find the EOF and then in the next line I have to insert some identification flag. so that when next time the data gets appended to this file, I'll be using the flag to define the constraints in the transformer.
Thanks & Regards
Parag Saundattikar
Certified for Infosphere DataStage v8.0
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The normal method of reading a sequential file in a DataStage job does not let you append a row easily using that methodology.
This can be done with a simple command at DOS or UNIX, you can also open and append data to a sequential file from inside a DataStage routine (using OPENSEQ and SEEK)
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Run the OS level command using DSExecute() in a routine. Reference that routine inside the transformer.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

You are appending a flag to a file. Like
Cat 'Flag' >> File.
You can use tail command to read the last line in CommandActivity and use the CommandOutput to pass the value as parameter to the job.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
parag.s.27
Participant
Posts: 221
Joined: Fri Feb 17, 2006 3:38 am
Location: India
Contact:

Post by parag.s.27 »

DSguru2B wrote:Run the OS level command using DSExecute() in a routine. Reference that routine inside the transformer.
I have tried a similar approach like calling the command in command stage and then the COMMANT.OUTPUT value of command stage is fed to transformer directly.

It is throwing an error of Command not recognized as internal or external command. But when i run the same command from DOS prompt, it works fine. Is it like DS supports a particular version of DOS
Thanks & Regards
Parag Saundattikar
Certified for Infosphere DataStage v8.0
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

parag.s.27 wrote:Is it like DS supports a particular version of DOS
No, it just leverages whatever it is you got. Post your command.
-craig

"You can never have too many knives" -- Logan Nine Fingers
parag.s.27
Participant
Posts: 221
Joined: Fri Feb 17, 2006 3:38 am
Location: India
Contact:

Post by parag.s.27 »

chulett wrote:
parag.s.27 wrote:Is it like DS supports a particular version of DOS
No, it just leverages whatever it is you got. Post your command. ...
Hi,

I am using the command as

Code: Select all

cd\

FIND /N /C "WRI001" c:\Parag\sage_dovegate_inddata_sales_ledger.rpt >> c:\Parag\cmdout.txt
here WRIoo1 is the flag value.
Thanks & Regards
Parag Saundattikar
Certified for Infosphere DataStage v8.0
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Can you wrap that command in a .cmd or .bat file and execute that bat file from DSExecute()?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
asitagrawal
Premium Member
Premium Member
Posts: 273
Joined: Wed Oct 18, 2006 12:20 pm
Location: Porto

Post by asitagrawal »

Open the file using OpenSeq.
Use SEEK to move the pointer to EOF.

Refer BASIC guide for more details.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Not a good solution, because the file variable that you SEEK to eof only has scope within the routine. The OP's requirement was to "find" eof (whatever that means - I have no idea). You could get the size of the file (from DIR) and use that, I guess, as the address of EOF. But what purpose will it serve?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply