Carriage Return and Line Feed

978 views
Skip to first unread message

Suman

unread,
Mar 20, 2013, 8:18:59 AM3/20/13
to intersystems...@googlegroups.com
I am doing a footer validation in a file.

For example The file contains

ABCD$C(9)EFGH
END OF FILE<CR><LF>


Whenever we will press one ENTER at the end two characters will be inserted.

But when I am checking the length of the last line i.e END OF FILE<CR><LF> 

It it is not counting the length of <CR><LF> ($C(13),$C(10)).

If we do a $L(lastLine) it is returning 11 not 13.

Could any one please explain the reason.


Michael McEntee

unread,
Mar 20, 2013, 10:09:17 AM3/20/13
to intersystems...@googlegroups.com
Hi,

I believe the issue is that you are reading it back in from a file, and the $c(13,10) is used as the terminator of the line.

If you were to set a variable directly to $c(13,10) then w $l of that variable it would return 2.

I haven't tried this before, but I believe the only way to get around this is to read the file as a stream.

Michael



--
--
Caché, Ensemble, DeepSee
 
---
You received this message because you are subscribed to the Google Groups "Caché, Ensemble, DeepSee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to intersystems-publi...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Wicked

unread,
Mar 21, 2013, 4:55:17 AM3/21/13
to intersystems...@googlegroups.com
I believe that if you are reading the file with OPEN and then READ line then it reads the whole line but without the line-separating characters ($c(13,10)).
So you can try to read it character by character like this:

OPEN something
READ *character

And then to append it to the buffer do:

S buffer = buffer _ $C(character)

lverhulst

unread,
Mar 21, 2013, 12:09:06 PM3/21/13
to intersystems...@googlegroups.com
<CR><LF> are line terminator characters and are not read in with the normal READ command. Here is a section of the documentation on READ:
READ Terminators
Caché terminates a read operation when the input string reaches the specified length (for single-character READ and fixed-length READ). For a variable-length READ, Caché terminates reading if the input string reaches the maximum string length for the current process.
Caché also terminates reading when it encounters certain terminator characters. The terminators are determined by the device type. For example, with terminals, the default terminators are RETURN (also known as the <Enter> key) (ASCII 13), LINE FEED (ASCII 10), and ESCAPE (ASCII 27).
You can modify the terminator default when you issue an OPEN or USE command for a device. OPEN and USE allow you to specify a terminator parameter value. See the Terminal I/O chapter of the Caché I/O Device Guide for OPEN and USE protocols for terminals. See the I/O Devices and Commands chapter of the Caché I/O Device Guide for details about terminators based on device type.
Caché does not store the input terminator with the input value for variable-length and fixed-length reads; it records it in the $KEY and $ZB special variables. Caché does store the input terminator (if specified) as the input value for a single-character read.

--Leane


Mike Kadow

unread,
Mar 21, 2013, 12:19:41 PM3/21/13
to intersystems...@googlegroups.com
I just upgraded to a new PC, System 7 and now running Cache 2011.
I extracted my system/database entries from my old Registry.
How do I insert them into my new PC, other than manually?
 
-thanks
 
-Mike

Tommy Martin

unread,
Mar 22, 2013, 3:29:50 PM3/22/13
to intersystems...@googlegroups.com
I exported mine into a .reg file right out of the registry and then sent it to my new system and then just merged it. However be advised that if you went from XP to Win 7 you have to change the registry path in the .reg file.

--
Reply all
Reply to author
Forward
0 new messages