Jump to content


anortonbk

Member Since 16 Mar 2007
Offline Last Active Jan 08 2008 10:35 PM
-----

Topics I've Started

CLOB text data

08 January 2008 - 09:30 PM

We're in a migration, and several of our text files - which were keyed on sequence number, so you may have line 0001, 0002, etc. for your text, are converted to CLOB fields. Problem is, we had code that set the text values based on the line sequence - we wanted certain text on line 1 or line 2, etc.

How can I tell where I am in a CLOB, is there any way to know which line I'm reading??

Appreciate any feedback!!

Handling funky characters

27 March 2007 - 07:25 PM

I have an update that reads a field, which is populated by another system. My program is expecting pipe delimited text. However, odd characters are often embedded in the text - I'll attach a few screen shots. When my program is reading the field, if it happens to cross one of these funky characters, it can't handle it, and nothing from that point forward is written or processed.

So far, it doesn't appear that we can pinpoint how these characters are getting embedded in the text, so I would love to know how to handle this on my end. The problem is that it is unpredictable, so seeing as it is impossible to set up code to handle every potential character that could be in the text field, is there any way for me to strip these out????

When you look in the database, you can't see them, but when I display after reading, you can.

Please HELP!!

Thanks a ton in advance!

Carriage return character

21 March 2007 - 06:26 PM

My system is receiving data from another system, and I'm reading the file and writing to another custom file. Some times this data contains carriage returns. The text is delimited by pipes | but, when the data contains carriage returns, this looks funky when displayed or printed. If I know how to recognize a carriage return, I can handle this.

What is the character for a carriage return??

Stuck in a loop

17 March 2007 - 03:06 PM

Here's the situation - I'm reading a 500 character text field, and want to break it into individual 70 character chunks and write each 70 character chunk as a record in a lines file. I am trying to parse where there is a space ' ' so that I don't chop a word in half.

I've got myself in an endless loop, and I know it'll be obvious to someone else what I'm doing wrong, I've just been staring at it too long. Here's my code:

$$FIELD= FIELD
#LEN = LEN($$FIELD)
#BEG = 1
WHILE #Y < #LEN
#END = #BEG + 70
FOR #X = #END DOWNTO #BEG BY -1
IF $$FIELD(#X,1) = ' ' THEN
#A = #X
#X = #BEG
ENDIF
ENDFOR
$LINE = $$FIELD(#BEG,#A)
LSCALL $LNCMNTS $LNCMNTS will write this chunck of text the line the line file
#Y = #A + 1
$$FIELD= $$FIELD(#Y,#LEN)
#BEG = #Y
ENDWHILE