MOVE CORRESPONDING PROBLEM!!

Dear All,

I'a facing a problem in using move corresponding syntax, I have identical group members and the syntax does nothing!!

any one can help please ??

best regards

Tags:

  • Can you please show us what your two records look like and also what your MOVE statement looks like?

    Which Visual COBOL product are you using, i.e. Visual Studio, Eclipse, Dev Hub, native, managed code?

    Thanks.

  • I am using Visual COBOL for Eclipse, and this is my code :

          method-id createCustomer.

          local-storage section.

          01  local-customer-record.

              03  local-customer-id         pic 9(10).

              03  local-customer-name       pic x(20).

              03  local-customer-address    pic x(30).

          linkage section.

          01  linkage-customer-record.

              03  linkage-customer-id         pic 9(10).

              03  linkage-customer-name       pic x(20).

              03  linkage-customer-address    pic x(30).

          procedure division using linkage-customer-record.

              move corresponding linkage-customer-record to local-customer-record.

              display local-customer-record.

          end method.

  • Verified Answer

    MOVE CORRESPONDING only affects data-items that have identical names and none of your elementary items in the sending or receiving records match.

    In your example the data items have different names but they have the same data description so a simple move without the CORR phrase would work in this case.

    The MOVE CORR would only work if you had for example:

         method-id createCustomer.
         local-storage section.
         01  local-customer-record.
             03  local-customer-id         pic 9(10).
             03  local-customer-name       pic x(20).
             03  local-customer-address    pic x(30).
         linkage section.
         01  linkage-customer-record.
             03  local-customer-id         pic 9(10).
             03  local-customer-name       pic x(20).
             03  local-customer-address    pic x(30).
         procedure division using linkage-customer-record.
             move corresponding linkage-customer-record to local-customer-record.
             display local-customer-record.
         end method.