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
 

 

More moving a packed decimal to numeric in EZT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
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    Post subject: More moving a packed decimal to numeric in EZT
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Fri Jul 23, 2010 11:27 am    Post subject:
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    Post subject:
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Fri Jul 23, 2010 12:25 pm    Post subject:
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    Post subject:
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    Post subject:
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Fri Jul 23, 2010 2:10 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Fri Jul 23, 2010 7:45 pm    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Fri Jul 23, 2010 8:40 pm    Post subject: Re: More moving a packed decimal to numeric in EZT
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    Post subject:
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

Site Director


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

PostPosted: Fri Jul 23, 2010 9:34 pm    Post subject:
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Fri Jul 23, 2010 9:55 pm    Post subject:
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

Site Director


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

PostPosted: Fri Jul 23, 2010 10:11 pm    Post subject:
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Sat Jul 24, 2010 9:30 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CA Products All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts Moving a PD to PD spoorni DFSORT/ICETOOL 8 Fri Oct 07, 2016 9:52 pm
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 pm
This topic is locked: you cannot edit posts or make replies. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm


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