Skip to content

Define structure support (TYPE, LIKE etc.) #392

@asatklichov

Description

@asatklichov
  • Currently DEFINE STRUCTURE has limited support, only definition is resolved.
    It should work with HANDLE()
DEFINE STRUCTURE                                                            
     01 SRV_CATALOG_EXE_ENTRY                                                  
       ,05 NXT_EXE_ENY_HL      HANDLE(SRV_CATALOG_EXE_ENTRY)                    
       ,05 DOM_ID              TYPE(SRV_DOMAIN)                                
       ,05 SRV_ID              TYPE(SRV_SERVICE)                                
       ,05 OPN_ID              TYPE(SRV_OPERATION)                              
       ,05 MAJ_VRS_ID          TYPE(SRV_MAJOR_VERSION)                          
       ,05 MNO_VRS_ID          TYPE(SRV_MAJOR_VERSION)                          
       ,05 ORI_ID              TYPE(SRV_ORIGIN)                                
       ,05 DLL_ID              CHAR(8)                                          
       ,05 FCT_ID              CHAR(64)                                        
       ,05 AVB_CHE_FL          CHAR(1)                                          
       ,05 FCT_PR              POINTER                                          
       ,05 DLL_PR              POINTER;  

DEFINE STRUCTURE, is just a definition, or type definition. Not declared yet. So, you can not use it unless declared as below.

1-way of declaration (via parathesis) using defined type:
DCL my_catalog_entry type(SRV_CATALOG_EXE_ENTRY);
2-way of declaration using defined type:
DCL my_catalog_entry type SRV_CATALOG_EXE_ENTRY;
Usage in code:
my_catalog_entry.dom_id = 'xyz';

  • Declaration with 'LIKE'
    e.g.
    DCL WRK_SAVED_EIB LIKE DFHEIBLK;
    DCL a char(10);
    DCL b like a;

or another example

Image

IN TWO DIFFERENT SPACES
T - TYPE NAMESPACE
T - IN VARIABLE NAMESPAVE

COMPILER WILL NOT COMPLAIN ..

  • Also declaration with SQL TYPE and its all alternatives should be resolved

See spec: https://www.ibm.com/docs/en/db2-for-zos/12.0.0?topic=pli-host-variable-arrays-in

Hint: just ignore the grammar from SQL TYPE .

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions