Restriction: This topic applies only when the AppMaster Builder AddPack has been installed, and applies only to Windows platforms.
For SQL targets, you can use special D2 (data view) flags to suppress or modify DCLGEN copybook generation. After you generate your data view, insert these D2 statements into the generated DDISYMB file.
- Syntax: for Flag 1, suppress inclusion of the AMB-generated DCLGEN copybook
-
&D2-INCLUDED-COPYLIB-copybookname = "YES"|"NO"
- Syntax: for Flag 2, specify user override of AMB indicator structure generation
-
&D2-INCLUDED-IV-copybookname = "YES"|"NO"
- Syntax: for Flag 3, specify indicator variable prefix override, overriding the AMB default prefix IND
-
&D2-copybookname-IV-PREFIX = "prefixvalue"
- Syntax: for Flag 4, specify indicator structure, group-level, override name
-
&D2-copybookname-IV-01-NAME =
"indicatorvariablename"
- Syntax: for Flag 5, specify host structure, group-level override name
-
&D2-copybookname-HOST-01-NAME = "01levelname"
- Syntax: for Flag 6, generate a value for &D2-copybookname-HOST-01-NAME
-
&D2-GLOBAL-DCLGEN-NAME = "YES"|"NO"
- Syntax: for Flag 7, override use and generation of the default IND-cursorname structure
-
&D2-USE-CURSOR-IND = "YES"|"NO"
- General Rules: for Flag 1
-
- Include your own DB2 host variable copybook.
- Suppress inclusion of the corresponding AMB-generated DCLGEN copybook named by
copybookname.
- General Rules: for Flag 2
-
- Include your own indicator variable structure in the copybook or DB2 DDI symbols for that table.
- Suppress generation of the AMB host indicator variable structure for the table named by
copybookname.
- You can override the host indicator variable structure generated by AMB with one of your own, but you still must conform to the format above. The AMB-generated host indicator variable structure has the format:
01 IND-copybookname-REC
05 IND-colname1
05 IND-colname2
You can specify one prefix for each host indicator variable structure. The prefix you create must be supplied to AMB via the variable &D2-copybookname-IV-prefix.
- You can override the 01-level name of the host indicator variable structure. If the 01-level name you choose is not in the AMB format shown above, supply it to AMB via the variable &D2-copybookname-IV-01-name. These two user flags are described below.
- General Rules: for Flag 3
-
- Code it to substitute a value for the default prefix, IND, on all indicator variables for a table.
- Include this flag to supply your own indicator variable structure and if the variable names have a prefix other than IND.
- The prefix you enter can include up to 11 characters.
- Follow the naming convention of
prefix-columname for indicator variable names, where
prefix is either IND or a value you specify in the prefix override. For example, for a table represented by a copybook named TAB2, the entry:
% &D2-TAB2-IV-PREFIX = "TAB2-IV"
Yields the following indicator variable structure:
01 TAB2-IV-TAB2-REC.
05 TAB2-IV-colname1
05 TAB2-IV-colname2
05 TAB2-IV-colname3
.
.
.
05 TAB2-IV-colnameN
- If you do not supply this variable, the AMB uses the structure generated for each cursor:
cursorname-IND-variable
for cursor processing.
- General Rules: for Flag 4
-
- Code it to create your own 01-level name for the indicator variable structure.
Indicatorvariablename replaces the AMB-generated 01-level name. The default for the 01-level name is
prefixcolumnamerec.
- Include this flag to supply an override indicator variable structure when the 01-level name does not conform to the AMB naming convention.
- The maximum length of
indicatorvariablename is 30 characters.
- Indicator variable names must follow the naming convention of
prefix-columname, in which
prefix is either IND or a value you specify in &D2-copybookname-IV-PREFIX. For example, a table represented by a copybook named TAB2, the entry:
% &D2-TAB2-IV-01-NAME = "TAB2-IND-VAR"
yields the following indicator variable structure.
01 TAB2-IND-VAR.
05 IND-colname1
05 IND-colname2
05 IND-colname3
.
.
.
05 IND-colnameN
- If you do not supply this variable, the AMB uses the structure generated for each cursor:
cursorname-IND-variable
for cursor processing.
- General Rules: for Flag 5
-
- Code this to change the default host structure after the DCLGEN process creates it.
01levelname replaces the AMB-generated 01-level name,
copybooknamerec. AMB uses your host 01-level name when it qualifies host variables during SQL generation.
- General Rules: for Flag 6
-
- Use this flag, rather than Flag 5, to generate a name for all your tables. In the AMB CNTL file APDB2IN, set the flag &D2-GLOBAL-DCLGEN-NAME to yes. AMB generates a value for &D2-copybookname-HOST-01-NAME, using the IBM DCLGEN convention of
DCLtablename. Defining this flag in APDB2IN overrides manually-coded definitions in all applications.
- General Rules: for Flag 7
-
- Use this flag to override the default indicator variable structure, IND-cursorname with the structure IND-tablerec. AMB generates the default indicator variable structure:
01 TABLE-REC.
05 COL1 PIC X(4).
05 COL2 PIC X(8).
01 IND-TABLE-REC.
05 IND-COL1 PIC S9(4) COMP.
01 IND-CURSOR1.
05 IND-COL1 PIC S9(4) COMP.
.
.
.
DB-FETCH CURSOR CURSOR1
IF OK-ON-REC
IF IND-COL1 OF IND-CURSOR1 = +0
MAP-COL1 = COL1 in TABLE-REC
- When you code YES for this flag, AMB generates the default indicator variable structure, as follows:
01 TABLE-REC.
05 COL1 PIC X(4).
05 COL2 PIC X(8).
01 IND-TABLE-REC.
05 IND-COL1 PIC S9(4) COMP.
01 IND-CURSOR1.
05 IND-COL1 PIC S9(4) COMP.
.
.
.
DB-FETCH CURSOR CURSOR1
IF OK-ON-REC
IF IND-COL1 OF IND-CURSOR1 = +0
MAP-COL1 = COL1 in TABLE-REC
- When you code NO for this flag to override the indicator variable structure, the IND-cursor1 field is not created. AMB generates this indicator variable structure:
01 TABLE-REC.
05 COL1 PIC X(4).
05 COL2 PIC X(8).
01 IND-TABLE-REC.
05 IND-COL1 PIC S9(4) COMP.
- Using the host indicator variable structure can simplify your code because the one indicator variable structure can be used repeatedly. In nested processes, however, the host indicator variables are overwritten by each successive nesting level.
- Examples:
-
Substitute the prefix TAB2-IV for the default prefix IND for all indicator variables in a table represented by
copybookname and for the 01-level name.
% &D2-copybookname-IV-PREFIX = "TAB2-IV"
Substitute a different 01-level name in the indicator variable structure generated by AMB.
% &D2-copybookname-IV-01-NAME = "USER-IND-VAR-
NAME"
Sample source code:
% &D2-D2MASTER-HOST-01-NAME = "XYZ-D2MASTER-STRUCT"
****************************************************
* COBOL DECLARATION FOR TABLE D2MASTER
* 01-LEVEL NAME POST-PROCESSED
****************************************************
01 XYZ-D2MASTER-STRUCT.
10 PM-PART-NO PIC X(8).
10 PM-NEW-PART-NO PIC X(8).
10 PM-OLD-PART-NO PIC X(8).
10 PM-PART-SHORT-DESC PIC X(13).
10 PM-UNITS PIC 9(5).
10 PM-UNIT-BASE-PRICE PIC 9(5).
10 PM-DIMENSIONS PIC X(8).
10 PM-COLOR PIC X(8).
Generated SQL code using &D2-D2MASTER-HOST-01-NAME:
EXEC SQL SELECT ...
INTO XYZ-D2MASTER-STRUCT.PM-PART-NO,
XYZ-D2MASTER-STRUCT.PM-NEW-PART-NO,
.
.
.
XYZ-D2MASTER-STRUCT.PM-COLOR,
FROM ...
WHERE ...
END-EXEC
Generated SQL code without using &D2-D2MASTER-HOST-01-NAME:
EXEC SQL SELECT ...
INTO D2TAB-REC.PM-PART-NO,
D2TAB-REC.PM-NEW-PART-NO,
.
.
.
D2TAB-REC.PM-COLOR,
FROM ...
WHERE ...
END-EXEC