CONNECTION BLOCK TYPE Declaration

Connection blocks are similar to structure blocks but provide a means of specifying procedures for export and import. From the CONNECTION BLOCK TYPE declaration you can declare a connection library.

<connection block type declaration>

──┬─<local connection block type declaration>──┬───────────────────────┤
  └─<global connection block type declaration>─┘

<local connection block type declaration>

── TYPE CONNECTION BLOCK ──<identifier>── ; ── BEGIN ──<declaration list>── END ─┤

<global connection block type declaration>

A global connection block can appear only in the global part of a program unit and cannot be nested. Global connection blocks enable the replacement binding of connection block procedures.

──┬─<forward global connection block type declaration>──┬──────────────┤
  └─<external global connection block type declaration>─┘

<forward global connection block type declaration>

── TYPE CONNECTION BLOCK ──<identifier>── ; ── FORWARD ────────────────┤

Connection blocks can be declared FORWARD within the global part of a subprogram. The global connection block then can be used for global connection library declarations within the global part. The global connection block must be fully specified before it is referenced. This syntax is used when the subprogram references a connection block item from outside the connection block.

<external global connection block type declaration>

── TYPE CONNECTION BLOCK ──<identifier>── ; ── EXTERNAL ───────────────┤

EXTERNAL connection block sets up the environment for connection block pending procedures in the subprogram to be bound to the host. Only those connection block items that are referenced by the pending procedures need to be specified in the subprogram connection block declaration. The local declarations of the connection block items in the host that are not referenced by the pending procedures do not need to be specified in the subprogram. This enables pending procedures in the subprogram to be bound without having to fully declare the entire connection block. EXTERNAL connection blocks cannot be bound. Connection libraries cannot be derived from EXTERNAL connection blocks. EXTERNAL connection blocks must be declared at level 3.

All rules and restrictions that apply to the STRUCTURE BLOCK TYPE declaration also apply to the CONNECTION BLOCK TYPE declaration.

Connection blocks can be declared within connection or structure blocks, but a connection library cannot be declared with the type of the inner connection block outside the outer connection or structure block.

<connection block type identifier>

An identifier that is associated with a connection block type in a CONNECTION BLOCK TYPE declaration.

Referencing Connection Block Items Outside the Connection Block

<connection block item designator>

──<connection block qualifier>──<connection block item>────────────────┤

<connection block qualifier>

  ┌◄─────────────────────────────────────────────────┐
──┴─┬─<connection library instance designator>─┬─ . ─┴─────────────────┤
    └─<connection block reference variable>────┘

<connection block item>

Any identifier that was declared inside a CONNECTION BLOCK TYPE declaration.

When items of a connection block are referenced outside the connection block, the connection block qualifier must be used to identify those items. The restrictions about what types of items can be referenced outside a structure block also apply to connection blocks.

A connection block procedure can be declared as NULL in an EXTERNAL connection block in a subprogram. The procedure serves as a placeholder for a procedure that is referenced by the pending procedure that is to be bound. A procedure in an EXTERNAL connection block can be declared only as PENDING, NULL, or IMPORTED.

For more information about structure block binding, refer to the Binder Programming Reference Manual.