[ GROUP-DYNAMIC ] |
program-id. grdyn-test. working-storage section. 01 group-1 group-dynamic. 03 item-1 pic x. 03 item-2 occurs dynamic capacity cap1. 05 item-2-sub pic x. 03 item-3 pic x. 03 item-4 pic x any length. 01 group-2 group-dynamic. 03 item-1-b pic x. 03 item-2-b occurs dynamic capacity cap2. 05 item-2-b-sub pic x. 03 item-3-b pic x. 03 item-4-b pic x any length. procedure division. main-logic. move "A" to item-1. move "B" to item-2-sub(1). move "C" to item-2-sub(2). move "D" to item-3. move "E" to item-4. move group-1 to group-2. if group-1 = group-2 display "Data moved correctly [ok]" else display "Unexpected result [fail]" end-if. goback. |
program-id. grdyn-test. working-storage section. 01 group-1. 03 item-1 pic x. 03 item-3 pic x. 01 item-2. 03 filler occurs dynamic capacity cap1. 05 item-2-sub pic x. 01 item-4 pic x any length. 01 group-2. 03 item-1-b pic x. 03 item-3-b pic x. 01 item-2-b. 03 filler occurs dynamic capacity cap2. 05 item-2-b-sub pic x. 01 item-4-b pic x any length. 77 i pic 9(3). 77 flg-comp pic 9 value 0. 88 tables-equal value 1. 88 tables-diff value 0. procedure division. main-logic. move "A" to item-1. move "B" to item-2-sub(1). move "C" to item-2-sub(2). move "D" to item-3. move "E" to item-4. move group-1 to group-2. initialize item-2-b. perform varying i from 1 by 1 until i > cap1 move item-2-sub(i) to item-2-b-sub(i) end-perform. move item-4 to item-4-b. set tables-equal to true. perform varying i from 1 by 1 until i > cap1 if item-2-sub(i) not = item-2-b-sub(i) set tables-diff to true exit perform end-if end-perform. if group-1 = group-2 and tables-equal and item-4 = item-4-b display "Data moved correctly [ok]" else display "Unexpected result [fail]" end-if. goback. |