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



On 07-Dec-2011 08:30 , Dan Kimmel wrote:
I don't remember there being a *BINARY data type or a %BINARY
built-in for CL at V2R1. I think the only built-in was %SUBSTR.

By v2r2\v2r3 for sure. I have seen references from 1993.

FWiW and the archives...

Hmmm, just found v2r2 as origin per:

_Binary Support in CL_
-> Programming - CL
Written by Ernie Malaga
Saturday, 31 October 1992 18:00
http://www.mcpressonline.com/programming/cl/binary-support-in-cl.html
"V2R2M0'S built-in %BIN function provides power worth waiting for. ... Before V2R2M0, however, the CL program itself could not read the numeric value of these parameters-unless you used utility commands such as Convert Binary to Decimal (CVTBINDEC) from QUSRTOOL."

Even in V5R2 there was still mention of "CL programs do not support the handling of binary values in variables, but you can use the %BINARY built-in function to..." access details about command parameters [PARM] with elements [ELEM]. So although there had not been any *INT [and *UINT] data types for CLP for a very long time [until v5r3?], one could [since v2r2m0 apparently], refer to either two or four bytes of character data as the integer equivalent; e.g. for *CMD *INT\*INT4, *CMD "length" values and "number of elements", and API integer values. And if desirable [or required] in order to do calculations or see the value presented by the debugger or DMPCLPGM output as decimal values, then the integer value [stored in *CHAR data] was easily assigned to a *DEC variable; e.g.:

dcl &p10 *DEC (10 0)
dcl &c2 *CHAR 2 value(x'0008')
chgvar &P10 %BIN(&C2) /* P10= 8 */
chgvar &P10 (&P10 * 2) /* P10=16 */
chgvar %BIN(&C2) &P10 /* C2=x'0010' */
/* while the next two statements presumably worked since %BIN */
/* was first a valid Built-In, I only recall always using a */
/* *DEC as an intermediate to perform arithmetic; though not */
/* for evaluating conditions such as IF COND(%bin(&c2) *LE 8) */
chgvar &p10 (%bin(&c2) * 2) /* P10=32 */
chgvar %bin(&c2) (%bin(&c2) * 2) /* C2=x'0020' */

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.