使用变量中的文件名打开cobol索引顺序文件

使用变量中的文件名打开cobol索引顺序文件,cobol,Cobol,我使用MicrofocusNetExpress 5.1(Cobol) 当我想打开一个索引顺序文件时,我写 open input xyzfile 我的问题是:是否有可能将名称“xyzfile”改为写入变量 move "xyzfile" to var-file open input var-file 提前向环境部表示感谢 environment division. input-output section. file-control. select Config

我使用MicrofocusNetExpress 5.1(Cobol)

当我想打开一个索引顺序文件时,我写

open input xyzfile 
我的问题是:是否有可能将名称“xyzfile”改为写入变量

move "xyzfile" to var-file
open input var-file

提前向环境部表示感谢

   environment division.
   input-output section.
   file-control.
       select ConfigFile
              assign to wFile-folder
              organization is line sequential
              file status is wStatus.
      move "c:\data\configuration.txt" to wFile-folder
      open input ConfigFile

      read ConfigFile record
来自工作储存区

   working-storage section.
   01  wFile-folder                pic x(256).
   01  wStatus                     pic x(2).
在你的程序部门下

   environment division.
   input-output section.
   file-control.
       select ConfigFile
              assign to wFile-folder
              organization is line sequential
              file status is wStatus.
      move "c:\data\configuration.txt" to wFile-folder
      open input ConfigFile

      read ConfigFile record

var文件
不是文件名。在
文件控件
部分,您可以将文件分配给变量名:
选择var file assign to input file name
。。。其中,
输入文件名
是在您的
工作存储
部分中定义的。我相信您的文档中会涉及到这一点。正如@Lougler所指出的,您需要查看的是SELECT语句。