Changes in Release 4.0: Contexts

CONTEXTS - Declaring a Context

Syntax Diagram

Effect

Context c is declared to the program. You create and edit contexts in a special Context Builder. The CONTEXTS statement implicitly defines a data type CONTEXT_c. You can create CONTEXT instances in a DATA statement by using TYPE CONTEXT_c.

For each context field f, a data type CONTEXT_T_c-f is also defined. You can use this as a reference to create further fields.

Example

TABLES:   SBOOK, SPFLI, SCARR. 
CONTEXTS: DEMO_TRAVEL. 
DATA:	 MY_TRAVEL TYPE CONTEXT_DEMO_TRAVEL, 
 
		APFROM	TYPE CONTEXT_T_DEMO_TRAVEL-NAME_FROM, 
		APTO	TYPE CONTEXT_T_DEMO_TRAVEL-NAME_TO. 
* SBOOK = ... 
SUPPLY CARRID = SBOOK-CARRID 
	 CONNID = SBOOK-CONNID TO CONTEXT MY_TRAVEL. 
DEMAND 
	 DISTANCE   = SPFLI-DISTANCE 
	 NAME_FROM  = APFROM 
	 NAME_TO	= APTO 
	 CARRNAME   = SCARR-CARRNAME 
								 FROM CONTEXT MY_TRAVEL. 
* WRITE ...

Related

SUPPLY, DEMAND