Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
mijanurit
Currently Banned

New User

Joined: 26 Aug 2005
Posts: 33
Location: bangalore

 Posted: Sun Jan 08, 2006 8:42 am    Post subject: Whats the solution for this REDEFINE question hi davidatk, plz tell me in details for the following ... Quote: 01 filler 05 x pic x(5). 05 y redefines x pic 9(5). when x=123 3 what is the content of y? in case of x=123 z OR x='123=3' what will be the content of y if y is declared as pic s9(5)? thanks and regards mijanurit

gowtham_1982
Warnings : 1

Active User

Joined: 02 Dec 2005
Posts: 109

Posted: Mon Jan 09, 2006 10:21 am    Post subject: Re: Whats the solution for this REDEFINE question

 mijanurit wrote: hi davidatk, plz tell me in details for the following ... Quote: 01 filler 05 x pic x(5). 05 y redefines x pic 9(5). when x=123 3 what is the content of y? in case of x=123 z OR x='123=3' what will be the content of y if y is declared as pic s9(5)? thanks and regards mijanurit

hai mijanurit,

i suppose the value of Y will also contain the same data as that of X. Rediefines simply share the memory space irrespective of their PIC.

corrections welcomed...

gowtham
vinodmaanju

New User

Joined: 10 May 2005
Posts: 28
Location: Pune

 Posted: Mon Jan 09, 2006 10:31 pm    Post subject: Re: Whats the solution for this REDEFINE question Hi mijanurit, Output will be same as X. coz redefines share same memory locatiom from starting bytes according your length of Y. Thanks Vinod
DavidatK

Active Member

Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

Posted: Tue Jan 10, 2006 3:50 am    Post subject: Re: Whats the solution for this REDEFINE question

Hi mijanurit,

Both vinodmaanju and gowtham_1982 are correct. the 9(5) field will contain the same hex value as the X(5) field. the difference come when you try to use the field.

First, you understand the hex representation of the numbers?

Shown below are 0-9 0 = x?F0?, 1 = x?F1? etc.

 Code: 0123456789 FFFFFFFFFF 0123456789

Given a PIC 9(5) value 12345

This is an unsigned field where the hex value will be ?F1F2F3F4F5?. When addition is performed on this only the low order 4 bits of each byte are considered for the magnitude of the value. The high order 4 bits do not play any part, the sign is assumed to be + (positive).

Given a PIC S9(5) value +12345

This is a signed field where the hex value will be ?F1F2F3F4C5?. ?F1F2F3F4D5? if the value was -12345. When addition is performed only the low order 4 bits are considered for the magnitude of the number and the high order 4 bits of the last byte is considered for the sign.

Normally in a PIC S9(?) field the sign 4 bits will be ?C? = ?+? and ?D? = ?-?.

Now, when addition is performed on a PIC 9(?) or S9(?) field. The field is converted to COMP-3, the addition performed, and converted back to zoned decimal.

When you convert a zoned decimal number to a PIC 9(?) COMP-3 (unsigned) anything can be in the sign bits (x?0? ? x?F?) When converted, the COMP-3 sign bits will always be x?F? and when converted back to the zoned decimal format the sign bits x'F' will remain.

When you convert a zoned decimal number to a PIC S9(?) COMP-3 (Signed) only x?A? ? x?F? can be in the sign bits.
x?A?,x?C?,x?E?,x?F? will be ?+? and x?B?, x?D? will be ?-?. When converted the sign bits will always be either x?C? or x?D?. Anything other than x?A? ? x?F? will cause an 0C7 abend. The sign bits of s successfull add x'C' or 'D' will remain when converted back to zoned decimal.

In both cases, signed and unsigned, anything in the low order 4 bits of each byte other than x?0? ? x?9? will cause an 0C7 abend.

That?s why, when you redefine a PIC X(5) VALUE = ?123 3? as a PIC 9(5) or as a PIC S9(5) the space is converted to a 0 (zero). The hex value of the space is x?40?. This is not the sign byte, so the high order 4 bits the ?4? is ignored, and the low order 4 bits '0' are x?0? ? x?9?.

The ?123 3? is converted to VALUE 12303. x?F1F2F3F0F3? for PIC 9(5) and x?F1F2F3F0C3? for S9(5)

And that?s why you will get an 0C7 abend if your try ?123=3? because the ?=? = x?7E?. The 'E' is not x'0' - x'9'

Or when you try ?1234.? Where ?.? = x?90? and if you try to add to an S9(5) you get an 0C7. The '9' is the sign bits and not one of the allowed values. And converts to ?12340? if you add to an 9(5) because the sign bits are ignored.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics JES2 EXIT 6 QUESTION Randy Horowitz All Other Mainframe Topics 30 Tue Feb 06, 2018 5:47 pm question about dfsms management clas... Hervey Martinez IBM Tools 0 Tue Oct 10, 2017 6:19 pm Question related to Data dictionary f... rexx77 SYNCSORT 3 Thu Aug 31, 2017 7:23 am Easytrive Redefine vidyaa CA Products 4 Mon Jun 19, 2017 6:01 pm Redefine SYS1.PROCLIB farhad_evan JCL & VSAM 12 Mon May 22, 2017 10:54 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us