Cobol中的索引文件处理错误? [英] Indexed File Processing in Cobol error?

查看:307
本文介绍了Cobol中的索引文件处理错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我具有以下代码来处理索引文件,但运行程序时出现运行时错误,索引文件系统不可用。我不确定如何对索引文件和数据文件进行编码。我在初始化正确吗?什么地方做错了?

I have the following code for processing an indexed file but I am getting a runtime error, "indexed file system not available" when I run the program. I'm not sure on how to code the index file and the data file though. Am I doing the initialization right? What am doing wrong?

              IDENTIFICATION DIVISION.
   PROGRAM-ID. INDEXFILE.

   ENVIRONMENT DIVISION.
   INPUT-OUTPUT SECTION.
   FILE-CONTROL.

       SELECT VENDOR-FILE ASSIGN TO DISK
       ORGANIZATION IS INDEXED
       ACCESS MODE IS RANDOM
       RECORD KEY IS VENDOR-NUMBER.


   DATA DIVISION.
   FILE SECTION.

   FD VENDOR-FILE
      LABEL RECORDS ARE STANDARD
      VALUE OF FILE-ID IS "input.txt"
      DATA RECORD IS VENDOR-RECORD.          

   01 VENDOR-RECORD.
       05 VENDOR-NUMBER   PIC 9(5).
       05 VENDOR-NAME     PIC X(30).

   WORKING-STORAGE SECTION.

   01 VNAME PIC X.

    PROCEDURE DIVISION.
    PARA1.
        OPEN INPUT VENDOR-FILE.
        DISPLAY 'ENTER VENDOR NO: '.
        ACCEPT VENDOR-NUMBER.
        DISPLAY VENDOR-NUMBER.
        READ VENDOR-FILE 
             INVALID KEY DISPLAY 'NO SUCH RECORD'.

        CLOSE  VENDOR-FILE.
        STOP RUN.        


推荐答案

DOSBOX就像模拟MS-DOS操作系统一样在较旧的IBM PC兼容计算机上运行。 DOSBOX主要是为了支持在具有升级操作系统的较新计算机上运行老式计算机游戏而开发的。 DOSBOX不是您使用的
编译器-它是操作系统。因此,我们
仍然不知道您要在此处使用哪种味道。除此之外,您得到的消息是:索引文件系统
不可用
,这表明您缺少某些正在使用的COBOL版本的运行时支持库。

DOSBOX emulates an MS-DOS operating system as it would run on an older IBM PC Compatible computer. DOSBOX was developed primarily to support running vintage computer games on newer machines with upgraded operating systems. DOSBOX is not the compiler you are using - it is the operating system. As such we still don't know what "flavour" of COBOL you are trying to use here. All that aside, the message you are getting is: Indexed file system not available and this is hinting that you are missing some of the run time support libraries for the version of COBOL you are using.

MS-DOS操作系统(或任何其他PC类型的操作系统)不直接支持索引文件系统。除了简单的顺序操作之外,文件访问需要
某种类型的运行时支持,我怀疑您的操作环境中缺少这些组件。在没有找到丢失的组件的情况下进行进一步开发的可能性很低。

Index file systems are not directly supported by the MS-DOS operating system (or any other PC type operating system for that matter). File access, other than simple sequential, requires some type of run-time support and I suspect that you are missing these components in your operating environment. The prospect of getting much further without locating the missing components is low.

这篇关于Cobol中的索引文件处理错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