skip to main content

Procedure Division Statements : RAISE

RAISE
General Format
RAISE Exception-Class
Syntax Rules
1.
General Rules
1.
Examples
Raise an exception when passed string is too long. Uses a user defined Java Class StringTooLongException.
  configuration section.
  repository.
     class JString as "java.lang.String"
     class JStringTooLongException as "StringTooLongException".
  working-storage section.
  77 StrExc            object reference JStringTooLongException.
  77 exception-message pic x any length.
  77 j-exc-message     object reference JString.
  procedure division.
    move "The string you passed is longer than defined" to exception-message
    set j-exc-message to exception-message.
    set StrExc to JStringTooLongException:>new(j-exc-message).
    raise StrExc.
The Java Exception code is the following:
 * @version              1.0
 * @author               Veryant
public class StringTooLongException extends InvalidDataException {
 public StringTooLongException() {
 public StringTooLongException(String message) {
         super(message);

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left