Intelligent word wrapping
Moderators: chulett, rschirm, roy
Intelligent word wrapping
I have a requirement to read a field with Datatype Varchar2(800) from oracle table and split it into 20 columns of 40 characters each. However, if the word being read is not complete at the end of 40 characters for a particular line, then i need to wrap the line at a previous word and put this word on a new line .
For eg. the input field is like :
"I have a requirement to read a field with Datatype Varchar2(800) from oracle table and split it into 20 columns of 40 characters each."
I want to read the first 40 characters from this line but say the 40th character ends at "Ora" of the word "oracle", i need to end the line on the previous word "from" and put oracle on the next line.
I understand from other posts that such a thing can be done using Column Import but do not know how to use it.
Can anyone please help on how do i achieve this ?
For eg. the input field is like :
"I have a requirement to read a field with Datatype Varchar2(800) from oracle table and split it into 20 columns of 40 characters each."
I want to read the first 40 characters from this line but say the 40th character ends at "Ora" of the word "oracle", i need to end the line on the previous word "from" and put oracle on the next line.
I understand from other posts that such a thing can be done using Column Import but do not know how to use it.
Can anyone please help on how do i achieve this ?
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Welcome aboard.
There's nothing out of the "natively parallel" box that will do this for you, but you could write your own routine.
That said, you can use a server job, a server shared container or a BASIC Transformer stage and make use of the Fmt() function. For example load a stage variable, let's call it svChoppedString, with
Define column1 as Field(svChoppedString,@TM,1,1).
Define column2 as Field(svChoppedString,@TM,2,1).
And so on.
The "20T" in the Fmt() function specifies 20 character maximum width, "text formatting" (= break on whole word boundaries).
Note that you may need more than 40 fields, perhaps 41 or 42.
There's nothing out of the "natively parallel" box that will do this for you, but you could write your own routine.
That said, you can use a server job, a server shared container or a BASIC Transformer stage and make use of the Fmt() function. For example load a stage variable, let's call it svChoppedString, with
Code: Select all
Fmt(InLink.LongString, "20T")
Define column2 as Field(svChoppedString,@TM,2,1).
And so on.
The "20T" in the Fmt() function specifies 20 character maximum width, "text formatting" (= break on whole word boundaries).
Note that you may need more than 40 fields, perhaps 41 or 42.
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.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
When the Fmt() function breaks the string, it inserts a special delimiter called a "text mark" in at each break point. This special character is available through the system variable @TM. Internally it is represented by the single byte whose decimal value is 251 (or 0xFB if you prefer).
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.
-
- Premium Member
- Posts: 138
- Joined: Wed Jul 16, 2008 9:51 pm
- Location: Kolkata
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
It's not on the Palette. The BASIC Transformer stage is to be found in the Stage Types branch of the Repository. It is NOT the same as the server Transformer stage - for example the BASIC Transformer stage does not support reference inputs.
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.
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom