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
 

 

Using VALUE clause with redefines

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Using VALUE clause with redefines
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    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Thu Feb 22, 2007 3:51 pm    Post subject: Re: Using a redefines
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

Active Member


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

PostPosted: Thu Feb 22, 2007 6:33 pm    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Thu Feb 22, 2007 7:57 pm    Post subject:
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: 755
Location: Germany

PostPosted: Thu Feb 22, 2007 8:15 pm    Post subject:
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

Site Director


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

PostPosted: Thu Feb 22, 2007 10:56 pm    Post subject:
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    Post subject:
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

Active Member


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

PostPosted: Fri Feb 23, 2007 6:24 pm    Post subject:
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    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 Need help on SQL Dynamic WHERE Clause subratarec DB2 12 Sat Jul 16, 2016 3:11 pm
No new posts [SQL0029] INTO clause missing from em... HABBIE DB2 2 Fri Sep 04, 2015 3:54 pm
No new posts 3-D Table with nested DEPENDING ON Cl... VivekKhanna COBOL Programming 5 Sat Aug 08, 2015 11:18 pm
No new posts when=group clause: question about the... tuxama DFSORT/ICETOOL 2 Thu Mar 26, 2015 12:51 pm
No new posts Another redefines in COBOL RahulG31 COBOL Programming 1 Fri Mar 20, 2015 4:09 am


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