IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

LRECL for sending images from mainframes.


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Nov 13, 2009 6:46 pm
Reply with quote

Hi,

An image e.g. company_logo.gif was transferred from desktop to mainframes in binary format into a FB file of LRECL 300.

The PS file has some fuzzy data of the image as shown,

Code:
****** ***************************** Top of Data ******************************
000001 åñã  /M Ö 7  Ø  Ø ØØ  ØØ Ø ØØ{{{{ü{w­0   -  Ø  µ  {  \          -
000002   Ø  Ø  Ø -Ø ØØ µØ {Ø \Ø  µ  µ  µ -µ ص µµ {µ \µ  {  {  { -{ Ø{ µ{ {{ \{
000003 {Ø {µ {{ {\ {  {  {  {- {Ø {µ {{ {\ {  {  {  {- {Ø {µ {{ {\ { -{ -{ -{--
000004 ì·¦ù­§¿P®-C« .¶ÐR·ÇL¡)ô¶Ýû¼øT­¸.¼Þù]Ì3²ùô¼®ÿ×Ø  <½^÷Ch  ;ö½£TG° .Æ<¾¥Vô
000005 ð «Q ñí MÁ.¬!Iëqë d o ÂÌ r é` º A¾Æq RË{¸ãWz @Ó è @l^H  #WR ä  0  û ¹ ~Õ
000006 ·ö9kG>â Ó<ÝLM · à ñøl¼;¯ÂÝ«ø Wô¾  ÀýóÆ%ÆòߦRÊÎ&x<3QÄ QÊÈ ¯ YÝ_ ¯ â  #ÕN




I use the below SMTP cards to send CSV file(ANALYSIS.CSV) as attachment. It works fine,
But when we try to replace the CSV file with the above image file it does not work as expected.
The email gets delivered to the recepients, but the image is not in viewable format.
Could you please suggest a solution for a way ahead.

Is the LRECL distorting the image? icon_eek.gif

The actual need for this image transfer is to send an analysis trend graph through email.
Im currently playing with company_logo.gif transferred from desktop.


Code:
HELO TMVSC.TSL                                       
MAIL FROM:<MAINFRAME@T****.COM>                       
RCPT TO: <MAINFRAME@T****.COM>             
DATA                                                 
FROM:     MAINFRAME                                   
TO:       UNDISCLOSED                                 
SUBJECT: EOD/EOW ANALYSIS REPORT                     
MIME-VERSION: 1.0;                                   
CONTENT-TYPE: TEXT/RICH TEXT;                         
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=ANALYSIS.CSV


Thanks & Regards,
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Nov 13, 2009 7:21 pm
Reply with quote

I don't remember ever getting an image to transfer through SMTP. I don't know if that's due to SMTP issues or my lack of knowledge, though.

The LRECL should not affect the transfer if it is done correctly. However, CONTENT-TYPE: TEXT/RICH TEXT is absolutely not going to work. Images are binary files and have to be transferred as such. Transferring as a text file, the records will be terminated with 0D0A (carriage return / line feed) characters or 0A (line feed) characters, depending on what kind of system you are transferring to, and adding these characters into the middle of the image will definitely mess up your image. I've done some testing with CONTENT-TYPE: IMAGE/GIF but I haven't (yet) figured out the right combination of options to get the image to transfer and be readable.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Nov 13, 2009 7:35 pm
Reply with quote

Hi Robert,

Thanks for your time & inputs. But surprisingly I have got the image transferred sometime back with CONTENT-TYPE: TEXT/RICH TEXT (a gif image) but its not working now though icon_sad.gif . I think "CONTENT-TYPE: TEXT/RICH TEXT" does not apply to attachments, so it should not affect the image contents (I may be wrong).

It worked sometime back with some other images file, but I did not pay attention at that time & now I don't have any backups of the stuff. Arrrgggh..!!

Should I try meddling with LRECL more? or is it the "CONTENT-TYPE:" ?

Please let me know your thoughts.

And one more detail is that, I use IND$FILE FTP method with binary mode.

Thanks,
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Nov 13, 2009 7:39 pm
Reply with quote

Just my thoughts, but I would think that any file that's an image (i.e. binary) would HAVE to be allocated as V or VB to assure that there are no extra characters (most likely blanks) filling up the last record.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Nov 13, 2009 7:42 pm
Reply with quote

Hi,

I will give it a try Superk.

Thanks.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Nov 13, 2009 7:49 pm
Reply with quote

Hi,

I guess there is some problem with FTP. I transferred the image to PS VB 300 from desktop to Mainframe.
And transferred back from MF to PCu sing same FTP, When we open the image in PC the image is messed up.
So the transfer maybe a prob. sterb050.gif

Thanks,
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Nov 13, 2009 8:01 pm
Reply with quote

I have used FTP in binary mode to transfer .GIF files from a PC to the mainframe; those files can be displayed in a web browser by pointing to them. However, they are Unix System Services files NOT z/OS files.

My reading of the SMTP RFC standards is that any non-text data being transferred as email must be in MIME format. The CONTENT-TYPE identifies the data type for MIME and IMAGE/JPG, audio/mp3, and video/mp4 are all various types that are supported. I do not believe LRECL matters if the MIME headers are not right. But I haven't been able to spend the time to get the MIME headers right for images from z/OS (as yet).
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Nov 13, 2009 8:57 pm
Reply with quote

Hi,

Thanks again for your time & thoughts.
The problem seems to be in the initial FTP & the LRECL I guess.
I have done some testing with the different LRECLs by transferring image from PC TO MF & immediately back from MF to PC.
Although I am not getting anywhere with this testing, I understood that this task is not easy.


LRECL of 80 FB gave incorrupt data error.
LRECL of 1000 FB gave a distorted image.
LRECL of 10000 FB gave half clear & half distorted image.(the data in PS file spanned over 2 lines, maybe thats the reason half of the image was clear)
LRECL of 20000 FB gave the clear and exact image.(the data in PS file spanned over one line, the image was perfect)



Attached are the pics.

Thanks,
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Nov 13, 2009 10:02 pm
Reply with quote

Quote:
audio/mp3, and video/mp4
That sounds "good".

Maybe get an audio summary of the ANALYSIS report.. 787.gif

Should try these icon_biggrin.gif
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Sat Nov 14, 2009 2:08 am
Reply with quote

Don't you need to convert it to a base64 encoding? I've never done it either, so I'm just guessing.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sat Nov 14, 2009 2:09 am
Reply with quote

Looking through the PlanetMVS web site material on SMTP from z/OS (MVS), it appears that the binary must be in base64 encoding to go. I may get a chance to try this over the weekend.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Sat Nov 14, 2009 2:16 am
Reply with quote

Quote:
I may get a chance to try this over the weekend.


Thanks.


I don't know about base64 encoding, but it has worked with small images with just the file transfer and no encoding.

I have done it for SAS plot once w/o encoding, maybe SAS automatically converts it into base64.

Just the image & normal attachment cards for SMTP
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Sat Nov 14, 2009 4:29 am
Reply with quote

BASE64 is an encoding method that allows you to transform a binary file into text and back.
This allows two things (basically):
- the file can be processed by XML engines.
- the file can be translated from ASCII to EBCDIC and back.

There are encoders-decoders for most programming languages (i even found in COBOL).
Back to top
View user's profile Send private message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 206
Location: Bangalore

PostPosted: Mon Nov 23, 2009 2:10 pm
Reply with quote

Vasanth,

Just wondering about LRECL considerations as you mentioned in your post, in DB2 also, we use BLOB datatype for storing non-traditional stuff like images/pictures/audio/video etc where the data is between 32K and less than 2GB in size.
And you are getting it right when you nearly reach 32 K as lrecl.

I may be wrong also in this understanding.

-Ajay
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Tue Nov 24, 2009 3:08 am
Reply with quote

Hi Ajay,

Quote:
And you are getting it right when you nearly reach 32 K as lrecl.


Actually the data was correct since the data was spanning over one line, If the data spans over two or more then it gets distorted.

Quote:
we use BLOB datatype for storing non-traditional stuff like images/pictures/audio/video


How did u get video uploaded into mainframes
Lucky guy u get to watch movies at your workplace, that too on MF icon_lol.gif

Thanks,
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts SH256/MD5 Checksum in Mainframes JCL JCL & VSAM 14
No new posts VB to FB - Finding LRECL SYNCSORT 4
No new posts After hours quick-fix support for IBM... Mainframe Jobs 0
No new posts Problem while sending special charact... JCL & VSAM 4
No new posts How to append Previous date into a S... JCL & VSAM 2
Search our Forums:

Back to Top