COBOL - 将数组复制到另一个数组

时间:2011-05-30 17:11:49

标签: arrays cobol

如何将数组复制到cobol中的另一个数组?

A PIC 9999 occurs 5.
B PIC 9999 occurs 5.

我需要将A复制到B.任何人都可以帮助我吗?

全部谢谢。

2 个答案:

答案 0 :(得分:3)

工作存储

01 AA.
   03 A PIC 9999 occurs 5.

01 BB.
   03 B PIC 9999 occurs 5.

步骤:

MOVE AA TO BB.

HTH!

答案 1 :(得分:2)

如果您正在寻找循环:

01  AA-Length Pic S9(8) Binary value +0.
01  BB-Length Pic S9(8) Binary value +0.
01  II        Pic S9(8) Binary value +0.

...and...

Compute AA-Length = Length of AA / Length of A(1)
Compute BB-Length = Length of BB / Length of B(1)

Perform varying II from 1 by 1
  until II > AA-Length or II > BB-Length

  Move A (II) to B (II)

End-Perform