MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compute / Move : Function Length

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Mon Apr 24, 2006 5:36 am    Post subject: Compute / Move : Function Length Reply with quote

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
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Apr 24, 2006 8:18 am    Post subject: Reply with quote

Mf_user,

Read the following link carefully with attention to sections 7.1.1.2 Types of functions & 7.1.1.3 Rules for usage. The function you are interested in Numeric function.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3LR10/7.1.1?DT=20020920180651

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Mon Apr 24, 2006 11:30 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group