cobol STRINGVAL... Move -versus- STRING


Example

   IDENTIFICATION DIVISION.
   PROGRAM-ID.  STRINGVAL.
   ENVIRONMENT DIVISION.
   DATA DIVISION.
   WORKING-STORAGE SECTION.

   01  WORK-AREAS.
       05 I-STRING        PIC X(08) VALUE   'STRNGVAL'.

       05 O-STRING        PIC XBXBXBXBXBXBXBX.
          88  O-STRING-IS-EMPTY     VALUE   SPACES.

   PROCEDURE DIVISION.
   GENESIS.

       PERFORM MAINLINE

       PERFORM FINALIZATION

       GOBACK

        .


   MAINLINE.

       DISPLAY 'STRINGVAL EXAMPLE IS STARTING !!!!!!!!!!!!!!'

       DISPLAY '=== USING MOVE STATEMENT ==='
       MOVE I-STRING TO O-STRING
       DISPLAY 'O STRING= ' O-STRING

       DISPLAY '=== USING STRING STATEMENT ==='
       SET O-STRING-IS-EMPTY    TO  TRUE
       STRING I-STRING ( 1 : 1 ) DELIMITED BY SIZE
           ' ' DELIMITED BY SIZE
           I-STRING ( 2 : 1 ) DELIMITED BY SIZE
           ' ' DELIMITED BY SIZE
           I-STRING ( 3 : 1 ) DELIMITED BY SIZE
           ' ' DELIMITED BY SIZE
           I-STRING ( 4 : 1 ) DELIMITED BY SIZE
           ' ' DELIMITED BY SIZE
           I-STRING ( 5 : 1 ) DELIMITED BY SIZE
           ' ' DELIMITED BY SIZE
           I-STRING ( 6 : 1 ) DELIMITED BY SIZE
           ' ' DELIMITED BY SIZE
           I-STRING ( 7 : 1 ) DELIMITED BY SIZE
           ' ' DELIMITED BY SIZE
           I-STRING ( 8 : 1 ) DELIMITED BY SIZE
           ' ' DELIMITED BY SIZE
           INTO O-STRING

       DISPLAY 'O STRING= ' O-STRING

        .


   FINALIZATION.

       DISPLAY 'STRINGVAL EXAMPLE IS COMPLETE !!!!!!!!!!!!!!'

        .

   END PROGRAM STRINGVAL.