Skip to main content

Occasionally the compiler doesn't like this piece of code.  I then recompile it and the error goes away.

method-id SetEmailPriority public

procedure division using by value mailPriority as type MailPriority = type MailPriority::Normal.

set self::EmailPriority to mailPriority.

end method.


#VisualCOBOL

Occasionally the compiler doesn't like this piece of code.  I then recompile it and the error goes away.

method-id SetEmailPriority public

procedure division using by value mailPriority as type MailPriority = type MailPriority::Normal.

set self::EmailPriority to mailPriority.

end method.


#VisualCOBOL

Sorry here is the message.

Error 48 COBCH0001 : Undefined error. Inform Technical Support


Occasionally the compiler doesn't like this piece of code.  I then recompile it and the error goes away.

method-id SetEmailPriority public

procedure division using by value mailPriority as type MailPriority = type MailPriority::Normal.

set self::EmailPriority to mailPriority.

end method.


#VisualCOBOL

There does seem to be a bug here, though so far I have not been able to reproduce the error as you describe.  I extended the example to this:

class-id a.

01 EmailPriority type MailPriority static.

method-id main static.

invoke SetEmailPriority

display EmailPriority

end method.

method-id SetEmailPriority public static.

procedure division using by value mailPriority as type MailPriority = type MailPriority::Normal.

set self::EmailPriority to mailPriority.

end method.

end class.

enum-id MailPriority.

78 Normal value 1.

end enum.

When I compile and run this, it displays a value of 0, rather than 'Normal' as expected.  It looks as if the compiler is not working correctly with default parameter values expressed as enum constants.