Question Carriage Return/Line Feed

Hi All,

Just want to ask I'm just trying to upload a file but it seem having a Carriage Return/Line Feed and excluded the other value, could someone help me to excluded the Carriage Return/Line Feed upon uploading?


Thanks
 

Cringer

ProgressTalk.com Moderator
Staff member
CHR(10) and CHR(13) are the characters you are wanting to exclude. But without further info on what you're trying to achieve it's going to be tricky to help you.
 

RealHeavyDude

Well-Known Member
Carriage return + line feed is only used on Windoze. Unix/Linux only uses line feed - maybe the file you are uploading was not produced on Windows.

You might want to have a look here:
http://en.wikipedia.org/wiki/Newline

On some Unix/Linux system you can user unix2dos ( and it's pendant dos2unix ) to fix that.

Heavy Regards, RealHeavyDude.
 
Hi ,

actually if you see my previews post about HL7, the data inside the file that being extracted using HL7 have a Carriage Return/Line Feed, when i try to copy the data on the notepad++ and show all special character i saw a CR LF, and that's the reason when I'm trying to upload the data and put in the variable and display the variable its breaking the line
 
Hi Cringer,

this is the file

MSH|^~\&|ISH|ISH^BVH|CLOVERLEAF|CLOVERLEAF|20150302105115|NP11I0|ADT^A01|00338104|P|2.3|||AL|NE
EVN|A01|20150302105115|||IBMSWX|NP11I0
PID|||S8841454^C^M11^MRN||CHIA XIN LING^^^^Mr||19881027|M||CN|JURONG WEST STREET 64^^669C^^^^^^643669^SG||||EN|M||||P^P||||||1||SG||N
NK1||CHIA XIN LING||JURONG WEST STREET 64^^669C^^^^^^643669^SG
PV1||I|W73^^^SG|1|||11438C^COLIN PHIPPS DIONG^^^^AC|||DIM|||^Y|1||N|84333D^CHIONG YI^^^^HO||6715100608A^A^M10|B2+~4|||||||||N|||||||||||||||20150302105012|||||||Y
PV2||CCUB2+|||||||||||20|||||||||||||||20150302105012


if you notice the MSH,EVN,PID,NK1,PV1,PV2 they were arrange in a row, try to copy this file in a notepad it's a single line only.

so i will import this whole record and place it in a variable the value that was capture was this only

MSH|^~\&|ISH|ISH^BVH|CLOVERLEAF|CLOVERLEAF|20150302105115|NP11I0|ADT^A01|00338104|P|2.3|||AL|NE

i trying to achieve was if i can remove the Carriage Return/Line Feed and capture all the data in single variable
 

Cringer

ProgressTalk.com Moderator
Staff member
What Progress Version? You could use
COPY-LOB from file <filename> to object <char>.
Where <char> is a longchar variable. Then you can remove all the CHR(10) and CHR(13) entries using a replace and then you'll be good to go.
 
Hi Tom,

like this

Code:
DEFINE VARIABLE cval AS CHARACTER   NO-UNDO FORM 'x(32000)'.
DEFINE VARIABLE strm AS CHARACTER   NO-UNDO.
DEFINE STREAM strm.

INPUT STREAM strm FROM value("d:\BVH_CHCSADT_test_000000523.txt").
    IMPORT STREAM strm DELIMITER "~r~n" cval.  
INPUT STREAM strm CLOSE.

MESSAGE cval
    VIEW-AS ALERT-BOX INFO BUTTONS OK.

where the content of d:\BVH_CHCSADT_test_000000523.txt and a hidden CR/LF that's why the EVN,PID,NK1,PV1,PV2 was on the new line

Code:
MSH|^~\&|ISH|ISH^BVH|CLOVERLEAF|CLOVERLEAF|20150302105115|NP11I0|ADT^A01|00338104|P|2.3|||AL|NE
EVN|A01|20150302105115|||IBMSWX|NP11I0
PID|||S8841454^C^M11^MRN||CHIA XIN LING^^^^Mr||19881027|M||CN|JURONG WEST STREET 64^^669C^^^^^^643669^SG||||EN|M||||P^P||||||1||SG||N
NK1||CHIA XIN LING||JURONG WEST STREET 64^^669C^^^^^^643669^SG
PV1||I|W73^^^SG|1|||11438C^COLIN PHIPPS DIONG^^^^AC|||DIM|||^Y|1||N|84333D^CHIONG YI^^^^HO||6715100608A^A^M10|B2+~4|||||||||N|||||||||||||||20150302105012|||||||Y
PV2||CCUB2+|||||||||||20|||||||||||||||20150302105012
can someone advice me about this
 

RealHeavyDude

Well-Known Member
You should have a look into the copy-lob statement. You can copy the whole file in one statement into a variable of type longchar. From there you can either move it into a character ( if it does not exceed the limits of the character data type ) or do other string operations on it.

Code:
COPY-LOB
[ FROM ] { [ OBJECT ] source-lob | FILE source-filename }
[ STARTING AT n ] [ FOR length ]
TO { [ OBJECT ] target-lob [OVERLAY AT n [TRIM ] ] |
FILE target-filename [ APPEND ] }
[ NO-CONVERT | CONVERT convert-phrase ]
[ NO-ERROR ].

Heavy Regards, RealHeavyDude.
 

Cringer

ProgressTalk.com Moderator
Staff member
What Progress Version? You could use
COPY-LOB from file <filename> to object <char>.
Where <char> is a longchar variable. Then you can remove all the CHR(10) and CHR(13) entries using a replace and then you'll be good to go.

Just quoted to back up RHD's statement. This is what you need.
 
Top