Skip to Content
Custom Search

COBOL REDEFINE CLAUSE

Example of REDEFINE CLAUSE

 

PROGRAM

IDENTIFICATION DIVISION.                                         
PROGRAM-ID. PGM002.                                              
AUTHOR. MAINFRAMEWIZARD.                                         
DATA DIVISION.                                                   
WORKING-STORAGE SECTION.                                         
01 DATE1 PIC X(8).                                               
01 DATE2 REDEFINES DATE1.                                        
   05 DATE2-DD    PIC X(2).                                      
   05 DATE2-MM    PIC X(2).                                      
   05 DATE2-YYYY  PIC X(4).                                      
PROCEDURE DIVISION.                                              
10000-MAIN-PARA.                                                 
      MOVE 08092010 TO DATE1                                     
      DISPLAY 'DATE =' DATE1                                     
      DISPLAY 'YEAR OF DATE=' DATE2-YYYY                         
      STOP RUN.                                                    

; ; ; ;

OUTPUT

DATE =08092010
YEAR OF DATE=2010

 

Back to COBOL examples

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 1 user and 25 guests online.

Online users

  • anentc73m
Dr. Radut | page