MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Upload a word file in to Host in readable format

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Other Technical Topics
View previous topic :: View next topic  
Author Message
psridhar
Beginner


Joined: 16 May 2004
Posts: 68
Topics: 26

PostPosted: Wed Aug 24, 2005 5:28 am    Post subject: Upload a word file in to Host in readable format Reply with quote

Hi...

I have a requirement as follows.

I have to represent the data in a table in the word document. For that I have written a COBOL program which generates HTML code for a word document by taking the values from the DB2 tables. The sample output of my COBOL program is pasted below.

Now I receive this flat file from host in text ( not binary ) format with .doc as the file extension and I can open this word file and read the content.

Now my requirement is, I should be able to edit this word document and send it back to host. I should write another program which reads this file and updates my database.

For the above requirement, the main hurdle I am facing is that when I upload a file in to host, its going in unreadable format. As a result, my COBOL program is not able to read it and update the data back in to my database.

Can anybody suggest me a method by which I can load a file in to host in readable format....

Thanks in advance

Regards
Sridhar P

Code:
<HTML>                                         
<BODY LINK="#0000FF" VLINK="#800080">           
<TABLE BORDER CELLSPACING=1 BORDERCOLOR="#000000
<TR><TD WIDTH="22%" VALIGN="TOP">               
<FONT FACE="VERDANA" SIZE=2><U><P>Table of conte
<TD WIDTH="78%" VALIGN="TOP">                   
<P><A HREF="#_Toc504967798"><FONT FACE="Verdana"
<P><A HREF="#_Toc504967800"><FONT FACE="Verdana"
 Description</FONT></A></P>                     
<P><A HREF="#_Toc504967802"><FONT FACE="Verdana"
</FONT></A></P>                                 
<P><A HREF="#_Toc504967804"><FONT FACE="Verdana"
<P><A HREF="#_Toc504967806"><FONT FACE="Verdana"
</TD></TR></TABLE>                             
<P><PRE>                                       
<H1>                                           
<FONT FACE="VERDANA" SIZE= 2>                   
<A NAME="_Toc504967798"><PRE>1. PROCESS : FEE.1
</FONT>                                         
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Wed Aug 24, 2005 5:39 am    Post subject: Reply with quote

psridhar,

If you can copy your table from Word to Excel then save it as Tab Delimited Text format (*.txt) from Excel. You can then upload the file to Host normally as any other text file. I think Excel places a X'05' as Tab Character b/w two columns. This could be converted to spaces or ignored by using COBOL Filler Clause.

Hope this helps,

Thanks,
Phantom
Back to top
View user's profile Send private message
psridhar
Beginner


Joined: 16 May 2004
Posts: 68
Topics: 26

PostPosted: Wed Aug 24, 2005 7:10 am    Post subject: Reply with quote

Hi Phantom,

Thank you very much for the reply.

Here the problem is that my word document contains a valid template in to which the data is filled. For example, my document looks as follows.

Name : Sridhar
Age: 28
Gender: Male

Data ( "Sridhar", "28", "Male") is fetched from the database and the above template is filled.

Now, I shold be able to change "Age" from 28 to 30, send it back to host in some readable format. Now a COBOL / REXX program should read this file and update the database accordingly.

Hope I am clear now...

Please help me...

Regards
Sridhar P
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Aug 25, 2005 3:27 am    Post subject: Reply with quote

Psridhar,

Not sure whether I got your requirement correct. If you are talking about the normal MS-Word Table, then you can copy the entire table (just select all cells) and paste it in Excel. Then you can easily save the Excel sheet as Tab Delimited Text (*.txt) which is compatible with mainframe. Upload the txt file to mainframe in Ascii format - recfm=fb, lrecl=xxx and read it using rexx/cobol.

Please let me know if this solves your problem.

Thanks,
Phantom
Back to top
View user's profile Send private message
psridhar
Beginner


