Page 1 of 4

CR/LF for the new generation

Posted: Fri Jan 19, 2007 10:10 pm
by I_Server_Whale
Have you heard about a typewriter? Well, a typewriter is a mechanical device which was used last century to produce printed documents. :D

After you have typed one line of text on a typewriter, you have to manually return the printing carriage to the left margin position and manually feed the paper up one line.

In Windows applications, a new line is normally stored as a pair of characters: carriage return (CR) and line feed (LF). The character pair bears some resemblance to the typewriter actions of setting a new line. In Unix applications, a new line is normally stored as a LF character. Macintosh applications use only a CR character to store a new line.

HTH,
Whale.

Posted: Fri Jan 19, 2007 10:18 pm
by DSguru2B
O yea. Remember seeing one of those at my uncle's place. Some invention that was.

Posted: Sat Jan 20, 2007 12:28 am
by narasimha
Used that, quite a bit :lol:

Posted: Sat Jan 20, 2007 12:35 am
by ray.wurlod
Some of the early printers also perform physical carriage return and line feed. If you ever configured UniVerse (or even DataStage) to work with one of these, you included in the configuration a small delay to allow these physical activities to occur. These delays remain provided for, because these printers are still out there.

Posted: Sat Jan 20, 2007 1:10 pm
by I_Server_Whale
ray.wurlod wrote:Some of the early printers also perform physical carriage return and line feed.
Are you referring to those dot matrix printers or impact matrix printers? :wink:

Posted: Sat Jan 20, 2007 3:52 pm
by ray.wurlod
Not only those, but also typewriter-based variants like the IBM golfball. I still have one of those.

Posted: Sat Jan 20, 2007 7:27 pm
by chandankambli
Hello all:

It may sound off the topic, but how do you deal and preserve carriage returns that comes in data?

We get data from mainframes in sequential file of unstructred nature (texts) and we want to preserve the formats that people have maintained in mainframes. so that meaningful reports can be generated once it gets loaded in to DWH tables.

How do we find if there is any CR & LF in the data? How do we preserve CR & LF? Are there any functions in DS that allow you to do that?

Pls. reply.

Posted: Sat Jan 20, 2007 8:36 pm
by I_Server_Whale
chandankambli wrote:How do we find if there is any CR & LF in the data? How do we preserve CR & LF? Are there any functions in DS that allow you to do that?
Pls. reply.
The CR & LF are not visible in normal text editor. They are visible in editors like utraedit, editplus, etc. The decimal ASCII equivalents for CR & LF are:

Code: Select all

LF ---> 10            CR ---->13
You can find more ASCII codes here.

In DataStage, you can always insert or embed CR & LF in/to a string by concatenating char(10) for LF and char(13) for CR.

Whale.

Posted: Sat Jan 20, 2007 9:02 pm
by kcbland
The CR/LF is maintained, provided when you write data to sequential files you use either fixed width files or delimited files with quoted columns and check the format box that says data contains terminators.

Posted: Sun Jan 21, 2007 8:14 pm
by narasimha
If you want to check in a Hex editor, the Hex value equivalents of CR and LF -

Code: Select all

CR ---->0D 
LF ---->0A

Posted: Sun Jan 21, 2007 9:23 pm
by kumar_s
chandankambli wrote:Hello all:
How do we find if there is any CR & LF in the data? How do we preserve CR & LF? Are there any functions in DS that allow you to do that?
You copy book should take care of that. But once you load into tables, you wont require the Line termination yet. As these characters are used as a record delimieter in sequential files.
Where as records are maintained as is in Database.

Posted: Sun Jan 21, 2007 11:33 pm
by aartlett
I_Server_Whale wrote:
ray.wurlod wrote:Some of the early printers also perform physical carriage return and line feed.
Are you referring to those dot matrix printers or impact matrix printers? :wink:
If Ray is of my generation (and from the photos may be the one prior to mine IT wise :) ) then we are talking belt fed impact printers where a high speed, rotating bed of characters has the paper pressed against it by the hammers.

To underscore a carriage return is issued without a linefeed and they are printed accordingly.

Sometimes, instead of a blet of characters, blocks of 5 characters whizz around. These were a pain as they were much harder to clean.

Bring back core memory ... more than 4k in a room is too much.

Posted: Mon Jan 22, 2007 4:36 am
by ArndW
I used to love the speed and sound of a high-speed Printronix belt printer and was surprised last week to find one still hard at work at this site! I recall (not so fondly) of having to clean and maintain a couple that we had at college a couple of years back... they always did get very grimy with a nasty paste consisting of partially dried ink and paper fuzz and left more of a mess on my clothing than going to a pasta dinner with a white shirt.

Posted: Mon Jan 22, 2007 8:25 am
by chulett
The same flavor of printers, I'd wager, that the geeks at the time would have play 'music' at trade shows. :lol: Print the right pattern at high speed... impresses the natives... wastes alot of paper.

Posted: Mon Jan 22, 2007 8:57 am
by ArndW
Craig - we used to have a program that we could run on PRIMOS and our old IBM 90Mb disk drives would "walk" across the floor - the program timed the heavy disk read/write heads to move in just the right frequency to shake the drive enough to move it around (if you did it too long the power or data cables would rip right out).