CLIPPED in 4GL behaving differently in latest rev
Posted in 1999
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL
We are currently using I4GL 7.20.UD1. In some of our reports, we output a Carriage Return at the end of a line. In order to do this, we assign the value ASCII 13 to the end of a character buffer containing the line to be outputted. Then, when the line is printed, we clip the line. In the following program, testcr.4gl, if you run testcr.4ge>test.out, you will only see a ^M at the end of the first line. The second line will clip the carriage return. In previous revisions of 4GL, it did not clip the carriage return. Also, under D4GL, it does not clip the carriage return (it prints two lines with ^M at the end of each). Has anyone else had problems with this and is this a bug? Thanks! Candy -- Candy McCall ONLINE Computing, Inc. (candym@olcinc.com) testcr.4gl: main define p_string char(32), i smallint for i = 1 to 32 let p_string[i,i] = " " end for let p_string[1,32] = "test" let p_string[32,32] = ASCII 13 display p_string display p_string clipped end main ~
Candy McCall wrote: > > We are currently using I4GL 7.20.UD1. > > In some of our reports, we output a Carriage > Return at the end of a line. In order to do this, > we assign the value ASCII 13 to the end of > a character buffer containing the line to > be outputted. Then, when the line is printed, > we clip the line. > > In the following program, testcr.4gl, if > you run testcr.4ge>test.out, you will only > see a ^M at the end of the first line. The second > line will clip the carriage return. In previous > revisions of 4GL, it did not clip the carriage > return. Which previous revisions are you referring to? 6.05, or 4.10, or somewhere in between? I'd hazard a guess that you are referring to some 4.x version, but I'd like confirmation of which version you are referring to. > Also, under D4GL, it does not clip > the carriage return (it prints two lines with > ^M at the end of each). In case of doubt, D4GL hews very close to the 4.10 behaviour. > Has anyone else had problems with this and > is this a bug? No, I've not had the problem, but I've never had cause to run into it -- I don't recall needing to use CR in a report ever. Is this a bug? Possibly. It depends on how CLIPPED is supposed to work. If it is supposed to remove blanks (ASCII SP, code 32), then yes. If it supposed to remove trailing white space (as defined by the isspace() macro for the locale), then no, it isn't. This distinction would probably be made for NLS and GLS reasons, which is why I think you're comparing with 4.x rather than 6.x. > testcr.4gl: > > main > > define p_string char(32), > i smallint > > for i = 1 to 32 > let p_string[i,i] = " " > end for > let p_string[1,32] = "test" > let p_string[32,32] = ASCII 13 > display p_string > display p_string clipped > end main Another thing that can throw a spanner in the works is how the terminal is configured to post-process carriage return and line feed (new line) characters. However, I don't think that's immediately relevant. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN #include <disclaimer.h>