Compare Null-Terminated Strings Constrained (STRNCMPNULL)

Instruction Syntax

Bound Program Access
Built-in number for STRNCMPNULL is 19.
STRNCMPNULL (                                                                   
             null_terminated_string1   : address of aggregate(*)                
             null_terminated_string2   : address of aggregate(*)                
             maximum_compare_length    : unsigned binary(4) value which            
                                         specifies the maximum number of        
                                         bytes to compare                       
) :   signed binary(4) value which indicates if null_terminated_string1            
      is lexically less than (-1), equal to (0) or greater than (1)             
      null_terminated_string2                                                   

Description:

A compare is done of the storage specified by null terminated string1 and null terminated string2. If the first byte of null terminated string1 is less than the first byte of null terminated 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 either:

  • The end of null terminated string1 (ie. a null character) and null terminated string2 is reached. The function returns 0.
  • The end of null terminated string1 is reached. The function returns -1.
  • The end of null terminated string2 is reached. The function returns 1.
  • The number of characters specified by maximum compare length have been compared. The function 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