CR/LF for the new generation

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

CR/LF for the new generation

Post 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.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

O yea. Remember seeing one of those at my uncle's place. Some invention that was.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Used that, quite a bit :lol:
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post 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:
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Not only those, but also typewriter-based variants like the IBM golfball. I still have one of those.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chandankambli
Participant
Posts: 14
Joined: Sun Jun 11, 2006 2:16 pm

Post 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.
Thanks experts.
datastage_learner
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post 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.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post 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.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post 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
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
aartlett
Charter Member
Charter Member
Posts: 152
Joined: Fri Apr 23, 2004 6:44 pm
Location: Australia

Post 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.
Andrew

Think outside the Datastage you work in.

There is no True Way, but there are true ways.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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).
Post Reply