REDFINES CLAUSE AT 01 LEVEL NUMBER



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

REDFINES CLAUSE AT 01 LEVEL NUMBER

Postby arya_starc » Thu May 26, 2016 7:03 pm

Why we cannot use redefines clause at level number 01.?
arya_starc
 
Posts: 136
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

Re: REDFINES CLAUSE AT 01 LEVEL NUMBER

Postby Robert Sample » Thu May 26, 2016 8:01 pm

Who says you cannot?
PP 5655-W32 IBM Enterprise COBOL for z/OS  5.1.1               MF0007    Date 05/26/2016  Time 09:28:42   Page     3        
  LineID  PL SL  ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6----+----7-|--+----8 Map and Cross Reference  
  000001         000100 ID DIVISION.                                                                                        
  000002         000200 PROGRAM-ID. MF0007.                                                                                
  000003         000300 ENVIRONMENT DIVISION.                                                                              
  000004         000400 CONFIGURATION SECTION.                                                                              
  000005         000500 DATA DIVISION.                                                                                      
  000006         000600 WORKING-STORAGE SECTION.                                                                            
  000007         000700 01  WS-SOURCE.                                                                                0CL10
  000008         000800     05  WS-SOURCE-DATA          PIC X(10) VALUE '1234567890'.                       000000000 10C  
  000009         000900 01  WS-TARGET                   REDEFINES WS-SOURCE.                                          0CL10
                                                                                                  7                        
  000010         001000     05  WS-TARGET-DATA          PIC 9(10).                                          000000000 10C  
  000011         001100 PROCEDURE DIVISION.                                                                                
  000012         001200 0000-MAIN.                                                                                          
  000013         001300     DISPLAY 'WS-TARGET-DATA >' WS-TARGET-DATA '<'.                        10 10                    
  000014         001400     STOP RUN.                                                                                      
PP 5655-W32 IBM Enterprise COBOL for z/OS  5.1.1               MF0007    Date 05/26/2016  Time 09:28:42   Page     4        
Compiles just fine and displays
WS-TARGET-DATA >1234567890<
You cannot use OCCURS on an 01, but REDEFINES is perfectly fine.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: REDFINES CLAUSE AT 01 LEVEL NUMBER

Postby Terry Heinze » Fri May 27, 2016 12:37 am

Maybe you were thinking that 01 cannot be redefined in the FILE SECTION? That would be because 01 levels are implicitly defined as redefines of each other for the same FD.
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post