IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Using VALUE clause with redefines


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
tushar_study

New User


Joined: 01 Feb 2007
Posts: 30
Location: Mumbai

PostPosted: Thu Feb 22, 2007 1:38 pm
Reply with quote

Hi ,

I have the following working storage declaration:

Code:
01 WS-VAR.

     05  WS-NUM.
          10  WS-NUM1      PIC 9(02).       
          10  WS-NUM1      PIC 9(03).       
 
     05  WS-ALPHA REDEFINES WS-NUM PIC X(05) VALUE 'ABCDE'.


MY QUERY :

1) WHETHER THE PROGRAM WILL COMPILE PROPERLY(AS I AM DOUBTFUL WHETHER NUMERIC WILL BE ABLE TO HOLD 'ABCDE').

2) WILL THE ABNORMAL CONDITION OCCUR ONLY DURING MOVES.


REGARDS,
tUSHAR
Back to top
View user's profile Send private message
prav_06
Warnings : 1

Active User


Joined: 13 Dec 2005
Posts: 154
Location: The Netherlands

PostPosted: Thu Feb 22, 2007 2:06 pm
Reply with quote

Tushar,

Remove the value clause from u r w-s item it should go thro fine while compilation. and for u r second question yes if ya trying to move the WS-ALPHA item to a comp with non-numeric values YES u get a 0C7.



Thamilzan.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Thu Feb 22, 2007 3:51 pm
Reply with quote

Code:
01 WS-VAR.
     05  WS-ALPHA          PIC X(05) VALUE 'ABCDE'.
     05  WS-NUM REDEFINES WS-ALPHA.
          10  WS-NUM1      PIC 9(02).       
          10  WS-NUM1      PIC 9(03).
This will compile better.
And yes, garbage in numeric fields can result in an 0C7...
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Thu Feb 22, 2007 6:33 pm
Reply with quote

I thought 0C7 was a packed decimal abend.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Thu Feb 22, 2007 7:57 pm
Reply with quote

Phrzby Phil wrote:
I thought 0C7 was a packed decimal abend.
Any math on those numeric fields could cause an 0C7. Why do you think not?
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Thu Feb 22, 2007 8:15 pm
Reply with quote

Hi !

S0C7

This ABEND is only caused by a data exception and can only occur
when decimal (packed) instructions are used.

The sign or digit codes of one or more bytes manipulated by the packed or CONVERT TO BINARY instructions is invalid for packed decimal use. Packed decimal digits must be in the range 0 through 9, with only the sign (i.e., rightmost) digit being a digit in the range A to F.

Fields in decimal (packed) arithmetic overlap incorrectly.

A packed decimal multiplicand has too many high-order significant digits.

The target operand of a CVD assembler instruction is not on a doubleword boundary

Regards, UmeySan
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Feb 22, 2007 10:56 pm
Reply with quote

Hello,

In order to perform arithmetic on a zoned decimal number it is first "packed internally". If a PIC 9(5) field that contains non-numeric data is used in an ADD statement, that will cause an 0c7.

The definition in the code does NOT have to be packed decimal to get an 0c7.

Keep in mind that there are packed decimal arithmetic and binary arithmetic assembler instructions, but there are NO zoned decimal arithmetic instructions. When you specify calculatons on zoned numbers, the compiler generates the necessary assembler conversion instructions and then does the calculaton with the generated packed decimal numbers.

This is also true if you move a PIC 9(5) field to a field of ZZ,ZZZ. The assembler to apply the editing uses a packed decimal number as input.

If you want to see this, look at the generated assembler code.
Back to top
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Fri Feb 23, 2007 2:56 pm
Reply with quote

redefine clause never used with value clause
and when alphanumeric value move to comp or numeric then it works fine only when alphanumeris contains the numeric value
but when alphanumeris value contains the other than numeris value then it gives soc7
from-sachin borase
pune
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Fri Feb 23, 2007 6:24 pm
Reply with quote

As Dick stated, it is correct that that certain USAGE DISPLAY calcs are converted to packed-dec, and as such invalid data in those can issue an 0C7.

Note that these are still packed-dec data errors, but not necessarily COMP-3 data errors.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts To search DB2 table based on Conditio... DB2 1
No new posts NOT IN clause in COBOL pgm COBOL Programming 8
No new posts SUSBSCRIPT WITH SIGN IN PIC CLAUSE COBOL Programming 3
No new posts usage of CASE in WHERE clause DB2 10
No new posts Cobol redefines for Signed pictured c... COBOL Programming 4
Search our Forums:

Back to Top