Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

input file at runtime

Status
Not open for further replies.

icepee

Programmer
Feb 27, 2005
2
0
0
BE
I need some help, I know how to read files and read them into records when the file is specified at the beginning of the program in the environment devision. But now i have to read a file specified by the user at runtime and then i have see if the file exists en then read it into records. Does anyone know how i can do this? I realy would appriciate the help. thanx
 
on the "assign" you use a variable instead of a fixed string
then use an "accept" to ask for the file name/location, and after this use the "open" statement coupled with a test of the corresponding "file status".
Won't explain the read as I assume you know this.

If you have problems with the above show us your code, along with some of the variations you've tried so far and corresponding errors.








Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Also, it would be helpful to tell us you operation system, compiler vendor, and version number.
 
How you do this does VARY a lot from compiler to compiler. The "data-name" in ASSIGN clause is medium-common on PC compilers. IBM's mainframe compiler uses an "environment variable" and a call to "putenv" POSIX callable service to do it. Other compilers probably have other ways of doing it. The '02 ANSI/ISO Standard introduces a new

SELECT file-name ASSIGN USING whatever

feature to help with it.

Bill Klein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top