Here are some notes for references if you are trying to change the preferences settings in ZOS-API!
The ZOSAPI.IZOSAPI_Connection.PreferencesFile only works in standalone mode and not in other 3 modes.
When you didn't specify a PreferenceFile (or when the given path is wrong), all settings in the preferences cannot be changed by API. In other words, only in standalone mode, you can change preferences settings.
The only way to read a second preferencesFile is to close the current IZOSAPI_Application, change the path, and reconstruct the IZOSAPI_Application. In other words, I cannot read a new PreferenceFile in real time when I’m opening a file via ZOS-API in the standalone application mode.