View previous topic :: View next topic |
Author |
Message |
mf_user Intermediate

Joined: 01 Jun 2003 Posts: 372 Topics: 105
|
Posted: Mon Apr 24, 2006 5:36 am Post subject: Compute / Move : Function Length |
|
|
Hi,
I put the below code and compiled it.
Code: |
WORKING-STORAGE SECTION.
01 INPUT-CHARS PIC X(50).
01 VAR-1 PIC 9(4) COMP.
PROCEDURE DIVISION.
BEGIN.
MOVE FUNCTION LENGTH (INPUT-CHARS) TO VAR-1.
DISPLAY VAR-1.
|
It gives me the below SEVERE error:
Quote: |
Numeric function "INTEGER FUNCTION LENGTH" was not allowed in this
context. The statement was discarded.
|
But, if I use the following code the compilation is smooth.
Code: |
WORKING-STORAGE SECTION.
01 INPUT-CHARS PIC X(50).
01 VAR-1 PIC 9(4) COMP.
PROCEDURE DIVISION.
BEGIN.
COMPUTE VAR-1 = FUNCTION LENGTH (INPUT-CHARS).
DISPLAY VAR-1.
|
Would you please tell me why? We are using "IBM Enterprise COBOL for z/OS 3.3.1".
TIA. _________________ MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
== |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
mf_user Intermediate

Joined: 01 Jun 2003 Posts: 372 Topics: 105
|
Posted: Mon Apr 24, 2006 11:30 pm Post subject: |
|
|
Thanks.
I believe the below is what you talk about........
Quote: |
Numeric functions
A numeric function can be used only where an arithmetic expression can be specified.
A numeric function can be referenced as an argument for a function that allows a numeric argument.
A numeric function cannot be used where an integer operand is required, even if the particular reference will yield an integer value. The INTEGER or INTEGER-PART functions can be used to force the type of a numeric argument to be an integer.
|
_________________ MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
== |
|
Back to top |
|
 |
|
|