Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
HP.com home
Jazz home  >  Papers & Training

COBOL II/iX enhancements

» 

Jazz home

»

Software

»

Papers & Training

»

Java

»

HP Partners

»

News & Events

»

Register for more info

Content starts here

Version A.04.16 of HP COBOL II/iX, released in Express 4 for 5.5, makes available several addtional enhancements that were requested by Interex SIGCOBOL.

  1. Internal data structures of the compiler have been expanded again to permit compiling even larger programs. With Express 3 for 5.5, it was possible to compile programs in excess of 100,000 lines. While there is no specific limit on the number of lines permitted in a source program, the version of the compiler on Express 4 should be capable of processing programs well in excess of 200,000 lines.

  2. The compiler has been enhanced to permit an index-name to be used as an operand of a DISPLAY statement. This is an ANSI extension, and if this feature is used and $CONTROL STDWARN is specified, the compiler will display warning 517, "DISPLAY of index-name is nonconforming nonstandard (HP extension)."

  3. The run-time library has been enhanced with a set of procedures to simplify bit manipulation in COBOL II/iX.

New routines for boolean operations


There are six new routines for performing boolean operations: HP_BYTE_AND, HP_BYTE_OR, HP_BYTE_XOR, HP_BYTE_NOT, HP_BYTE_UNPACK, and HP_BYTE_PACK. These procedures reside in the COBOL II run-time library in XL.PUB.SYS, but may be called from any program running in Native Mode.

The routines HP_BYTE_AND, HP_BYTE_OR, and HP_BYTE_XOR perform bitwise AND, bitwise inclusive OR, and bitwise exclusive OR. The two operands and the result may be any length, but must be the same length, and must be an integral number of bytes. The three routines have identical calling sequences. The first two parameters are the two operands, passed by reference. The third parameter is the result, also passed by reference. The final parameter is the length, in bytes, of the operands, and is passed by value. The first three parameters may not overlap, except in the case where two of them, or all three, are the same data item.

Examples:

CALL "HP_BYTE_AND" USING OPERAND-1, OPERAND-2, RESULT, \4\. CALL "HP_BYTE_OR" USING DATA-ITEM, MY-BIT-MASK, RESULT, \2\. CALL "HP_BYTE_XOR" USING INPUT-BUFFER (J:1), RUNNING-XOR, RUNNING-XOR, \1\.

Note: In COBOL II/iX, backslashes ("\") are used to indicate that a parameter is passed by value. If the parameter is a literal, the backslashes are optional.

The routine HP_BYTE_NOT has the same calling sequence, except that there is only one operand rather than two. The result is computed as the bitwise complement of the operand. The operand and the result must be the same length, and must be an integral number of bytes. They may not overlap, except that the same data item may be used for both.

Example:

CALL "HP_BYTE_NOT" USING OPERAND, RESULT, \4\.

The routine HP_BYTE_UNPACK takes three parameters: an operand, a result, and the length of the operand in bytes. The bits of the operand are unpacked into the result, left to right. Each "zero" bit of the operand becomes an ASCII "0" byte in the result; each "one" bit becomes an ASCII "1" byte. The length specified is the byte length of the operand. The byte length of the result must be 8 times the byte length of the operand.

Example:

01 FIELD-A PIC S9(4) COMP. 01 RESULT PIC X(16). ... MOVE 5 TO FIELD-A. CALL "HP_BYTE_UNPACK" USING FIELD-A, RESULT, \2\. DISPLAY RESULT.

  • Results in "0000000000000101".
  • The routine HP_BYTE_PACK is similar. The first parameter, the operand, is a sequence of ASCII bytes. Each byte of the operand is converted to a bit in the result, left to right. An ASCII "0" becomes a "zero" bit; anything other than an ASCII "0" becomes a "one" bit. The length specified is the length of the result in bytes. The byte length of the operand must be 8 times the byte length of the result.

    Example:

    01 BYTE-STRING PIC X(16). 01 RESULT-N PIC S9(4) COMP. ... MOVE "0000000000001111" TO BYTE-STRING. CALL "HP_BYTE_PACK" USING BYTE-STRING, RESULT-N, \2\. DISPLAY RESULT-N.

  • Results in +15.

  • Page last updated on Mon Dec 22 1997
    Printable version
    Privacy statement Using this site means you accept its terms Feedback to webmaster
    © 2004 Hewlett-Packard Development Company, L.P.