Hi,
Source has 'desc1' field that contains 6000 characters (max) and that need to be split into several records of 100 chars each
ex. 1 Record ('desc1' - 720 characters) => 8 Records (7 records with 100 characters each and 8th record will contain 20 characters)
Field data split
Moderators: chulett, rschirm, roy
Hi,
I think you might find a routine to do this is apropriate.
simply concatenate the field delimiter after every 100 characters.
I think something like a:
probably you'll need to debug this code since it is spontanious code, not debuged or syntax proof!
IHTH,
I think you might find a routine to do this is apropriate.
simply concatenate the field delimiter after every 100 characters.
I think something like a:
Code: Select all
newStr = ''
fieldDelimiter = "," * change this to fit your delimiter
strLength = Len(str)
idx =0
for i = 0 to strLen step 100
If i <= strLen And i > 0 Then newStr := fieldDelimiter
newStr := str[1+i,100]
idx = i+1
next i
newStr := str[idx,strLength - idx]
IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Roy has tried to write the Fold() or Fmt() function, which already exist as intrinsic DataStage BASIC functions to do exactly what you ask.
Use this design.
Read one column from source.
In the Transformer stage apply the Fold() function, then convert field marks to column separator characters.
Convert(@FM, "|", Fold(InLink.SourceCol, 100))
or
Convert(@TM, "|", Fmt(InLink.SourceCol, "100L"))
Write one column to the Sequential File stage, with 000 as the delimiter character, and 000 as the quote character.
Read from the Sequential File stage using "|" as the delimiter character.
Use this design.
Code: Select all
source -----> Transformer -----> SeqFile -----> (more)
In the Transformer stage apply the Fold() function, then convert field marks to column separator characters.
Convert(@FM, "|", Fold(InLink.SourceCol, 100))
or
Convert(@TM, "|", Fmt(InLink.SourceCol, "100L"))
Write one column to the Sequential File stage, with 000 as the delimiter character, and 000 as the quote character.
Read from the Sequential File stage using "|" as the delimiter character.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Well Guess that happens when no DS available and my memory core dumps
Roy R.
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org