A flatfile contains 200 records.I want to load first 50
records at first time running the job,second 50 records at
second time running and so on,how u can develop the job?pls
give the steps?pls pls
Answers were Sorted based on User's Feedback
Answer / varun
Design the job like this:
1. Read records from input flat file and click on option of
rownumbercolumn in the file. It will generate a unique
number corresponding to each record in that file.
2. Use filter stage and write the conditions like this:
a. rownumbercolumn<=50(in 1st link to load the records
in target file/database)
b. rownumbercolumn>50 (in 2nd link to load the records
in the file with the same name as input file name, in
overwrite mode)
So, first time when your job runs first 50 records will be
loaded in the target and same time the input file records
are overwritten with records next first 50 records i.e. 51
to 200.
2nd time when your job runs first 50 records(i.e. 51-100)
will be loaded in the target and same time the input file
records are overwritten with records next first 50 records
i.e. 101 to 200.
And so on, all 50-50 records will be loaded in each run to
the target
| Is This Answer Correct ? | 19 Yes | 9 No |
Answer / sreekanth reddy peddakkagari
Answer given by varun is exactly correct but there is a
small correction in the answer, as varun told that at the
same time we can not use same file name as the source as
well as target , so we need to read from actual file
(Ex:Source.txt) write it to new file(Ex:New_Source.txt),
after that we need to rename the new file to old file using
after Subroutene(mv New_Source.txt Source.txt).
| Is This Answer Correct ? | 7 Yes | 1 No |
other than VARUN solution
1. Add 'row number' column in Seq File stage, so that each record has a number associated with it.
2. Add a job param with which we can provide the number of record from where we want to run the job. We can pass this either using Sequence Start LOOP(List type variables-50,100,150,200) or by shell script.
3. In the tfm, use a stage variable to run only from the record number till 50 records by counting each record.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / sarath
i think using global parameter we can achieve this in transformer . first set the parameter value to 0 or 1 and finally after transforming set the parameter value to max(rownum) so that the value will b updated. for the next time using use that parameter as the starting point to load the data.
sorry if it is wrong.
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / siva
i thing we can solve this problem using mapping paraeter,workflow variable
| Is This Answer Correct ? | 0 Yes | 0 No |
Follow the steps:
1: import source definition(relational or flat file)
2: create mapping parameter $$m_count with datatype double
3: create expression transformation map all the output ports of source qualifier to expression.
4: create a variable port v_cnt and in expression write v_cnt+1
5: create an output port o_cnt and assign v_cnt to it.
6: take filter transformation, map all the output ports to filter and in filter condition write o_cnt<$$m_count and o_cnt>$$m_count-50
7: map all the output ports to target and save the mapping.
8: create a workflow for the mapping and then create a workflow variable $$wf_count with double datatype and enable persistent option.
9: create an assignment task and in the expression tab for user-defined variable choose $$wf_count and for expression write $$wf_count+50.
ex: $$wf_count=$$wf_count+50
10: now create the session for the mapping and go to session properties then select components tab, go to pre-session variable assignment column then open value and then there select mapping variable $$m_count and parent workflow variable $$wf_count
ex: $$m_count=$$wf_count.
11: save the workflow and execute.
That's it.......
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / lakshmi
i think using scheduling proces in server jobs.
| Is This Answer Correct ? | 1 Yes | 4 No |
when we will use connected Lookup & Unconnected Lookup
I have a scenario like Deptno=10---->First record and last record Deptno=20---->First record and last record Deptno=30---->First record and last record I want those first and last records from each department in a single target. How to do this in DataStage, any one can assist me. Thanks in advance.
Differentiate between validated and Compiled in the Datastage?
how to delete one row in target dataset
hi everbody, i have a problem in my project.. Native Error Code: -407 "Assignment of a null value to a not null column" hi everbody, i have a problem in my project.. Native Error Code: -407 "Assignment of a null value to a not null column" i have no idea, what should i do..please help :(
how to closeing records after 10,000 records come?
How u implement the slowly changing dimensions if my source table is consisting of cid,cname,add,phno,email but i need to capture the changes for first three columns how u implement?
how do u capture duplicates through sort & transformer
How you Implemented SCD Type 1 & Type 2 in your project?
What are routines in datastage? Enlist various types of routines.
What is the difference between passive stage and active stage?
Why fact table is in normal form?