[comp.lang.pascal] VMS Pascal help needed

jwabik@umnd-cs.UUCP (02/07/87)

Help!

I've misplaced (allright.. I lost) our VMS "Programmers" Pascal manual, 
and now am having some headaches trying to do file manipulations.  

Can anyone explain the following to me:


	How to to RESET and REWRITE filenames stored
	(for example) in a character array.  I.E.  Somehow
	associating the "text" variable name with a 
	filename in a character array.

	Is the OPEN statement required?  

	WHY oh.. WHY is VMS Pascal so bass ackwards?


Thanks in advance ..  

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=-  Jeff Wabik, UMD Computing Services, University of Minnesota, Duluth    -=
=- 	ihnp4!umn-cs!umn-d-cs!jwabik					   -=
=- "I feel fine."  - Spock, Star Trek IV.  A sad day for all TRUE trekkies.-=
=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=

gore@nucsrl.UUCP (02/09/87)

/ jwabik@umnd-cs.UUCP (Jeff Wabik) /  4:05 pm  Feb  6, 1987 /
>
>	How to to RESET and REWRITE filenames stored
>	(for example) in a character array.  I.E.  Somehow
>	associating the "text" variable name with a 
>	filename in a character array.
>
>	Is the OPEN statement required?  
>
>	WHY oh.. WHY is VMS Pascal so bass ackwards?

I don't know what you are comparing it (VMS Pascal) with, but in every Pascal
I've seen, RESET and REWRITE took file *variables*, not file names, as
arguments.

The OPEN function is intended to do precisely what you want to do:  to
associate a file on disk that is identified by a file name (a character
string) with a file variable in the Pascal program.

What's your gripe?

Jacob Gore
Northwestern University, Computer Science Research Lab
{ihnp4,chinet}!nucsrl!gore

perry@vu-vlsi.UUCP (02/11/87)

>>	How to to RESET and REWRITE filenames

> RESET and REWRITE took file *variables*, not file names

In Oregon Software Pascal as I recall, you could do: reset(fvar,'fname')
and rewrite too, with some other optional arguments as well.  VMS 4.x
has a lot of online help for Pascal:

$ help PASCAL Input_Output General_Procedures OPEN
	...
		OPEN (file-variable
			,[[file-name]]
			,[[file-history]]
	... lots more

like: open(input,'fname',readonly); open(output,'fout',new);

btb@ncoast.UUCP (02/15/87)

actually, the way a file name is associated with a file variable is left
somewhat open to interpretation in Jensen & Wirth... to be strictly true
to the definition, all file names would be associated with file variables
outside of the pascal program, and the program statement would declare
the variables to the program:

		'set logical filevar1 = filename1'

		program main(input, output, filevar1);

			...

i have heard of some implementations of pascal that do adhere to this
strict, pure definition..., otherwise, the problem is not well-defined,
and various interpretations include:

	vax pascal adding an open statement:

		open ( filevar, filename, history := ... );

		reset(filevar)
		rewrite(filevar)	<= strict jensen & wirth

		where in my experience, filename must be a PACKED
		array of char...

	kyan pascal for the atari 8-bit line (and apple II's):
		(claims to be iso standard)

		reset(filevar, filename)
		rewrite(filevar, filename)

unfortunately, these types of details come up again and again in different
'standard implementations of languages...  i/o is usually a problem, 
other examples are how i/o is buffered in a C implementation, etc....

	if you write your programs carefully, these type of problems are
not difficult to fix... i port kyan pascal programs to our vax all of the
time.


-- 
			Brad Banko
			...!decvax!cwruecmp!ncoast!btb
			Cleveland, Ohio

"The only thing we have to fear on this planet is man."
			-- Carl Jung, 1875-1961
-- 
			Brad Banko
			...!decvax!cwruecmp!ncoast!btb
			Cleveland, Ohio

"The only thing we have to fear on this planet is man."
			-- Carl Jung, 1875-1961

bobd@dshovax.UUCP (02/17/87)

In article <382@umnd-cs-gw.umnd-cs.UUCP> jwabik@umnd-cs.UUCP (Jeff Wabik) writes:
>
>Help!
>
>I've misplaced (allright.. I lost) our VMS "Programmers" Pascal manual, 
>and now am having some headaches trying to do file manipulations.  
>
>Can anyone explain the following to me:
>
>
>	How to to RESET and REWRITE filenames stored
>	(for example) in a character array.  I.E.  Somehow
>	associating the "text" variable name with a 
>	filename in a character array.
>
Use open to associate a file name in a string with an external file.

>	Is the OPEN statement required?  
>
Yes, for what you want to do and various other things. I can't explain them
all (you'd better get another manual), but for associating a name with a
file:

	open( f, fname);
	reset( f);	{ or rewrite(f) }

or you can use the form:

	open( f, filename := fname);


>	WHY oh.. WHY is VMS Pascal so bass ackwards?
>
Compared to what? Not that I'm a rabid fan, but I have used VMS Pascal to do
systems programming without any major problems. At least they didn't pervert
reset and rewrite, which is truly bass ackwards. Note that the draft proposed
Extended Pascal does things this way, although (for good reasons I won't get
into here) the procedure is called "bind".

>
>Thanks in advance ..  
>
>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>=-  Jeff Wabik, UMD Computing Services, University of Minnesota, Duluth    -=
>=- 	ihnp4!umn-cs!umn-d-cs!jwabik					   -=
>=- "I feel fine."  - Spock, Star Trek IV.  A sad day for all TRUE trekkies.-=
>=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=


				Bob Dietrich
				Intel Corporation, Hillsboro, Oregon
				(503) 681-2092
		usenet:		tektronix!reed!omssw2!dshovax!bobd