It looks like it isn't currently possible to have a user-defined function return a pic 1 item. I've reproduced the "Undefined error. Inform Technical Support" error message with my own test program. I'll see if there's an open RPI for this, and raise one if not. Austin1 suggested you use a level-88. That's not at all the same thing as a function that returns a true or false result, but it might suit your purposes. Level-88 items are constant values that can be used to abbreviate testing conditions. For example: working-storage section. 01 ws-some-state pic x value 'a'. 88 state-a value 'a'. 88 state-b value 'b'. ... procedure division. set state-a to true ... if state-b ... end-if (Man, the editor for MF Community is terrible . Could we please get an editor that has decent support for code blocks?) You set the parent item of the level-88 to a particular value by setting the corresponding level-88 item to true. You can test if the parent item has a particular value by testing the corresponding level-88. This is for native COBOL, by the way. Managed COBOL is much nicer - inline method invocation means you can invoke methods in the conditional phrase of the if statement, or refer to properties, etc. And methods can return boolean values, and properties can evaluate to boolean values.
↧