-
Notifications
You must be signed in to change notification settings - Fork 25
TypeCobolErrorSyntax
- TCERR_INTRINSIC_TYPE Error are represented with the intrinsic type ErrorCode. This type is defined like this:
01 ErrorCode TYPEDEF STRONG.
05 code pic X(04).
-
TCERR_IMPLICIT_ERRORCODE_VAR All functions, procedures and procedure division of a program can access an implicit variable always named "ErrorCode". This variable is declared with a private scope (not GLOBAL or EXTERNAL). This variable is for internal use and to call other functions/procedure/program. This variable can't be received as a parameter.
-
TCERR_IMPLICIT_ERRORCODE_PARAM All functions and procedures have a special parameter named ErrorCode. If another parameter is also named "ErrorCode", there must be an error. All call to a function or procedure must pass this ErroCode variable. After the call to a function or procedure, you can then use the syntax:
Call getCurrentDate returning xxx
If getCurrentDate::ErrorCode not = OK
error, by default call the paragraph used to manage error.
Else
Ok, continue
End-if
-
TCERR_IMPLICIT_PARAGRAPH An paragraph used to manage error must be present in all programs, functions and procedures. By default, this paragraph is implicit and is always named
TC-STANDARD-ERROR-MANAGEMENT
. If another paragraph have the same name, there must be an error. -
TCERR_OVERRIDE_IMPLICIT_PARAGRAPH The implicit paragraph used to manage error can be changed. The sentence
error procedure is *MY-PARAGRAPH*
must be declared in identification division TODO specify exactly where -
TCERR_ERROR_AFTER_FUNCTION When a function is called an there is an error, the paragraph used to manage error must be called.
-
TCERR_DECLARE_EXPECTED_ERRORS Function and procedure can declare ErrorCode that the caller should test. These are the errors the callee knows that will probably happen. Syntax to declare there ErrorCode is:
declare function MyFunction PUBLIC
input
returning
error ErrorCode::Code-NotFound ErrorCode::Code-DatabaseNotAvailable '7894'
end-declare
Error
keyword must be followed by either:
- ErrorCode::Code 88 level values
- Literal of length 4
Introduction
TypeCobol language
-
In a nutshell
-
TypeCobol concepts
TypeCobol Editor
(Type)Cobol parser API
TypeCobol architecture
- Glossary
- Main phases
- How to extend the grammar and semantic check (full example)
- File
- Text
- Code analysis steps
- Program class parser
- Type checker
- Error handler
- Grammars Composition
- Code generation
- Compilation process
(Type)Cobol concepts / reference doc
Contributing