开发者

COBOL - copy an array to another array

开发者 https://www.devze.com 2023-03-09 02:17 出处:网络
how to copy an arrayto another array in cobol ? A PIC 9999 occu开发者_如何学JAVArs 5. B PIC 9999 occurs 5.

how to copy an array to another array in cobol ?

A PIC 9999 occu开发者_如何学JAVArs 5.
B PIC 9999 occurs 5.

i need to copy A to B. anyone can help me ?

Thanks All.


Working Storage

01 AA.
   03 A PIC 9999 occurs 5.

01 BB.
   03 B PIC 9999 occurs 5.

Procedure:

MOVE AA TO BB.

HTH!


If you were looking for a loop:

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
0

精彩评论

暂无评论...
验证码 换一张
取 消