Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Renaming redefined item

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
srkumar422

New User


Joined: 27 Mar 2006
Posts: 16

PostPosted: Tue Oct 19, 2010 3:01 pm    Post subject: Renaming redefined item
Reply with quote

I have below code.
Code:
ID DIVISION.                                           
PROGRAM-ID. RENAMPGM.                                   
ENVIRONMENT DIVISION.                                   
DATA DIVISION.                                         
WORKING-STORAGE SECTION.                               
01 GRP.                                                 
    02 A.                                               
    03 X PIC 999.                                       
    03 X1 REDEFINES X PIC X.                           
    03 B.                                               
      04 Y PIC X VALUE 'B'.                             
      04 Y1 PIC X(10) VALUE ALL 'B1'.                   
      04 Y2 PIC X(10) VALUE ALL 'B2'.                   
    03 C VALUE 'A SDFL 4087'.                           
      04 Z PIC X.                                       
      04 Z1 PIC X(5).                                   
      04 Z2 PIC X(5).                                   
66 RNM3 RENAMES X1 THRU Z1.                             
PROCEDURE DIVISION.                                     
MAIN-PARA.                                             
    MOVE 11 TO X.                                     
    DISPLAY RNM3.                     
    STOP RUN.


Per my knowledge the answer (RNM3 value) should be
1BB1B1B1B1B1B2B2B2B2B2A SDFL, But system gave answer like
11BB1B1B1B1B1B2B2B2B2B2A SDFL
Could you please explain the reason
Back to top
View user's profile Send private message

acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Tue Oct 19, 2010 4:24 pm    Post subject: Reply to: Renaming redefined item
Reply with quote

just watching the first value... 'for me' none of them is right.

if x = 11 (011) the value of x1 is 0.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Oct 19, 2010 4:39 pm    Post subject:
Reply with quote

Ravi kumar Siluveru ,

not being in the habit of exploiting enteprise cobol's abilitiy to make illogical redefines,
don't know how it will map.
but, suggest you look at the map to determine how address assignment was done.

Ravi,
why don't you supply us with the map of these data definitions,
then we will all know without having to burn-up our machines to determine the answer.
Back to top
View user's profile Send private message
srkumar422

New User


Joined: 27 Mar 2006
Posts: 16

PostPosted: Tue Oct 19, 2010 4:39 pm    Post subject:
Reply with quote

Ohh sorry!!!
picture cluase of X is 99 not 999.
Back to top
View user's profile Send private message
srkumar422

New User


Joined: 27 Mar 2006
Posts: 16

PostPosted: Tue Oct 19, 2010 4:44 pm    Post subject:
Reply with quote

Dick,

Sorry, I am not getting 'Map of the data definitions'. My intention is to know if we rename the redefined item, will rename work or not?
will it take the original item (here X) instead of redefined item (X1)?
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1280
Location: Belgium

PostPosted: Tue Oct 19, 2010 4:54 pm    Post subject:
Reply with quote

address of X1 = Address of X
Code:
offset
00      01 GRP.                                                 
00          02 A.                                               
00             03 X PIC 99.                                       
00             03 X1 REDEFINES X PIC X.                           
02             03 B.                                               
02                  04 Y PIC X VALUE 'B'.                             
03                  04 Y1 PIC X(10) VALUE ALL 'B1'.                   
13                 04 Y2 PIC X(10) VALUE ALL 'B2'.                   
23            03 C VALUE 'A SDFL 4087'.                           
23                 04 Z PIC X.                                       
24                 04 Z1 PIC X(5).                                   
29                 04 Z2 PIC X(5).                                   
0      66 RNM3 RENAMES X1 THRU Z1. 

thus rnm3 goes from offset 0 to 28
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7993
Location: Bellevue, IA

PostPosted: Tue Oct 19, 2010 5:01 pm    Post subject:
Reply with quote

The storage map can be very useful and it's easy to add the compile option to get it. The map for your code is:
Code:
Source   Hierarchy and                                    Base       Hex-Displacement  Asmblr Data                    Data Def
LineID   Data Name                                        Locator    Blk   Structure   Definition      Data Type      Attributes
     2  PROGRAM-ID MF0154------------------------------------------------------------------------------------------------------*
    15   1  GRP . . . . . . . . . . . . . . . . . . . . . BLW=00000  000               DS 0CL35        Group
    16     2  A . . . . . . . . . . . . . . . . . . . . . BLW=00000  000   0 000 000   DS 0CL35        Group
    17       3  X . . . . . . . . . . . . . . . . . . . . BLW=00000  000   0 000 000   DS 3C           Disp-Num
    18       3  X1. . . . . . . . . . . . . . . . . . . . BLW=00000  000   0 000 000   DS 1C           Display        R
    19       3  B . . . . . . . . . . . . . . . . . . . . BLW=00000  003   0 000 003   DS 0CL21        Group
    20         4  Y . . . . . . . . . . . . . . . . . . . BLW=00000  003   0 000 003   DS 1C           Display
    21         4  Y1. . . . . . . . . . . . . . . . . . . BLW=00000  004   0 000 004   DS 10C          Display
    22         4  Y2. . . . . . . . . . . . . . . . . . . BLW=00000  00E   0 000 00E   DS 10C          Display
    23       3  C . . . . . . . . . . . . . . . . . . . . BLW=00000  018   0 000 018   DS 0CL11        Group
    24         4  Z . . . . . . . . . . . . . . . . . . . BLW=00000  018   0 000 018   DS 1C           Display
    25         4  Z1. . . . . . . . . . . . . . . . . . . BLW=00000  019   0 000 019   DS 5C           Display
    26         4  Z2. . . . . . . . . . . . . . . . . . . BLW=00000  01E   0 000 01E   DS 5C           Display
    27   66 RNM3. . . . . . . . . . . . . . . . . . . . . BLW=00000  000   0 000 000   DS 0CL30        Group
If you study it, you will learn everything you need to know about why you got the results you got.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Oct 19, 2010 6:13 pm    Post subject:
Reply with quote

srkumar422 wrote:
Ohh sorry!!!
picture cluase of X is 99 not 999.


well that is your answer.

X1 redefines X means starting address of both is the same, regardless of length.

the earlier 999 had me confused, (actually I want to call you a liar)
but as 99, then it makes sense.

as guyc showed in his post.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compiler option for override the exte... muralikrishnan_new COBOL Programming 9 Fri Jul 08, 2016 12:09 pm
No new posts Selecting a redefined record layout i... mallik4u Compuware & Other Tools 1 Wed Oct 08, 2014 8:14 am
No new posts Renaming a dynamic flat file using JCL Sushruta Pradhan JCL & VSAM 4 Thu Jul 03, 2014 9:57 am
No new posts ISRSUPC -renaming OUTDD output dd sta... PokerGuru JCL & VSAM 11 Tue Jul 01, 2014 10:07 pm
No new posts Moving DBCS to alphanumeric group item saurabh39 COBOL Programming 5 Wed Apr 16, 2014 2:44 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us