Would anyone have an answer as to why I can’t identify a CR (carriage return)

 

I get a file from an outside vendor and they are not consistent with adding the carriage return. I’m trying to make the script smart enough to identify if the CR is missing or not. Below is an example of the file In HEX:

 

 2020 2050 524C 4342 2048 4F53 5049 5441   Translates to       PRLCB HOSPITA

4C20 4348 4152 4745 2052 5054 2020 2020    Translates to   L CHARGE RPT

200A 0A0A 5041 5449 454E 5423 2E2E 2E2E Translates to    …PATIENT#0000

 

I’m trying to get the last line from above to look like the following:

 

200D 0A0D 0A0D 0A50 4154 4945 4E54 232E  Translates to  ……PATIENT#.

 

My code is as follows:

 

Line Input #1, Search_Line

 Search_Char = Chr(13)

Search_Results = InStr(1, Search_Line, Search_Char, 1)

If Search_Results = 0 Then

    Replacement_Data = Replace(Search_Line, Chr(10), Chr(13) & Chr(10))

Else

    GoTo OPEN_FILE_CONTINUE

End If

Close #1

Open CommonDialog.FileName For Output As 1

Print #1, Replacement_Data

Close #1

 

It will identity the line feed if I set the search_char to Chr(10), so I don’t know why it will not find the Chr(13). This routine will loop until the carriage return is found. Search_Results should contain the position if of the carriage return if found.

 

Any help will be appreciated.

 

Thanks.

 

 

 

Roger Tack

Sr. Programmer/Analyst

St. Joseph Regional Medical Center

208-799-5721

 


NOTE: This e-mail message may contain information that may be privileged, confidential, and exempt from disclosure. It is intended for use only by the person to whom it is addressed. If you have received this message in error, please do not forward or use this information in any way. Delete it immediately, and contact the sender as soon as possible by the reply option or by telephone at the telephone number listed (if available). Thank you.

Reply via email to