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

How to convert the fixed decimal stored to decimal value


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Thu Dec 03, 2009 8:00 am
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
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

Moderator Emeritus


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

PostPosted: Thu Dec 03, 2009 10:44 am
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
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

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Thu Dec 03, 2009 1:32 pm
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
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

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Thu Dec 03, 2009 2:49 pm
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

Moderator Emeritus


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

PostPosted: Fri Dec 04, 2009 3:27 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
Search our Forums:

Back to Top