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

More moving a packed decimal to numeric in EZT


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
himanshupant

New User


Joined: 21 Mar 2007
Posts: 46
Location: India

PostPosted: Fri Jul 23, 2010 11:10 am
Reply with quote

I am having the same problem in my code as in moving a packed decimal to numeric in easytrieve
My code fragment is as below

BALANCE W 14 N 2
CLEDAB W 8 P 2

When I am doing

BALANCE = CLEDAB

my positive numbers are coming fine but negative numbers are throwing up garbage value in last byte.

For example CLEDAB = 48.23
balance is correctly coming out as 4823

but when cledab = - 3.79
balance is incorrectly coming out as 37R.


So x'379D' is getting converted to x'37D9'.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Jul 23, 2010 11:27 am
Reply with quote

And how do you know that ?
By using DISPLAY on the field?
Back to top
View user's profile Send private message
himanshupant

New User


Joined: 21 Mar 2007
Posts: 46
Location: India

PostPosted: Fri Jul 23, 2010 12:16 pm
Reply with quote

PeterHolland wrote:
And how do you know that ?
By using DISPLAY on the field?


I am writing the data to a file and seeing the data there !!
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Jul 23, 2010 12:25 pm
Reply with quote

BALANCE is a zoned decimal field, so it should contain

X'F3F7D9', where D is the negative sign.
Back to top
View user's profile Send private message
himanshupant

New User


Joined: 21 Mar 2007
Posts: 46
Location: India

PostPosted: Fri Jul 23, 2010 2:00 pm
Reply with quote

PeterHolland wrote:
BALANCE is a zoned decimal field, so it should contain

X'F3F7D9', where D is the negative sign.


So how can I get the data as 379 with negative sign in this case ?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Jul 23, 2010 2:05 pm
Reply with quote

himanshupant wrote:
PeterHolland wrote:
BALANCE is a zoned decimal field, so it should contain

X'F3F7D9', where D is the negative sign.


So how can I get the data as 379 with negative sign in this case ?


Peter,
I can barely hold my water waiting for your response.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Jul 23, 2010 2:10 pm
Reply with quote

himanshupant


maybe its time to look for another job far far from IT.

That ok, Dick?
Back to top
View user's profile Send private message
himanshupant

New User


Joined: 21 Mar 2007
Posts: 46
Location: India

PostPosted: Fri Jul 23, 2010 2:49 pm
Reply with quote

PeterHolland wrote:
himanshupant


maybe its time to look for another job far far from IT.

That ok, Dick?


Friday evening -- seriously I need to move out of IT now icon_sad.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Jul 23, 2010 7:45 pm
Reply with quote

Hello,

Either you have a zoned decimal number with a sign
Code:
X'F3F7D9', where D is the negative sign.
or a zoned decimal number without a sign
Code:
X'F3F7F9', where F is the implied positive sign.


Quote:
So how can I get the data as 379 with negative sign in this case ?
How would you have this appear?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Jul 23, 2010 8:40 pm
Reply with quote

himanshupant wrote:
my positive numbers are coming fine but negative numbers are throwing up garbage value in last byte.

For example CLEDAB = 48.23
balance is correctly coming out as 4823

but when cledab = - 3.79
balance is incorrectly coming out as 37R.
About edit masks the CA-Easytrieve/Plus Reference Guide wrote:
In some instances, leading zeros add unnecessary information and can confuse
the reader. In these cases, use an edit mask that suppresses leading zeros.

-----9.99 +00001234 12.34
-----9.99 -00001234 -12.34


CLEDAB W 8 P 2 MASK '-----9.99'

DISPLAY CLEDAB
48.23 or -3.79
Back to top
View user's profile Send private message
himanshupant

New User


Joined: 21 Mar 2007
Posts: 46
Location: India

PostPosted: Fri Jul 23, 2010 9:31 pm
Reply with quote

dick scherrer wrote:
Hello,

Either you have a zoned decimal number with a sign
Code:
X'F3F7D9', where D is the negative sign.
or a zoned decimal number without a sign
Code:
X'F3F7F9', where F is the implied positive sign.


Quote:
So how can I get the data as 379 with negative sign in this case ?
How would you have this appear?


Hello Dick

Yes so for x'F3F7D9' , it should get written as -3.79
and x'F3F7F9' should get written as 3.79
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Jul 23, 2010 9:34 pm
Reply with quote

Hello,

Then you need to specify an "edit mask" as CICS Guy suggested. . .
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Jul 23, 2010 9:55 pm
Reply with quote

dick scherrer wrote:
Hello,

Then you need to specify an "edit mask" as CICS Guy suggested. . .


Edit masks are ok, if you know how to use them.
This TS knows nothing about EZT or numeric values/representations.

And how about this BS :

Quote:

I am writing the data to a file and seeing the data there !!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Jul 23, 2010 10:11 pm
Reply with quote

Hi Peter,

Don't know how you've done things, but i've written "stuff" to a file so i could easily see it in hex. . .

If it is only a bit of data, i usually call a little subroutine (that i've dragged around for 40 years) to show the data in hex but if there is some experimenting to be done, having selected data in a file is quite handy. . .

Quote:
Edit masks are ok, if you know how to use them.
Regardless of coding language these need to be understood. . . I rank these somewhat higher than "ok" as pretty much every quantity or amount needs to be "masked" when output to other than a file (screen, report, etc).

Quote:
This TS knows nothing about EZT or numeric values/representations.
Maybe not yet - but this will change. . .
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Sat Jul 24, 2010 9:30 am
Reply with quote

Quote:

Don't know how you've done things, but i've written "stuff" to a file so i could easily see it in hex. . .

If it is only a bit of data, i usually call a little subroutine (that i've dragged around for 40 years) to show the data in hex but if there is some experimenting to be done, having selected data in a file is quite handy. . .


Hello Dick,

of course i know how to write data to a file and show it in hex, but i
didnt see the TS showing that data. Only some typed values not being
representations of zoned numeric data.
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 -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts Help required to reset decimal points... DFSORT/ICETOOL 9
No new posts Unable to interpret a hex value to De... COBOL Programming 4
No new posts small int to zoned decimal conversion DFSORT/ICETOOL 3
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top