Limitations of COBOL Intrinsic Functions

An intrinsic function is actually a call to a subroutine that acts like a data item. You can’t use an intrinsic function as the destination of a MOVE or in any command that attempts to use it as a destination type data item.

An intrinsic function acts like a constant or a read-only value

The following statements are illegal because the intrinsic function is being used as the destination of a MOVE or STRING:

MOVE “199701011236174800000” TO FUNCTION CURRENT-DATE.
STRING “199701011236174800000” DELIMITED BY SIZE
INTO FUNCTION CURRENT-DATE.

An intrinsic function doesn’t actually modify the data item arguments that it operates on. Instead, it creates¬†a temporary variable and acts on that.

In the following example, after the two statements are executed,¬†ALPHA-FIELD still contains the lowercase “hello”, while OTHER-FIELD now contains “HELLO”.

The call to FUNCTION UPPER-CASE(ALPHA-FIELD) doesn’t modify the contents of ALPHA-FIELD:

MOVE "hello" TO ALPHA-FIELD.
MOVE FUNCTION UPPER-CASE(ALPHA-FIELD) TO OTHER-FIELD.

Related Posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.