You can use intrinsic functions in reference modifiers if you do not know the leftmost position or length of a substring at compile time.
For example, the following code fragment causes a substring of Customer-Record to be moved into the data item WS-name. The substring is determined at run time.
05 WS-name Pic x(20). 05 Left-posn Pic 99. 05 I Pic 99. . . . Move Customer-Record(Function Min(Left-posn I):Function Length(WS-name)) to WS-name
If you want to use a noninteger function in a position that requires an integer function, you can use the INTEGER or INTEGER-PART function to convert the result to an integer. For example:
Move Customer-Record(Function Integer(Function Sqrt(I)): ) to WS-name
related references
INTEGER
(COBOL for Windows Language Reference)
INTEGER-PART
(COBOL for Windows Language Reference)