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
 

 

How to convert the fixed decimal stored to decimal value

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
seman18

New User


Joined: 08 Feb 2009
Posts: 67
Location: hz

PostPosted: Thu Dec 03, 2009 7:43 am    Post subject: How to convert the fixed decimal stored to decimal value
Reply with quote

There are three fields for below data, first is AAAZ(Char(4), second is 994EFH005(char(9)), the last is ........ (fixed(15,2), how can I know the last's decimal value?
and second question is why PLI use "C1" to represent "A", A's hex value should "41" since A's ascii code is 65, can some one help me?
Code:
AAAZ994EFH005........
CCCEFFFCCCFFF00000000
11199945680050C000000
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 Dec 03, 2009 8:00 am    Post subject:
Reply with quote

Hello,

Hopefully, i've made the correct changes to your post. I could not tell if the info was done for a chat room, done with a faulty keyboard, or possibly i really misread or misunderstood. . .

Also, suggest you practice with the Code tag to preserve alignment ([/img] is not what you want ( i believe), so i Code'd the data.

It looks as though the data does not match the description. That "C" should probably be in the low-order nibble of the 8-bytes . . .

Quote:
A's hex value should "41" since A's ascii code is 65,
Huh icon_confused.gif
On an IBM mainframe, a capital A is always and only x'C1'. An x'D1' is always a J; a Z is an x'E9' and so on. Suggest you key the alphabet into a member and set HEX ON and see hex values just like you posted.
Back to top
View user's profile Send private message
seman18

New User


Joined: 08 Feb 2009
Posts: 67
Location: hz

PostPosted: Thu Dec 03, 2009 10:38 am    Post subject:
Reply with quote

Thanks for your help.
I just made a test that wrote 0 or 0.00 as fixed(15,2) type to a file,and I got the same result as follow
Code:

........
00000000
0000000C


so what 's value for below
Code:

........
00000000
0C000000
[/code]
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 Dec 03, 2009 10:44 am    Post subject:
Reply with quote

Hello,

Code:
........
00000000
0C000000
is not fixed(15,2) type.

Suggest you find the actual data definition(s). The first bit (2 bytes) could be a fixed(3,2) field. The next 6 bytes could be one or more binary fields or something that was uninitialized (garbage) or something that was intentionally initialized to x'00's. You might discover what this is if you look at the process that created the data.
Back to top
View user's profile Send private message
seman18

New User


Joined: 08 Feb 2009
Posts: 67
Location: hz

PostPosted: Thu Dec 03, 2009 11:02 am    Post subject:
Reply with quote

The task I am working on is to use data reporter to find some row meet my requirement,
the copy book snippet I use as follow
Code:

2*******
2 DATA(5),                             
  5 SOLD FIXED(15,2), 
2******


and the JCL snippet the DR created is
Code:

DEF SOLD                1396-1403  P2


and I want to find rows with SOLD not equal to below value, it failed when I write "select SOLD ne 0" or "select SOLD ne 0.00", any suggestion, thx!
Code:

........
00000000
0C000000
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 994
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Thu Dec 03, 2009 1:32 pm    Post subject:
Reply with quote

Quote:
DEF SOLD 1396-1403 P2

is a code, not a JCL, snippet.

It looks like this is overlaying a P2-type field on an 8 byte field (1396-1403). This is consistent with DEC FIXED(15,2). You are mistaken if you think this refers to a 2 byte field beginning at the start location of SOLD.

Garry.
Back to top
View user's profile Send private message
seman18

New User


Joined: 08 Feb 2009
Posts: 67
Location: hz

PostPosted: Thu Dec 03, 2009 2:35 pm    Post subject:
Reply with quote

Garry, below snippet is from the JCL generated from Datareporter
Code:

DEF SOLD                1396-1403  P2
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 994
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Thu Dec 03, 2009 2:49 pm    Post subject:
Reply with quote

seman18,

Can you show the JCL generated (using code tags)? JCL statements begin with a double slash (//), and this line does not conform with that. This may be generated by Datareporter, but it sure ain't JCL.

My reading of the snippet shown is that the P2 refers to a packed field with 2 digits precision. The 1396-1403 indicates the location and length of the field within the record. Thus, the field occupies 8 bytes, is packed and has 2 decimal places - in other (PL/1) words, a decimal fixed(15,2) field.

Garry.
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 Dec 04, 2009 3:27 am    Post subject:
Reply with quote

Hello,

And if the "field" contains this:
Code:
........
00000000
0C000000

it is an invalid packed-decimal value - it will cause an abend if used in a numeric operation. To work with this field, define it as an 8-byte alphanumeric and compare against the hex value x'000C00000000000000000000000000'.
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 -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Convert current to hex value gopurs DFSORT/ICETOOL 4 Wed Feb 15, 2017 5:40 am
No new posts Query on DB2 WLM stored procedures ashek15 DB2 8 Sun Feb 12, 2017 11:13 pm
No new posts Joinkeys with decimal scdinesh DFSORT/ICETOOL 3 Fri Feb 10, 2017 4:46 am
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm


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