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 

Convert CSV file to the Text file

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


Joined: 21 Oct 2003
Posts: 70
Topics: 25

PostPosted: Wed Jan 18, 2006 10:41 am    Post subject: Convert CSV file to the Text file Reply with quote

Hi Friends,
I have a csv (comma separated) file which I would like to convert to .txt file so that I could this .txt file in the cobol program.
I have 2 solutions to achieve this one is by Easytrieve and other is by the cobol program. But our peers want's something else like an Excel macro. Could some-one help me in this regard ???
(I am not sure whether I could post this topic in this forum as it involves Excel macro. If yes I appologise for that)

Data format:-
TS08888,"Jones,Mary",Austin,Texas 52222

Here name i.e., Jones,Mary is to be treated as only one

Thanx,
Lal
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Jan 18, 2006 10:57 am    Post subject: Reply with quote

lal,

Not sure if this helps, but a search on google came up with this

http://www.cpearson.com/excel/imptext.htm#Export

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bithead
Advanced


Joined: 03 Jan 2003
Posts: 550
Topics: 23
Location: Michigan, USA

PostPosted: Wed Jan 18, 2006 11:27 am    Post subject: Reply with quote

Here is a very simple example:

Code:

Sub Export()

Dim RowSub As Integer
Dim ColSub As Integer
Dim FileText As String

Open "d:\temp\myfile.txt" For Output As #1

RowSub = 1  'set to 2 if there is a header
Do Until Cells(RowSub, 1).Value = ""
    FileText = ""
    ColSub = 1
    Do Until Cells(RowSub, ColSub).Value = ""
        FileText = FileText & Cells(RowSub, ColSub).Value
        ColSub = ColSub + 1
    Loop
    Print #1, FileText
    RowSub = RowSub + 1
Loop

Close #1

End Sub
Back to top
View user's profile Send private message
lal
Beginner


Joined: 21 Oct 2003
Posts: 70
Topics: 25

PostPosted: Wed Jan 18, 2006 12:30 pm    Post subject: Reply with quote

Thanx Kolusu & Bithead for your replies.


Thanx,
Lal
Back to top
View user's profile Send private message
SureshKumar
Intermediate


Joined: 23 Jan 2003
Posts: 211
Topics: 21

PostPosted: Wed Jan 18, 2006 12:53 pm    Post subject: Reply with quote

lal,
Do you intend to do this on the MF or on Desktop(Excel)? Since you are referring to Excel Macro, may be in Excel. Why would you require a macro? why not save the file as .txt(TAB Delimited). Jones,Mary would be stored as "Jones,Mary ", later is " are not required you can replace all with spaces. Thanks
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