-
Notifications
You must be signed in to change notification settings - Fork 25
FunctionsDeclaration
This pages describes how to:
-
declare functions
-
declare procedures
This page describes many rules regarding function or procedure declaration. All these rules begin with TCRFUN_.
Such rules are written with one of the following 2 formats:
-
✓ RULE NAME
Description of a rule which specification was validated. -
❏ RULE NAME
Description of a rule which specification was not yet validated. It can thus change in the future: the rule can be renamed, it can be formulated differently, or it can be simply deleted (being replaced by other rules or just cancelled).
CALL <procedure-name>
<INPUT clause>?
<INOUT clause>?
<OUTPUT clause>?
END-CALL?
INPUT < <SENDING MODE clause>? <parameter-name> >+
BY? <CONTENT | REFERENCE | VALUE>
INOUT <parameter-name>+
OUTPUT <parameter-name>+
-
✓ TCRFUN_CALL_PARAMETER_ORDER
During a procedure invocation, parameters are always used in the same order they are declared in the corresponding procedure:-
First, all
INPUT
parameters (if any) -
Second, all
INOUT
parameters (if any) -
Third, all
OUTPUT
parameters (if any)
-
-
✓ TCRFUN_CALL_INPUT_BY
INPUT
parameters can be passed by content, by reference or by value. This distinction is made for a given parameter using the SHARING MODE clause. If the SHARING MODE clause is omitted, the corresponding parameter is passed by reference. -
✓ TCRFUN_CALL_INOUT_AND_OUTPUT_BY_REFERENCE
INOUT
,OUTPUT
parameters are passed by reference. The SHARING MODE clause cannot be specified. In other words,BY REFERENCE
is always implied forINOUT
,OUTPUT
parameters. -
✓ TCRFUN_MATCH_PARAMETERS_NUMBER
The number of parameters provided on each procedure call must match the number of parameters of at least one declared procedure of the same name. -
✓ TCRFUN_MATCH_PARAMETERS_TYPE
The type of allINPUT
,INOUT
,OUTPUT
parameters provided on a given procedure call must match the type of all parameters of at least one declared procedure of the same name. -
❏ TCRFUN_MATCH_PARAMETERS_SIZE
The logical size (without any concern about comp-*) of allINPUT
,INOUT
,OUTPUT
parameters provided on a given procedure call must match the logical size of all parameters of at least one declared procedure of the same name. -
❏ TCRFUN_MATCH_PARAMETERS_COMPRESSION
The physical compression of allINPUT
,INOUT
parameters provided on a given procedure call must match the physical compression (same comp-* between caller and callee) of all parameters of at least one declared procedure of the same name. -
✓ TCRFUN_EMPTY_CALL
ACALL
statement that has none of theUSING
,INPUT
,INOUT
,OUTPUT
orRETURNING
clauses is recognized as:-
a procedure invocation if there is a procedure declared with no
INPUT
,INOUT
orOUTPUT
parameter visible in the current scope ; -
a function invocation if there is a function declared with no
INPUT
orRETURNING
parameter visible in the current scope ; -
a standard COBOL
CALL
statement if there is neither.
-
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