Skip to main content

This article provides an example of intrinsic functions NATIONAL-OF and DISPLAY-OF in a COBOL unstring statement.

Problem:

How are the intrinsic functions NATIONAL-OF and DISPLAY-OF used in a COBOL unstring statement?

Resolution:

See the COBOL code pasted below:

$SET NSYMBOL(NATIONAL)
working-storage section.
01 v1 pic X(10).
01 v2 pic X(10).
01 v1v2 pic X(20).

01 v1N pic N(10).
01 v2N pic N(10).
01 v1v2N pic N(20).

procedure division.
move "v1 v2" to v1v2 initialize v1 v2
unstring v1v2 delimited by space into v1 v2

move "v1N v2N" to v1v2N initialize v1N v2N
unstring v1v2N delimited by space into v1N v2N

move "v1 v2" to v1v2 initialize v1N v2N
unstring FUNCTION NATIONAL-OF(v1v2)
delimited by space into v1N v2N

move "v1N v2N" to v1v2N initialize v1 v2
unstring FUNCTION DISPLAY-OF(v1v2N)
delimited by space into v1 v2

move "v1N v2N" to v1v2N initialize v1 v2
unstring FUNCTION DISPLAY-OF(v1v2N)
delimited by space into v1 v2

Incident Number: 2277970

Old KB# 14514