z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Passing an array to a function

z/OS UNIX System Services User's Guide
SA23-2279-00

When an array is passed as an argument to a function, it is passed by reference. This means that the function works with the actual array, not with a copy. Anything that the function does to the array has an effect on the original array. split is a built-in function that takes an array as an argument.
split(string,array)
split breaks up string into fields, and assigns each of the fields to an element of array. The first field is assigned to array[1], the next to array[2], and so on. Fields are assumed to be separated with the field separator string FS. If you want to use a different field separator string, you can use:
split(string,array,fsstring)
where fsstring is the field separator string you want to use instead of FS. The result of split is the number of fields that string contained.
Note: split actually changes the elements of array. When an array is passed to a function, the function may change the array elements.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014