Jump to page titleUNITED STATES
hp.com home products and services support and drivers solutions how to buy
» contact hp

:

more options
 

hp.com home
End of Jump to page title
Example-PLI Using The B4 Format To Output Hexadecimal Values
Jump to content



» 

business support center

Home & Home Office Support:
» HP branded products
» Presario branded products
» Services & Warranties
Small & Medium Business Support:
» Small & Medium Business products
» Small & Medium Business services
Support for IT Professionals:
» Enterprise products (IT Resource Center)
» NonStop enterprise products
» Business & IT Services
Content starts here
Copyright (c) Digital Equipment Corporation 1989. All rights reserved
LAYERED PRODUCT: PLI V3.2     OP/SYS: VMS V5.0-2

SOURCE:     Digital Customer Support Center


OVERVIEW:

This program shows how to output HEXADECIMAL values correctly in PLI.


*** CAUTION ***

This sample program has been tested using:  PRODUCT: PLI V3.2 on OPERATING
SYSTEM: VMS V5.0-2.  However, we cannot guarantee its effectiveness because of
the possibility of errors in transmitting or implementing it.  It is meant to
be used as a template for writing your own program, and it may require
modification for use on your system.


PROGRAM NOTES:

Normally, if the B4 format is used to output fields in hexadecimal
format, the values that are output are double what they should be.

The doubling occurs because of the implicit conversion that PLI does
between FIXED BINARY(7) and BIT(*), which is the target data type for
the B4 format.  The integer 1, expressed in FIXED BINARY(7), is:

        sign bit: 0, data bits: 0000001

PLI then converts this to a bit string:

        data bits: 0000001

To display it in B4 format, it breaks it into 4-bit chunks, padding on
the right where necessary:

        0000         -> 0 printed
        001  -> 0010 -> 2 printed

If you code the PUT EDIT statement to read:

  PUT edit ((reverse(unspec(data_field)))) (B4);

UNSPEC views the internal form of the data item as a bit string (bits
read from lowest to highest):

1 as FIXED BINARY(7) is 00000001 (reading highest bit [sign bit] to
lowest bit). UNSPEC of this is '10000000'B.  REVERSE turns the bits
around so that the bit string reads '00000001'B.  This will display
properly in B4 format.


The following program demonstrates how to output the PID in HEX
format.


PROGRAM EXAMPLE:

getjpi: proc options(main);

%include $stsdef;
%include $jpidef;
%include lib$getjpi;

dcl func fixed bin(31) init(jpi$_pid);
dcl pid fixed bin(31) init(0);

sts$value = lib$getjpi(func,,,pid,,);

if ^sts$success
    then signal vaxcondition(sts$value);

put skip edit('The PID is ',reverse(unspec(pid))) (a,b4);

end getjpi;




buy online or call 1.800.AT.COMPAQ
privacy statementusing this site means you accept its terms