Joined: 16 May 2004
Posts: 68
Topics: 26

PostPosted: Thu Aug 25, 2005 7:54 am    Post subject: Reply with quote

Hi Phantom,

I will try to explain my requirement again.

I have a DB2 table as follows.

Code:
Name            Age            Gender
Sridhar          28              Male
Rajesh           30              Male


I will run a COBOL program which produces the following output in a flat file.

Code:
<HTML>
<P><PRE>                                  </PRE></P>
<A><FONT FACE="VERDANA" SIZE= 2><A>My name is Mr. </FONT></A>
<A><FONT FACE="VERDANA" SIZE= 2><A><U>Sridhar</U></FONT></A>
<A><FONT FACE="VERDANA" SIZE= 2><A> and my age is </FONT></A>
<A><FONT FACE="VERDANA" SIZE= 2><A><U>28</U></FONT></A>
<A><FONT FACE="VERDANA" SIZE= 2><A>. My gender is </FONT></A>
<A><FONT FACE="VERDANA" SIZE= 2><A><U>Male</U></FONT></A>
<A><FONT FACE="VERDANA" SIZE= 2><A>.</FONT></A>
</HTML>


In the above code, Sridhar, 28, Male are fetched from DB2 tables and embedded in to a standard template.

Please paste the above code in notepad and save as test.doc on your desktop. Now open that word document. You can read the information in the DB2 tables in that word file.

This is what I am doing till now and Hope I am clear.

Now my new requirement is as follows.

I will edit that word file ( say change age from 28 to 30). I have to reflect this change back in to the DB2 tables again.

For that, What I propose is, upload this changed word file in to host in some readable format. Write a new program which reads this flat file and updates the DB2 tables.

The modified file uploaded in to the host should look like the output file I produced in my COBOL program above.

Hope I am clear now.

Please help me....

Regards
Sridhar P
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Fri Aug 26, 2005 12:39 am    Post subject: Reply with quote

psridhar,

I got it now. I believe that you always have the text as shown below in word.

Code:

My name is <salutation> <Name> and my age is <age>.  My gender is <gender>
My name is <salutation> <Name> and my age is <age>.  My gender is <gender>
My name is <salutation> <Name> and my age is <age>.  My gender is <gender>
My name is <salutation> <Name> and my age is <age>.  My gender is <gender>


This being the case, you can save the word document as *.txt (or copy it back to notepad) after editing the name or age. Then upload it back to mainframe in Ascii mode. The Name could be any characters long which may not allow to place the age and gender in a fixed column. Never mind...We can use REXX's PARSE function to do the job.

Code:

/*   REXX   */
  PFX1 = 'My Name is'
  SLTN = ''
  NAME = ''
  PFX2 = 'and my age is'
  AGE  = ''
  PFX3 = '. My gender is'
  GNDR = ''

 "ALLOC FI(INFILE) DA('YOUR.TEXT.FILE') SHR REUSE"
 "EXECIO * DISKR INFILE(STEM IN. FINIS"
  DO I = 1 TO IN.0
       PARSE VAR IN.I WITH VAL(PFX1) SLTN NAME VAL(PFX2)AGE VAL(PFX3) GNDR
       SAY 'NAME  : ' NAME
       SAY 'AGE   : ' AGE
       SAY 'GENDER: ' GENDER
  END
EXIT 0


Hope this helps,

Thanks,
Phantom
Back to top
View user's profile Send private message
psridhar
Beginner


Joined: 16 May 2004
Posts: 68
Topics: 26

PostPosted: Fri Aug 26, 2005 5:55 am    Post subject: Reply with quote

Hi Phantom,

Thank you very much for the help. You gave me very important clue.

Thank you very much

Regards
Sridhar P
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Fri Aug 26, 2005 8:12 am    Post subject: Reply with quote

Glad that I could be of some help to you.

Regards,
Phantom
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Other Technical Topics All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group