0

我正在用 COBOL 编写一个程序,它从表中读取数据并将其转储到 CSV 文件中。我的工作定义列被定义为(例如)FACILITYCODE。以下是专栏的详细信息:

工作存储:WS-FACILITYCODE PIC X(04) VALUE "XYZ".

程序定义:MOVE WS-FACILITYCODE TO ABI-FACILITYCODE.

编写程序时,CSV 标头显示为“Facilitycode”。我想将其更改为“FACILITY_CODE”

用于创建 CSV 的代码PERFORM 800-WRITECSV-XYZINV.

SQL 世界中的一个可比示例是“AS”。

请有任何建议。

谢谢!

4

1 回答 1

2

正如大家所说,我们需要知道什么PERFORM 800-WRITECSV-XYZINV.是...

但我曾在类似的解决方案中编写 CSV 文件

  *...
  *acces to you table and it fills the variables WS-A WS-B and WS-C

  *build heather
   STRING "A"  ","
          "B"  "," 
          "C"         DELIMITED BY SIZE
      INTO WS-LINE
   END-STRING

  * write header
   WRITE FILE  FROM WS-LINE
   ...

然后对于表中的每个文件,您可以:

   INITIALIZE WS-LINE

  *build line whit the values
   STRING WS-A  ","
          WS-B  "," 
          WS-C         DELIMITED BY "SIZE" <-- it will print all spaces that each variable have 
      INTO WS-LINE
   END-STRING

  * write line
   WRITE FILE  FROM WS-LINE
   ...
于 2014-05-15T18:54:27.130 回答