Multiple choice technology mainframe

Code Snippet: 77 WS-VALUE PIC X(04) VALUE 'ABCD'. 77 WS-OUT-MSG PIC X(05) VALUE SPACES. 77 WS-OUT-LEN PIC S9(4) COMP SYNC VALUE 1. STRING WS-VALUE DELIMITED BY SIZE INTO WS-OUT-MSG WITH POINTER WS-OUT-LEN. What will be the value of WS-VALUE, WS-OUT-MSG & WS-OUT-LEN ?

  1. ABCD, ABCD, 0005

  2. ABCD, , 0004

  3. , ABCD, 0005

  4. ABCD, ABCD, 0004

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The STRING statement moves WS-VALUE (ABCD) into WS-OUT-MSG starting at position 1 (from WS-OUT-LEN). Since WS-OUT-MSG is 5 bytes and WS-VALUE is 4 bytes, the result is 'ABCD ' with a trailing space. WS-OUT-LEN is updated to 5 (1 + length of data). WS-VALUE remains unchanged at 'ABCD'. Option A correctly shows all three values.