ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Input Command with Mainframe file and multiple variables (https://www.excelbanter.com/excel-programming/285610-input-command-mainframe-file-multiple-variables.html)

BSchwerdt[_2_]

Input Command with Mainframe file and multiple variables
 
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/


Tim Coddington

Input Command with Mainframe file and multiple variables
 
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/




Tom Ogilvy

Input Command with Mainframe file and multiple variables
 
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/




BSchwerdt[_3_]

Input Command with Mainframe file and multiple variables
 
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[_3_]

Input Command with Mainframe file and multiple variables
 
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



All times are GMT +1. The time now is 09:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com