Columns do not line up on emailed reports

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

Moderators: chulett, rschirm, roy

Post Reply
joycerecacho
Participant
Posts: 298
Joined: Tue Aug 26, 2008 12:17 pm

Columns do not line up on emailed reports

Post by joycerecacho »

Hi everybody!

I have an issue.
I am trying to send a report by e-mail through DataStage.

The job creates a file with their columns perfectly aligned.
When I see its structure at the Unix terminal, it is perfect...but when I see it at my Outlook, is it not properly configurated.

Example:
Outlook View

Column1 Column2 Column3 Column4
10 50 10 50
10 1000 10 50
10 50 10 50
10 1000 10 50


I tried with and without delimiters, with all fields, or all fields concatenated in just one...

I filled the empty spaces with ' ' to complete the length of the fields.

The email was sent through shell command at the 'after job routine', as follows:

mail -s "Email Subject" address@domain.com.br < emailBodyFile.csv


PS: if I copy and paste the email content in a notepad, for example, it becomes perfectly aligned.
What is missing?

Thanks in advance guys.

Best regards,
Joyce A. Recacho
São Paulo/SP
Brazil
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Perhaps try using a ".txt" extension rather than ".csv"?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Teej
Participant
Posts: 677
Joined: Fri Aug 08, 2003 9:26 am
Location: USA

Post by Teej »

This is most likely Outlook's fault. I have seen the same thing where a formatted e-mail in a different mail program (i.e. Notes) does not look properly formatted in Outlook.

Try a different mail program.

-T.J.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I'd also be curious what exactly what see it in Outlook means? You mean the preview pane while still inside the Outlook email? Or after double-clicking the attachment so it opens up in another tool? Assuming the former as the latter would open a csv file in Excel... and if changing the extension makes no difference there may be an Outlook setting you need to change so it doesn't use a proportional font for the preview of text files.
-craig

"You can never have too many knives" -- Logan Nine Fingers
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

Outlook always defaults to a proportional TrueType font - one where the size of spaces and characters are not fixed-width. This forum also defaults to a proportional font, so "llll" and "MMMM" take up significantly different amount of space on the screen even though both of them are four letters long.

Putty and other similar UNIX terminal session utilities always default to a non-proportional (also called mono-spaced) font where each character is the same width on the screen.

Try hitting "forward" on the email, then select the report and change the font to either Courier New or Lucida Sans Typewriter, which are the only two mono-spaced fonts that come with Outlook / Word.

If the columns magically line up, then that's your problem. There are only two ways to get around it:
1) Use tab characters (ctrl-I) to see if you can get it to line up. This can also be tricky if your fields vary in size significantly.
2) Create it as an HTML file, since that can use style sheet selections to enforce a fixed-width font. This is also not easy to do.

FYI - this is one reason most developers just create reports as a .CSV file that can be opened by Excel!
Last edited by asorrell on Fri May 27, 2016 12:17 pm, edited 1 time in total.
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
joycerecacho
Participant
Posts: 298
Joined: Tue Aug 26, 2008 12:17 pm

Post by joycerecacho »

Teej wrote:This is most likely Outlook's fault. I have seen the same thing where a formatted e-mail in a different mail program (i.e. Notes) does not look properly formatted in Outlook.

Try a different mail program.

-T.J.
No way, it is the tool used at the Company.
Joyce A. Recacho
São Paulo/SP
Brazil
joycerecacho
Participant
Posts: 298
Joined: Tue Aug 26, 2008 12:17 pm

Post by joycerecacho »

chulett wrote:I'd also be curious what exactly what see it in Outlook means? You mean the preview pane while still inside the Outlook email? Or after double-clicking the attachment so it opens up in another tool? Assuming the former as the latter would open a csv file in Excel... and if changing the extension makes no difference there may be an Outlook setting you need to change so it doesn't use a proportional font for the preview of text files.
In both cases it happens, I mean, at the previous view or when I open the email.
Independent on the extension ... csv, txt or, without any ...
It makes no difference at the result.

Actually I have to send some results at the e-mail body and not attached.
There is a big list of receivers, so, it doesnt make sense to ask everybody to change their Outlook configuration. And this is the mail tool here in the company for all employees.
Last edited by joycerecacho on Tue May 31, 2016 8:50 am, edited 2 times in total.
Joyce A. Recacho
São Paulo/SP
Brazil
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

Outlook does let each user choose a font. It's not the best solution but it works individually.

Go into the Outlook options and look for mail options regarding stationary and fonts. One of the settings is for "composing and reading plain text messages." For that setting, choose a fixed-width font, like Consolas.
Choose a job you love, and you will never have to work a day in your life. - Confucius
UCDI
Premium Member
Premium Member
Posts: 383
Joined: Mon Mar 21, 2016 2:00 pm

Post by UCDI »

You should be able to wrap the output in HTML tags for the font and force it that way. You really only need a little bit of html as all you want to do is format the entire document in a single fixed width font, nothing fancy.
The user can STILL over-ride you by setting their email to only accept plain text emails but there is only so much you can control on your end. If they accept HTML, it will use your font if it is on their system, so if you use a standard one, it will work.
UCDI
Premium Member
Premium Member
Posts: 383
Joined: Mon Mar 21, 2016 2:00 pm

Post by UCDI »

I haven't done it in a while but maybe something like

mailx -a 'Content-Type: text/html' -s "Subject" to@address <test.html

would work?

---
I am rusty here but I know it can be done if you want to try to force the issue.
joycerecacho
Participant
Posts: 298
Joined: Tue Aug 26, 2008 12:17 pm

Post by joycerecacho »

mailx: Not a recognized flag: a
Joyce A. Recacho
São Paulo/SP
Brazil
UCDI
Premium Member
Premium Member
Posts: 383
Joined: Mon Mar 21, 2016 2:00 pm

Post by UCDI »

Let me see if I can hack out the solution, might be tomorrow.
UCDI
Premium Member
Premium Member
Posts: 383
Joined: Mon Mar 21, 2016 2:00 pm

Post by UCDI »

Edit -- didnt see page 2, I think this is very similar to the above post.

This worked to send an simple html file to myself on our system

cat <<'EOF' - test.html | /usr/sbin/sendmail -t
To: name@place
Subject: hello
Content-Type: text/html

EOF
Last edited by UCDI on Wed Jun 01, 2016 10:27 am, edited 1 time in total.
joycerecacho
Participant
Posts: 298
Joined: Tue Aug 26, 2008 12:17 pm

Post by joycerecacho »

Guys,
My solution perfectly worked.

I just had to generate my file with html tags, like:

Code: Select all

<pre>Column1     Column2    Column3</pre>
<pre>Value1      Value2     Value3</pre>
<pre>Value1      Value2     Value3</pre>
... and then call that 'sendmail' command like the link I posted above. I called it from After job sub-routine.

Thank you so much,
Joyce A. Recacho
São Paulo/SP
Brazil
Post Reply