Skip to Content
Custom Search

UNSTRING DELIMITED ON OVERFLOW

 

UNSTRING DELIMITED ON OVERFLOW
 
The following COBOL program depicts the use of 
UNSTRING DELIMITED ON OVERFLOW
 
 
       IDENTIFICATION DIVISION.
       PROGRAM-ID. PGM047.
       AUTHOR. MAINFRAMEWIZARD.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 WS-STRING1    PIC X(12) VALUE 'GRACE HOPPER'.
       01 WS-FIRST-NAME PIC X(05) VALUE SPACES.
       01 WS-LAST-NAME  PIC X(05) VALUE SPACES.
       PROCEDURE DIVISION.
       10000-MAIN-PARA.
 
      ** ON OVERFLOW GIVES US THE OPTION TO SPECIFIY ACTION
      ** WHEN THERE ARE NOT ENOUGH NO OF TARGET STRINGS TO HOLD DATA
 
      ** IN CASE OF UNSTRING OVERFLOW OCCURS WHEN THERE ARE NOT
      ** ENOUGH NUMBER OF TARGET STRINGS AS HERE THERE SHOULD BE TWO
      ** BUT ONLY ONE IS SPECIFIED
 
             UNSTRING WS-STRING1  DELIMITED BY  ' '
                    INTO  WS-FIRST-NAME
                    ON OVERFLOW DISPLAY 'UNSTRING ERRORED OUT'
                       GO TO 10000-EXIT
 
             DISPLAY 'RESULT OF UNSTRING COMMAND :-' WS-FIRST-NAME
             DISPLAY 'RESULT OF UNSTRING COMMAND :-' WS-LAST-NAME.
       10000-EXIT.
             EXIT.
             STOP RUN.
 
 
 
 
 
The output of the program is 
 
UNSTRING ERRORED OUT                                                                                                     
 
 
 
 
 
 
 
                                                                    
 
 
 
 
 

Comments

Post new comment

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Click the +1 button  below to share it with your friends and colleagues

 

Share this if you liked it!

 

Disclaimer



Who's online

There are currently 0 users and 22 guests online.
Dr. Radut | page