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

Fixed Binary(07)


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Fri Nov 30, 2007 2:44 pm
Reply with quote

Hi all,

Can we use FIXED BINARY(07) in Enterprise PLI(in Z/OS). When I tried this, I got MAXCC = 08.


Please clarify me.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Nov 30, 2007 2:47 pm
Reply with quote

what does the manual say ??
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Fri Nov 30, 2007 2:49 pm
Reply with quote

Quote:
FIXED BINARY with precision 7 or less is mapped to 1
byte.


This is the error message.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Nov 30, 2007 2:59 pm
Reply with quote

are You sure that' s an error message,
I was curious and checked the manuals....
fixed bin(7) is perfectly legal !!
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Fri Nov 30, 2007 3:06 pm
Reply with quote

Yes. That was the error message I have got. But it looks like inforamtion. Additionally, I have got this info from Quick Reference.

The OS/370 PL/I and PL/I for MVS compilers would have mapped
this to 2 bytes.



I think FIXED BINARY(07) is legal in PLI, but not in EPLI.

Correct me I am wrong. And I expect more details on this.
Back to top
View user's profile Send private message
br15

New User


Joined: 13 Jun 2007
Posts: 7
Location: Alaska

PostPosted: Mon Dec 03, 2007 3:30 am
Reply with quote

I believe Fixed Bin maps the storage half-word full-word or double-word. The smallest storage area for binary integers should be on a half-word that is 2 bytes, that's 15 bits plus sign-bit, as Quick Ref states.
So the right syntax should be FIX BIN(15).
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Dec 03, 2007 3:51 am
Reply with quote

here are the links to the PL/I view of things

for pl/i ( non enterprise )
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ibm3l101/2.4.1.6?ACTION=MATCHES&REQUEST=fixed+and+binary&TYPE=FUZZY&SHELF=IBMSH306&DT=19950506201638&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT
Quote:

2.4.1.6 Binary Fixed-Point Data

A binary fixed-point constant consists of one or more binary digits with an optional binary point, followed immediately by the letter B. Binary fixed-point constants have a precision (p,q), where p is the total number of binary digits in the constant, and q is the number of binary digits specified to the right of the binary point. Examples are:

Constant Precision
10110B (5,0)
11111B (5,0)
101B (3,0)
1011.111B (7,3)

The data attributes for declaring binary fixed-point variables are BINARY and FIXED. For example:

DECLARE FACTOR BINARY FIXED (20,2);

FACTOR is declared a variable that can represent binary fixed-point data items of 20 digits, two of which are fractional.

The default precision is (15,0). A binary fixed-point data item with:

* 15 digits or less is stored as a fixed-point binary halfword
* More than 15 digits, up to 31, is stored as a fullword.

(A halfword is 15 bits plus a sign bit, and a fullword is 31 bits plus a sign bit).

The declared number of digits is in the low-order positions, but the extra high-order digits participate in any operations performed upon the data item. Any arithmetic overflow into such extra high-order digit positions can be detected only if the SIZE condition is enabled.


for pl/i ( enterprise )
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ibm3lr20/3.3.1.5?SHELF=IBMSH320&DT=20031030085717

Quote:

3.3.1.5 SIGNED and UNSIGNED attributes

The SIGNED and UNSIGNED attributes can be used only with FIXED BINARY variables and ORDINAL variables. SIGNED indicates that the variable can assume negative values. UNSIGNED indicates that the variable can assume only nonnegative values.

UNSIGNED has the following effects on the semantics of fixed-point operations:

* The result of IAND, IEOR, INOT and IOR is UNSIGNED if all the operands are UNSIGNED.

* The result of ISLL and ISRL is UNSIGNED if the first operand is UNSIGNED.

* The result of REAL or IMAG is UNSIGNED if its operand is UNSIGNED.

If you are using the RULES(ANS) compiler option, UNSIGNED has the following effect on the semantics of fixed- point operations:

* The result of an add, multiply, or divide operation is UNSIGNED if both operands are UNSIGNED.

* The result of MAX or MIN is UNSIGNED if all operands are UNSIGNED

* The result of REM or MOD is UNSIGNED if all operands are UNSIGNED

The SIGNED and UNSIGNED attributes affect storage requirements, as shown in Table 10 and Table 11.

Table 10. FIXED BINARY SIGNED data storage requirements
This precision: Occupies this amount of storage (bytes):
precision <= 7 1
7 < precision <= 15 2
15 < precision <= 31 4
31 < precision <= 63 8

Table 11. FIXED BINARY UNSIGNED data storage requirements
This precision: Occupies this amount of storage (bytes):
precision <= 8 1
8 < precision <= 16 2
16 < precision <= 32 4
32 < precision <= 64 8


so nothing wrong on the definition of a fixed bin ( 7 )
I would like to see the EXACT error message !!!
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Mon Dec 03, 2007 2:12 pm
Reply with quote

See the sample code.

Code:
DCL B FIXED BINARY(7,0);
B = 10;                 
PUT SKIP LIST(B); 


When I compile the above code, I get MAXCC = 8.

These are the things I got.

IBM(R) Enterprise PL/I for z/OS V3.R6.M0 (Built:20070802)


Compiler Messages
Message - Line.File - Message Description
IBM1044I E - 2.0 - FIXED BINARY with precision 7 or less is mapped
to 1 byte.


I think it is related to compiler options. Changing compiler options, we can avoid this.

Correct me if I am wrong.
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Mon Dec 03, 2007 2:57 pm
Reply with quote

Gnanas,
Normally Bin Fixed(7) in PLI 2.3 version occupies 2 bytes of memory. But Bin Fixed(7) in IBMZPLI takes only one byte. To fix this we need to increase Bin fixed from 7 to 15.

This is the information I have related to Fixed Bin. Could be useful to you.
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Mon Dec 03, 2007 2:59 pm
Reply with quote

And also, explanation for the error IBM1044I is.

IBM1044I I FIXED BINARY with precision 7 or less is
mapped to 1 byte.
Explanation: The OS/370 PL/I compiler would have
mapped this to 2 bytes.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Mon Dec 03, 2007 3:06 pm
Reply with quote

Thanks Srihari G.

I understood...
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 Pulling a fixed number of records fro... DB2 2
No new posts Converting fixed length file to excel... IBM Tools 7
No new posts comparasion between BIN FIXED(63) an... PL/I & Assembler 10
No new posts Variable length(Pipe delimter) to Fix... DFSORT/ICETOOL 8
Search our Forums:

Back to Top