how to move one record by 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
parvathi
Participant
Posts: 103
Joined: Wed Jul 05, 2006 4:48 am
Contact:

how to move one record by record

Post by parvathi »

Hi all

I have a following a requirment like this...

I have dsx file of particular job as an input file like this....
This is just a part of the dsx file


BEGIN DSSUBRECORD
Name "sNo"
SqlType "4"
Precision "10"
Scale "0"
Nullable "0"
KeyPosition "1"
DisplaySize "1"
Derivation "DSLink3.sNo"
Group "0"
ParsedDerivation "DSLink3.sNo"
SourceColumn "DSLink3.sNo"
SortKey "0"
SortType "0"
TableDef "Sequential\\Angel\\cnt_in.txt"
AllowCRLF "0"
LevelNo "0"
Occurs "0"
PadNulls "0"
SignOption "0"
SortingOrder "0"
ArrayHandling "0"
SyncIndicator "0"
PadChar ""
ColumnReference "sNo"
APTFieldProp "quote=none"
ExtendedPrecision "0"
TaggedSubrec "0"
OccursVarying "0"
PKeyIsCaseless "0"
END DSSUBRECORD

Now i get the "sNo" ,precision and the value the precision (4 th line) has to take for ex--67 through the paramenter
After getting the record lwith Name and sNo --- first record
How can i move to precision record and change its value to 67...

I have to do this in the transformer..

my stage are as follows..

sequential stage----->transformer------->sequential stage


input sequential stage is " delimited

so the first column is names and the secod column is values...

can i do with stage variables....

can anybody suggest me an idea.....
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I usually do this kind of processing using "states". I will use stage variables to store state information and other relevant values. In your processing you could create a stage variable such as "CurrentType" which is set when a record begins with BEGIN and set to the value of the 2nd word (i.e. field(In.Column,' ',2)). Do the same type of thing to get the name. Then when you reach a record that starts with "Precision" you can check your state to see if you are in a SUBRECORD and have an object named "sNo" and can then modify the output to reflect the new precision.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I think what Arnd is trying to say also was treat each line as if it is one field. You need several stage variables like

FirstWord = field(InputLine, " ", 1)
SecondWord = field(InputLine, " ", 2)
States = if FirstWord = "OLEType" then SecondWord else States
Name = if FirstWord = "Name" then SecondWord else Name


Now just output every line but change the InputLine when FirstWord = "Precision" and Name = "sNo"
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

:idea: There's always the FieldStore() function to replace the value in the Nth delimited field.
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