On Thu, 3 Jul 2025 17:07:42 +0200, Radoslaw Skorupka <[email protected]> 
wrote:

>They say there are no stupid questions...
>
>
>I have the following statement in REXX code (linkpgm):
>some_parm = '00000100'x
>That means 256 decimal.
>However I want to replace '00000100' with some variable, a result of
>some calculations
>Let's imagine, x=a+b-c
>
>How to transform x to a proper format for some_parm?
>Note: I have to keep the length of the variable, so '100' is not a
>solution.
>
>I've tried the following:
>x=a+b-c           /*let's say x=110+156-10 */
>x2=d2x(x)      /*x2 is 100, no leading zero's*/
>x3=RIGHT(x2,8,0)  /* now x3 is 00000100, but it is text string */
>x4=x2c(x3)            /* x4 consist of 4 bytes, characters are
>unprintable, but it is '00000100'x */
>
>It works, but isn't it reinventing the wheel? That means, am I missing
>some simpler way?
>
>--
>Radoslaw Skorupka
>Lodz, Poland

x2 = d2c(x,4)     '00000100'x
x2 = d2x(x,8)     00000100

-- 
Dale R. Smith

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to