|
Copyright (c) Kednos Corporation 2008. All rights reserved LAYERED PRODUCT: Alpha PLI, V4.5 OP/SYS: VMS, V8.3 VAX PLI, V3.8 OP/SYS VMS, V7.3 SOURCE: Kednos Customer Support Center OVERVIEW: Many system routines require areguments be unsigned 16 bit integers. PL/I does not have such a native data type, so here we present several techniques for accomplishing this For 16 bit unsigned integers there are two methods the first doesn't require additional storage and the second needs a fixed binary(31) for temporary storage 1. rab.rab$w_rsz = int(reverse(bit(bytesize(msg_block(blk))), 1, 16); In this example the size of the msg_block was greater than 32767 which is the largest fixed binary(15) but less than 65536, the largest unsigned integer that fits into a 16-bit word. 2. dcl temp fixed binary(31), alias fixed bin(15) based; temp = size(msg_block(blk)) - 65536; rab.rab$w_rsz = addr(temp) -> alias; N.B. This presumes little endian byte ordering 3. dcl temp fixed binary(31), alias fixed bin(15) based(addr(temp)); temp = size(msg_block(blk)) - 65536; rab.rab$w_rsz = alias; |