× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: how to create unsigned hexadecimal initial value
  • From: rjd@xxxxxxxxxx
  • Date: Fri, 25 Aug 2000 18:29:09 -0500

I think even the more recent examples are easy to explain in terms of the
definition I gave for H literals.

Example 1:

DCL DD NN BIN(2) INIT(H'8000');
Diagnostics
Initial value for data object too large.

The above is equivalent to initializing NN with 32768, which is greater
than the largest positive number that can be represented by BIN(2).  So,
the error message is correct.  If the intent is to initialize NN with
-32768, then use one of the following forms:
DCL DD NN BIN(2) INIT(H'FFFF8000');
DCL DD NN BIN(2) INIT(-32768);

Example 2:

DCL DD NN BIN(2) INIT(H'FFFF')
Diagnostics
Initial value for data object too large.

Same problem here.  65535 (H'FFFF') is too large to be represented by a
BIN(2) data object.  Use the following forms to initialize NN to -1:
DCL DD NN BIN(2) INIT(H'FFFFFFFF');
DCL DD NN BIN(2) INIT(-1);

Example 3:

DCL DD NN BIN(2);
DCL DD XX CHAR(2) DEF(NN);

CPYNV  NN, -1;
AND(S) NN,H'0003'; /* Equivalent to AND(S) NN, 3; */
CVTHC MSG-TEXT(1:4), XX;
CALLI SHOW-MESSAGE, *, .SHOW-MESSAGE;    <==== shows  0300    wrong

H'00003' represents the value 3 and has length 1 (unlike character
constants, the leading zeros are not significant).  Based on the
specification for AND(S), the shorter operand is padded on the right with
zeros.  So, the expected result of ANDing op1=x'FFFF' with op2=x'03' is
x'0300'.

A fourth example was given, but I think it has to do with strange behavior
from CPYBLA rather than anything to do with H literals.   The example was
this:

DCL DD XX CHAR(2)
CPYBLA XX,H'1234';  /* WRONG --> yields  result   3400. */

The same result is produced if the H literal is replaced with its decimal
equivalent, 4660.  For some reason, operand 2 is treated as a one byte
value (just the low order byte).  I'll investigate this further.

Bob Donovan


+---
| This is the MI Programmers Mailing List!
| To submit a new message, send your mail to MI400@midrange.com.
| To subscribe to this list send email to MI400-SUB@midrange.com.
| To unsubscribe from this list send email to MI400-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: dr2@cssas400.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.