[Info-vax] VMS Cobol filename issue
Jim Duff
jim at bad.invalid
Thu Dec 21 17:36:17 EST 2023
On 22/12/23 01:54, Arne Vajhøj wrote:
> Even considering that in general I do not understand
> Cobol, then this one has me puzzled.
>
> How does one open a file with the filename being variable?
>
> [snip]
>
By using that value of clause on the FD. Example:
identification division.
program-id. demo.
environment division.
input-output section.
file-control.
select in-file assign to junk
organization is line sequential.
data division.
file section.
fd in-file
value of id is file-name
record is varying in size.
01 inrec.
03 rec pic x(80).
working-storage section.
01 file-name pic x(20).
procedure division.
0-begin.
move "x.x" to file-name.
open input in-file.
read in-file at end continue.
display inrec.
0-end.
close in-file.
stop run.
Jim
--
https://www.eight-cubed.com
More information about the Info-vax
mailing list