Memory Compare (MEMCMP)

Instruction Syntax

Bound Program Access
Built-in number for MEMCMP is 17.
MEMCMP (                                                                        
        string1         : address of aggregate(*)                               
        string2         : address of aggregate(*)                               
        string_length   : unsigned binary(4) value which specifies the             
                          length of string1 and string2                         
) :   signed binary(4) value which indicates if string1 is lexically               
      less than (-1), equal to (0) or greater than (1) string2                  

Description:

A compare is done of the storage specified by string1 and string2. If the first byte of string1 is less than the first byte of string2, the function returns -1; if the byte is greater the function returns 1. If the bytes are equal the function continues with the next byte. This process is repeated until the number of bytes specified by string length have been compared. If all bytes compare equal, the function returns 0. If the string length value is zero, the function also returns 0.

Authorization Required

  • None

Lock Enforcement

  • None

Exceptions

  • 06 Addressing
    • 0601 Space Addressing Violation
    • 0602 Boundary Alignment
  • 24 Pointer Specification
    • 2401 Pointer Does Not Exist
  • 44 Protection Violation
    • 4401 Object Domain or Hardware Storage Protection Violation