----------  Declear Routine  ----------

The "declear routine" is NOT a command, it is used in "create module" command 
to declare what kinds of routine a module has.

For more information on create a module, enter:

          help module;

There  are  four kinds of routines: procedure, function, operator and 
aggregate function.

1) Procedure Syntax:

  [declare] procedure PROC_NAME

  ( [ [| in  |] [PARAM_NAME] DATATYPE {, [| in  |] [PARAM_NAME] DATATYPE} ] )
       | out |                            | out |
       |inout|                            |inout|

  [allocate workspace | INTERGER |]
                      | VARIABLE |

  external [begin expression BEGIN_EXPR_NAME]
           
           [name EXT_NAME] 
   
           [end expression END_EXPR_NAME]

  [ parameter style | general | ]
                    |   sql   |

  There are three kinds of parameter modes: "in", "out" and "inout" for 
  procedure, the default parameter mode is "in".    
      
  The default parameter style is "general".

2) Function Syntax:

  [declare] function FUNC_NAME

  ( [ [in] [PARAM_NAME] DATATYPE {, [in] [PARAM_NAME] DATATYPE} ] )

  returns DATATYPE 
  
  [allocate workspace | INTERGER |]
                      | VARIABLE |

  external [begin expression BEGIN_EXPR_NAME]
           
           [name EXT_NAME] 
   
           [end expression END_EXPR_NAME]

  [ parameter style | general | ]
                    |   sql   |
      
  The default parameter style is "general".

3) Operator Syntax:

  [declare] operator | prefix             | OPER_NAME
                     | postfix            |
                     | infix [PRECEDENCE] |
                     | comparison         |
                     | equality           |

  ( [ [in] [PARAM_NAME] DATATYPE {, [in] [PARAM_NAME] DATATYPE} ] )

  returns DATATYPE 
  
  [allocate workspace | INTERGER |]
                      | VARIABLE |

  external [begin expression BEGIN_EXPR_NAME]
   
           [name EXT_NAME] 
   
           [end expression END_EXPR_NAME]

  [ parameter style | general | ]
                    |   sql   |
      
  For boolean operator, the valid PRECEDENCE is 1, 2 (default). For arithmetic
  operator, the valid PRECEDENCE is 1, 2, 3, 4 (default), 5, 6 and "right".
  
  The default parameter style is "general".

4) Aggregate function Syntax:

  [declare] aggregate function AGGR_FUNC_NAME

  ( [in] [PARAM_NAME] DATATYPE {, [in] [PARAM_NAME] DATATYPE} )

  returns DATATYPE 
  
  [allocate workspace | INTERGER |]
                      | VARIABLE |

  external [begin expression BEGIN_EXPR_NAME]
           
           begin group BEGIN_GRP_NAME
   
           body BODY_NAME 
   
           end group END_GRP_NAME
   
           [end expression END_EXPR_NAME]

  [ parameter style | general | ]
                    |   sql   |
      
  The default parameter style is "general".

