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

X 1.1.3.3 LENGTH OF




X The LENGTH OF special register contains the number of bytes used by an
X identifier.


X LENGTH OF creates an implicit special register whose content is equal to
X the current byte length of the data item referenced by the identifier.


X Note: For DBCS data items, each character occupies 2 bytes of storage.


X LENGTH OF can be used in the Procedure Division anywhere a numeric data
X item having the same definition as the implied definition of the LENGTH OF
X special register can be used. The LENGTH OF special register has the
X implicit definition:


 X   USAGE IS BINARY PICTURE 9(9)


X If the data item referenced by the identifier contains the GLOBAL clause,
X the LENGTH OF special register is a global data item.


X The LENGTH OF special register can appear within either the starting
X character position or the length expressions of a reference modification
X specification. However, the LENGTH OF special register cannot be applied
X to any operand that is reference-modified.


X The LENGTH OF operand cannot be a function, but the LENGTH OF special
X register is allowed in a function where an integer argument is allowed.


X If the LENGTH OF special register is used as the argument to the LENGTH
X function, the result is always 4, independent of the argument specified
X for LENGTH OF.


X LENGTH OF can not be either of the following:


X When the LENGTH OF special register is used as a parameter in a CALL
X statement, the parameter must be a BY CONTENT parameter.


X When a table element is specified, the LENGTH OF special register contains
X the length, in bytes, of one occurrence. When referring to a table
X element, it need not be subscripted.


X A value is returned for any identifier whose length can be determined,
X even if the area referenced by the identifier is currently not available
X to the program.


X A separate LENGTH OF special register exists for each identifier
X referenced with the LENGTH OF phrase, for example:


 X   MOVE LENGTH OF A TO B
 X   DISPLAY LENGTH OF A, A
 X   ADD LENGTH OF A TO B
 X   CALL "PROGX" USING BY REFERENCE A BY CONTENT LENGTH OF A


X Note: The number of bytes occupied by a COBOL item is also accessible
X through the intrinsic function LENGTH (See "LENGTH" in topic 7.1.20).
X LENGTH supports nonnumeric literals in addition to data names.

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.