Library View Topics Framed Contents Revised Topics Previous Topic Next Topic Search Search ResultsPrevious Topic MatchNext Topic Match Notes List Notes Print Download No PDF Handheld DisconnectedHandheld ConnectedHelp

7.1.20 LENGTH



The LENGTH function returns an integer equal to the length of the argument in bytes. The function type is integer.

The function result is a 9-digit integer.


    ___ Format _____________________________________________________________ 
   |                                                                        |
   | >>__FUNCTION LENGTH__(argument-1)___________________________________>< |
   |                                                                        |
   |________________________________________________________________________|
argument-1
Can be a nonnumeric literal or a data item of any class or category
X (except DBCS).

If argument-1, or any data item subordinate to argument-1, is described with the DEPENDING phrase of the OCCURS clause, the contents of the data item referenced by the data-name specified in the DEPENDING phrase are used at the time the LENGTH function is evaluated.


X A data item described with USAGE IS POINTER or USAGE IS PROCEDURE-POINTER
X can be used as argument-1 to the LENGTH function.


X The ADDRESS OF special register can be used as argument-1 to the LENGTH
X function.


X If the ADDRESS OF special register or LENGTH OF special register is used
X as argument-1 to the LENGTH function, the result will always be 4,
X independent of the ADDRESS OF or LENGTH OF object.

If argument-1 is a nonnumeric literal, an elementary data item, or a group data item that does not contain a variable occurrence data item, the value returned is an integer equal to the length of argument-1 in character positions.

If argument-1 is a group data item containing a variable occurrence data item, the returned value is an integer determined by evaluation of the data item specified in the DEPENDING phrase of the OCCURS clause for that variable occurrence data item. This evaluation is accomplished according to the rules in the OCCURS clause regarding the data item as a sending data item. For more information, see the discussions of the OCCURS clause and USAGE clause.

If argument-1 is a null-terminated nonnumeric literal, then the returned value is the number of characters in the literal excluding the null character that is added at the end of the literal.

The returned value includes implicit FILLER characters, if any.

Previous Topic Next Topic © Copyright IBM Corp. 1991, 1998

IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.





Return to library:   z/OS | z/OS.e | TPF | z/VSE | z/VM | IBM Hardware | IBM System z Redbooks
Glossary:   IBM terminology
Publications:   How to order publications
Readers:   Download IBM Library Reader | Download IBM Softcopy Reader | Download Adobe® Acrobat® Reader®
Library management:   Download IBM Softcopy Librarian
Contacts:   Contact z/OS


Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.