Logo 
Search:

Cobol Articles

Submit Article
Home » Articles » Cobol » Homework HelpRSS Feeds

PROGRAM TO USE REDEFINE CLAUSE

Posted By: Amelie Hughes     Category: Cobol     Views: 7440

PROGRAM TO USE REDEFINE CLAUSE.

Code for PROGRAM TO USE REDEFINE CLAUSE in Cobol

       IDENTIFICATION DIVISION.
         PROGRAM-ID. REDEF.

       DATA DIVISION.
        01 W-REC.
          02 W-DAYS.
            05 D1 PIC X(10) VALUE "SUNDAY".
            05 D2 PIC X(10) VALUE "MONDAY".
            05 D3 PIC X(10) VALUE "TUESDAY".
            05 D4 PIC X(10) VALUE "WEDNESDAY".
            05 D5 PIC X(10) VALUE "THURSDAY".
            05 D6 PIC X(10) VALUE "FRIDAY".
            05 D7 PIC X(10) VALUE "SATURDAY".
          02 W-DAYS1 REDEFINES W-DAYS  PIC X(10) OCCURS 7 TIMES.

         01 I PIC 9 VALUE 1.

       PROCEDURE DIVISION.
         BEGIN.

           PERFORM VARYING I FROM 1 BY 1 UNTIL I>7
             DISPLAY "DAY-" I " = "W-DAYS1(I)
           END-PERFORM.
           STOP RUN.
  
Share: 


Didn't find what you were looking for? Find more on PROGRAM TO USE REDEFINE CLAUSE Or get search suggestion and latest updates.

Amelie Hughes
Amelie Hughes author of PROGRAM TO USE REDEFINE CLAUSE is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
Vadlamudi Mohankumar from India Comment on: Nov 10
sir in the above program i am getting an error so this is corrected

* PROGRAMME FOR READING A MESSAGE
IDENTIFICATION DIVISION.
PROGRAM-ID. READ-MSG.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 W-REC.
02 W-DAYS.
05 D1 PIC X(10) VALUE "SUNDAY".
05 D2 PIC X(10) VALUE "MONDAY".
05 D3 PIC X(10) VALUE "TUESDAY".
05 D4 PIC X(10) VALUE "WEDNESDAY".
05 D5 PIC X(10) VALUE "THURSDAY".
05 D6 PIC X(10) VALUE "FRIDAY".
05 D7 PIC X(10) VALUE "SATURDAY".
02 W-DAYS1 REDEFINES W-DAYS PIC X(10) OCCURS 7 TIMES.

01 I PIC 9 VALUE 1.

PROCEDURE DIVISION.
BEGIN.

PERFORM READ-PARA VARYING I FROM 1 BY 1 UNTIL I>7.

STOP RUN.
READ-PARA.
DISPLAY " DAY- " I " = " W-DAYS1(I).

View All Comments