Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
REDIFINES with different PIC clause and size

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

New User


Joined: 03 Jul 2007
Posts: 1
Location: banglore

PostPosted: Wed Jul 11, 2007 7:01 pm    Post subject: REDIFINES with different PIC clause and size
Reply with quote

Everywhere its written that REDEFINES can be used for different data description entries and sizes.

and is this feasible?

01 dn1 pic a(5).
01 dn2 REDEFINES pic 9(10).
(in this data types different and we are redefining a small storage location with a bigger one)

or..............

01 dn1 pic x(10).
01 dn2 REDEFINES pic 9(5).
(in this we are redefining a large storage size with a smaller one)

Regards,
Mini kaushik
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Wed Jul 11, 2007 7:47 pm    Post subject:
Reply with quote

Yes, it is feasible.
The larger redefining the smaller might raise a warning, but COBOL will take care of everything.
Back to top
View user's profile Send private message
nagasri83

New User


Joined: 20 May 2005
Posts: 15
Location: chennai

PostPosted: Thu Jul 12, 2007 5:05 am    Post subject:
Reply with quote

It is feasible, but people never do this type of coding with different lengths as the data will be truncated.

There are few chances that your program end with Data exception error (S0C7) even if you use same length.

Quote:

Data Division.
01 dn1 pic X(5).
01 dn2 REDEFINES pic 9(5).
....

Procedure Division.
....
Move 'test1' to dn1.
Display 'Data in redefine clause: ' dn2.
....


After executing the above code, you program fails at Display statement as dn2 is declared as numeric but logical storage space contains alphanumeric.

If your not clear, you can try the above way and see the result.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Jul 12, 2007 9:37 am    Post subject:
Reply with quote

nagasri83 wrote:
It is feasible, but people never do this type of coding with different lengths as the data will be truncated.
What? Never? Truncated? I think not.......
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 Date in where clause - Windows Karthikeyan Subbarayan DB2 9 Wed Nov 15, 2017 9:07 pm
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts JES2 job size field matching Windows ... SRICOBSAS All Other Mainframe Topics 4 Tue Sep 05, 2017 5:49 pm
No new posts To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am
No new posts Increase the screen size after split mistah kurtz TSO/ISPF 2 Fri Sep 02, 2016 6:39 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us