Copy Null-Terminated String Constrained (STRNCPYNULL)

Instruction Syntax

Bound Program Access
Built-in number for STRNCPYNULL is 13.
STRNCPYNULL (                                                                   
             target_string                   : address of aggregate(*)          
             null_terminated_source_string   : address of aggregate(*)          
             maximum_length                  : unsigned binary(4) value            
                                               which specifies the              
                                               maximum number of bytes          
                                               to copy                          
) :   space pointer(16) to the target string                                            

Description:

A copy is performed from the storage specified by null terminated source string to the storage specified by target string. The copy terminates after a null (ie. zero) character is copied or the number of bytes specified by maximum length have been copied (which ever comes first). However, if a null character is not copied, one will be appended to the end of the target string. Thus, the maximum number of characters which may be copied is one more than the value of maximum length. It is expected that sufficient storage exists at the location specified by target string.

Undefined results can occur if the storage locations specified by target string and null terminated source string overlap.

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
    • 4402 Literal Values Cannot Be Changed