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

Author Message
seman18

New User

Joined: 08 Feb 2009
Posts: 67
Location: hz

Posted: Thu Dec 03, 2009 7:43 am    Post subject: How to convert the fixed decimal stored to decimal value

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

dick scherrer

Site Director

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

Posted: Thu Dec 03, 2009 8:00 am    Post subject:

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
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.
seman18

New User

Joined: 08 Feb 2009
Posts: 67
Location: hz

Posted: Thu Dec 03, 2009 10:38 am    Post subject:

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]
dick scherrer

Site Director

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

Posted: Thu Dec 03, 2009 10:44 am    Post subject:

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.
seman18

New User

Joined: 08 Feb 2009
Posts: 67
Location: hz

Posted: Thu Dec 03, 2009 11:02 am    Post subject:

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
Garry Carroll

Senior Member

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

Posted: Thu Dec 03, 2009 1:32 pm    Post subject:

 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.
seman18

New User

Joined: 08 Feb 2009
Posts: 67
Location: hz

Posted: Thu Dec 03, 2009 2:35 pm    Post subject:

Garry, below snippet is from the JCL generated from Datareporter
 Code: DEF SOLD                1396-1403  P2
Garry Carroll

Senior Member

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

 Posted: Thu Dec 03, 2009 2:49 pm    Post subject: 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.
dick scherrer

Site Director

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

Posted: Fri Dec 04, 2009 3:27 am    Post subject:

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'.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics How to group and sum the decimal value sakrat DFSORT/ICETOOL 2 Tue Mar 06, 2018 9:13 pm CICS web service from DB2 Triggers or... kiranprasad DB2 2 Wed Dec 20, 2017 11:10 am Can EDCICONV convert EBCDIC to ASCII... natt.sut IBM Tools 3 Fri Nov 17, 2017 8:46 pm Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm

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