Knowing when to receive BY VALUE

The following situations describe when it is appropriate for the COBOL program to receive parameters BY VALUE:

  • The item coming into COBOL is being passed by value from C. (The item is not being passed via a pointer and its value in the calling program should not be modified.)
  • The item coming into COBOL is a type of pointer that will require multiple levels of dereferencing.
  • The item coming into COBOL is a pointer that may potentially have a NULL value and must be validated before usage in order to prevent an exception (particularly 0C4).
  • Any pointer coming into COBOL that requires manual dereferencing using the SET operator.
  • Any pointers to C functions.
  • Any incoming value that is a pointer and will need to have pointer arithmetic performed upon it.