loading the first record only
Moderators: chulett, rschirm, roy
loading the first record only
Hi there,
I have a sequential file, transform and oracle stage.
I want to load only the first record from the sequential file into my oracle table.
Is there a way to do this?
Thanks!
I have a sequential file, transform and oracle stage.
I want to load only the first record from the sequential file into my oracle table.
Is there a way to do this?
Thanks!
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
When you run a job from the director you are presented with a screen that asks how many rows you want to process. You can limit the job to just one row by setting this number to 1. If you call it up from a Batch I believe you can also set this value to process just one row.
Don't have the DataStage software in front of me right now so I can't tell you exactly where these options are.
Vincent McBurney
Data Integration Services
www.intramatix.com
Don't have the DataStage software in front of me right now so I can't tell you exactly where these options are.
Vincent McBurney
Data Integration Services
www.intramatix.com
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Limiting the rows to be processed leaves your job in a Stopped state. It may require to be reset.
Another approach to this is to pre-process the file, via ExecSH (on UNIX). For example, if the file whose first row only is what you want is called file1, then run the command "head -1 file1 > file2" via ExecSH then have DataStage process file2.
Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
Another approach to this is to pre-process the file, via ExecSH (on UNIX). For example, if the file whose first row only is what you want is called file1, then run the command "head -1 file1 > file2" via ExecSH then have DataStage process file2.
Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
Tested a job reading and writing a sequential file with the "Stop Stages after" set to 1 rows and it worked well. Processed the row and returned to a Finished state.
writecsv..CTransformerStage1: DSD.StageRun Active stage finishing.
1 rows read from DSLink3
1 rows written to DSLink4
The bonus here is that you can use the same job for a single row that you would use for the entire file. From a routine or batch job you can use the DSSetJobLimit function with the limit type of DSJ.LIMITROWS.
Vincent McBurney
Data Integration Services
www.intramatix.com
writecsv..CTransformerStage1: DSD.StageRun Active stage finishing.
1 rows read from DSLink3
1 rows written to DSLink4
The bonus here is that you can use the same job for a single row that you would use for the entire file. From a routine or batch job you can use the DSSetJobLimit function with the limit type of DSJ.LIMITROWS.
Vincent McBurney
Data Integration Services
www.intramatix.com
Hi there,
I tried typing just @INROWNUM > 2 in the constraint section of my transform stage (which reads data IN from a sequential file OUT to an oracle table), and it did not work.
Is there something else which I have left out?
I'd like to skip the first 2 records of this text file and begin importing at row/line 3. Can this be done?
Thanks.
I tried typing just @INROWNUM > 2 in the constraint section of my transform stage (which reads data IN from a sequential file OUT to an oracle table), and it did not work.
Is there something else which I have left out?
I'd like to skip the first 2 records of this text file and begin importing at row/line 3. Can this be done?
Thanks.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
Here's where it gets confusing! You've specified in your run options that you only want to process one row. You have a constraint that halts the first two rows at the transformer stage. You are processing just one row and it is being rejected by your constraint. You need to up the number of rows processed to 3 to ensure your constraint rejects the first 2 rows and you get the 3rd row processed.
Vincent McBurney
Data Integration Services
www.intramatix.com
Vincent McBurney
Data Integration Services
www.intramatix.com