Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am having trouble with the Input command. My code looks like this: Open "I:/Excel Experiments/WIOTAN1.csv" _ For Input As #2 Input #2, iAnalystCode, iAnalystName Because my input file comes from the mainframe and is IEBGENER'd (copied) to a USS platform (Unix-ish) it has carraige control characters after the second field. But when I read the file, it is not seeing the carraige control as the end of the line. How can I get the Input command to recognize the carriage return as the end of the line? Or am I forced to use the "Line Input" and parsing out my fields? (say it ain't so) Thanks, B --- Message posted from http://www.ExcelForum.com/ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Could you use a get statement until <cr and re-build the line comming in
with concatination? -Tim "BSchwerdt" wrote in message ... Hi, I am having trouble with the Input command. My code looks like this: Open "I:/Excel Experiments/WIOTAN1.csv" _ For Input As #2 Input #2, iAnalystCode, iAnalystName Because my input file comes from the mainframe and is IEBGENER'd (copied) to a USS platform (Unix-ish) it has carraige control characters after the second field. But when I read the file, it is not seeing the carraige control as the end of the line. How can I get the Input command to recognize the carriage return as the end of the line? Or am I forced to use the "Line Input" and parsing out my fields? (say it ain't so) Thanks, B --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try reading the whole file into a variable, then use the split command with
the control character as a separator to break your data into elements of an array. This requires VBA 6 (xl2000 or later). http://support.microsoft.com/support...eio/fileio.asp File Access with Visual Basic® for Applications -- Regards, Tom Ogilvy BSchwerdt wrote in message ... Hi, I am having trouble with the Input command. My code looks like this: Open "I:/Excel Experiments/WIOTAN1.csv" _ For Input As #2 Input #2, iAnalystCode, iAnalystName Because my input file comes from the mainframe and is IEBGENER'd (copied) to a USS platform (Unix-ish) it has carraige control characters after the second field. But when I read the file, it is not seeing the carraige control as the end of the line. How can I get the Input command to recognize the carriage return as the end of the line? Or am I forced to use the "Line Input" and parsing out my fields? (say it ain't so) Thanks, B --- Message posted from http://www.ExcelForum.com/ |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the ideas.
As it turns out the solution we will be using is to "fake out" Excel/VB by forcing an EBCDIC hex character of X"0D" in the last character of each record. We can do this on the mainframe so when the file is copied to the Unix platform, it will recognize that character as the end of record. Thanks again, B --- Message posted from http://www.ExcelForum.com/ |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
There are tons of free versions of Unix2Dos conversion programs out there (check
www.shareware.com and you'll see lots). I have a couple of programs that use VBA's Shell command to run one of these programs and then do the import. Alternatively, you could shell to DOS manually, convert the file and then have your macro run. If you like that idea, here's a link to a previous thread that gives more detail: http://groups.google.com/groups?thre...BBD7%40msn.com BSchwerdt wrote: Thanks for the ideas. As it turns out the solution we will be using is to "fake out" Excel/VB by forcing an EBCDIC hex character of X"0D" in the last character of each record. We can do this on the mainframe so when the file is copied to the Unix platform, it will recognize that character as the end of record. Thanks again, B --- Message posted from http://www.ExcelForum.com/ -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Mainframe File to Excel Spreadsheet | Excel Discussion (Misc queries) | |||
mainframe file to excel spreadsheet | Excel Worksheet Functions | |||
How to transfer a mainframe file to excel | Links and Linking in Excel | |||
How to transfer a mainframe file to excel | Excel Discussion (Misc queries) | |||
Need to save file for mainframe | Excel Discussion (Misc queries) |