The function Generate COBOL Copy Code generates a record buffer for use in COBOL programs based on a Predict file object.
In addition, an Adabas format buffer can also be generated if required for files of the following types:
Adabas file (file type A) with parameter Adabas SQL usage = N
Adabas userview (file type U)
This document covers the following topics:
The Generate COBOL Copy Code screen is
displayed with function code G and object code CO in a Predict main menu, or
with the command GENERATE COBOL
.
10:03:05 ***** P R E D I C T ***** 2007-05-31 Plan 0 - Generate COBOL Copy Code - File ID ...................* Save as member ............. Save in library .... COBLIB Overwrite option ........... Y (Y,N) Op. system member .. Punch / output ............* N List offsets ......* N List generated code ........ Y (Y,N) Adabas version ....* I7 Generate format buffer ....* N Field name prefix .. Check field name ..........* A Field name suffix .. Start level ................ 1 (0-40) Validate ........... - Level number increment ..... 1 (1-40) Truncation ........* R Level shift increment ...... 3 (0-9) With Cond. names ... N (Y,N) Nr. of abstract lines ...... 3 (0-16) Indexed by ........* N Generate initial value ....* N Literal delimiter .* S Synchronized ..............* Y Decimal character .* P Depending on ............... N (Y,N) Redefinition name .* S Record buffer name ......... Format buffer name ......... Command ===> Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12--- Help Next Stop Last LnkEl Flip Print Impl AdmFi SelFi Prof Main |
Values for fields which have been locked by your data dictionary administrator cannot be overwritten. These fields are skipped when positioning the cursor with the TAB key. See Generation Defaults.
Presettings | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The parameters below can be changed in the Modify COBOL Defaults screen. See Generation Defaults. | ||||||||||||||||||
Library system | Library system for which the generated code is punched. Determines which additional cards need to be punched. An operating system member must be entered for the additional cards to be generated. See Parameters Specifying the Form of Output for more information. | |||||||||||||||||
Compiler |
|
|||||||||||||||||
Parameters | ||||||||||||||||||
The parameters Save as member, Save in library, Overwrite option, Op. system member, Punch/output, Workfile name and List generated code are described in the section Parameters Specifying the Form of Output. | ||||||||||||||||||
File ID | ID of the Predict file object from which the definitions are to be generated. Enter an asterisk to display a selection screen. Alternatively, use an asterisk as a wildcard. For example, enter A* to display IDs beginning with A only. | |||||||||||||||||
List offsets |
|
|||||||||||||||||
Adabas version | The version of Adabas for which the copy code is to be generated. Enter an asterisk for valid values or see table in the section Adabas Version for more information. | |||||||||||||||||
Generate format buffer |
|
|||||||||||||||||
Field name prefix | The prefix to be used for each field name generated. | |||||||||||||||||
Check field name |
|
|||||||||||||||||
Field name suffix | The suffix to be used for each field name generated. | |||||||||||||||||
Start level | The starting level number to be used for the generated statements. | |||||||||||||||||
Validate |
|
|||||||||||||||||
Level number increment | This parameter is evaluated with the parameter Start level. The level numbers of the generated statements are incremented as follows: | |||||||||||||||||
|
||||||||||||||||||
Truncation |
|
|||||||||||||||||
Level shift increment | The number of positions to be shifted right when a level higher than the current level number is found. | |||||||||||||||||
With Cond. names |
|
|||||||||||||||||
Nr. of abstract lines | The number of Predict abstract lines per field to be included in the generated code. | |||||||||||||||||
Indexed by |
|
|||||||||||||||||
Generate initial value |
|
|||||||||||||||||
|
||||||||||||||||||
|
||||||||||||||||||
Literal delimiter |
|
|||||||||||||||||
Synchronized |
|
|||||||||||||||||
Decimal character |
|
|||||||||||||||||
Depending on |
|
|||||||||||||||||
Redefinition name |
|
|||||||||||||||||
Record buffer name | Specifies the name of the record buffer in the generated structure. If omitted, the file ID is used. | |||||||||||||||||
Format buffer name | Specifies the name of the format buffer in the generated structure. If omitted, the file ID prefixed by FORMAT-BUFFER- is used. |
Command: GENERATE COBOL
Enter parameters on next line in positional or keyword form. File ID is obligatory, all other parameters are optional.
Field | Keyword | Position |
---|---|---|
File ID | FILE-ID | 1 |
Save as member | MEM | 2 |
Save in library | LIB | 3 |
Overwrite option | REPLACE | 4 |
Op. system member | OS-MEMBER | 5 |
Start level | START-LEVEL | 6 |
Field name prefix | PREFIX | 7 |
Level number increment | LEVEL-INCREMENT | 8 |
Field name suffix | SUFFIX | 9 |
Level shift increment | LEVEL-SHIFT | 10 |
Nr. of abstract lines | NR | 11 |
Validate | VALIDATION | 12 |
Generate initial value | INIT | 13 |
Truncation | TRUNCATION | 14 |
Generate format buffer | FORMAT-BUFFER | 15 |
List offsets | OFFSET | 16 |
List generated code | LIST | 17 |
Punch / output | PUNCH | 18 |
Record buffer name | RECORD-BUFFER-NAME | 19 |
Format buffer name | FORMAT-BUFFER-NAME | 20 |
With Cond. names | COND-NAME | 21 |
Synchronized | SYNC | 22 |
Indexed by | INDEXED | 23 |
Depending on | DEPENDING | 24 |
Adabas version | ADA-VER | 25 |
Check field name | CHECK-NAME | 26 |
Literal delimiter | DELIMITER | 27 |
Decimal character | DECIMAL-CHAR | 28 |
Redefinition name | REDEFINE-NAME | 29 |
Workfile name (see note below) | WORKFILE-NAME | 30 |
If Entire System Server is used | ||
- DB-ID | NP-DBID | 31 |
- Data set | NP-DSNAME | 32 |
- Volume | NP-VOLSER | 33 |
- Library | NP-LIB | 34 |
- Sublibrary | NP-SUBLIB | 35 |
- Member type | NP-MEMTYPE | 36 |
- VSAM catalog | NP-VSAMCAT | 37 |
If a parameter is not specified, the default value is taken.
Note:
You cannot specify a value other than blank (' ') for
WORKFILE-NAME on mainframes.
Parameters NP-LIB
,
NP-SUBLIB
and NP-MEMTYPE
must be
specified if the generated code is written to workfile 1 (Punch/output=Y) and
Library system=3.
The following rules apply to the generation of names for COBOL copy code.
Field names are derived from the name of the corresponding Predict field object if no COBOL field name synonym has been specified.
Alphabetic characters of field and file names are converted to upper-case. The parameters Field name prefix, Field name suffix, Validate and Truncate apply to the generation of field names (see description of parameters above).
In cases when supplementary fields have to be generated the names of these extra fields are derived from the Predict field names by generating prefixes and/or suffixes.
If a resulting field name, indexed by name or depending on name is not unique, an error message may be displayed if Check field name is either set to A or Y.
The rules applying when deriving the names of extra fields when generating COBOL copy code are described in the sections below.
When generating COBOL fields for Predict fields of type MC or PC, a counter field will automatically be generated in the copy code. The name of this field is derived from the name of the MC or PC field by adding the prefix C-.
When generating COBOL fields for a Predict field of type PE that contains a field of type MU and the parameter Gr.structur is set to N, a dummy field will automatically be generated preceding the MU field. The name of this field is derived from the name of the MU field by adding the prefix G-.
The MU field can then be used as a two-dimensional table and its real occurrence need not be computed.
When generating COBOL fields for a Predict field of type PE that contains a redefinition and the parameter Gr.structur is set to N, a dummy field will automatically be generated preceding the RE field. The name of this field is derived from the name of the RE field by adding the prefix R-.
When generating COBOL fields for a Predict logical field (field format L) with the parameter With cond. names set to Y and no condition name is defined for the field, a condition name is generated by adding the prefix N- to the field ID.
The record buffer name and the format buffer name are generated without prefix and suffix. The value(s) supplied must not contain invalid characters. If the file ID is taken as default record buffer name or, with the prefix FORMAT-BUFFER-, as default format buffer name, it is validated and, if necessary, truncated.
When COBOL copy code is generated with the option Indexed by set to Y, and no INDEXED BY NAME has been specified, this name is generated by adding the prefix I- to the Predict name.
An additional indicator field prefixed with S- is generated in the following cases:
a field is defined with Suppression option set to U (null allowed)
a field of a file of type A, U or B is defined with Suppression option set to R (not null)
For Adabas fields, the additional indicator field is only generated for the following Adabas versions:
I3 or above
U1 or above
V4 or above.
The GENERATE COBOL function is applied on a field HOURS_DAY. This field has the following attributes:
A field name synonym for COBOL is not defined.
The field type is MC.
The field occurs in a periodic group.
The parameter Gr.structur is set to N.
Three fields are generated in the COBOL copy code
C-HOURS_DAY G-HOURS_DAY HOURS_DAY
If the parameter Field name prefix had been set to Adabas, the parameter Field name suffix to *PERSONNELOFFICE, Validate to -, Truncation to R and Indexed by to Y when generating COBOL copy code from this field, the following COBOL field names are generated:
ADABAS-C-HOURS-DAY-PERSONNELOF indexed by ADABAS-I-C-HOURS-DAY-PERSONNEL ADABAS-G-HOURS-DAY-PERSONNELOF indexed by ADABAS-I-G-HOURS-DAY-PERSONNEL ADABAS-HOURS-DAY-PERSONNELOFFI indexed by ADABAS-I-HOURS-DAY-PERSONNELOF
Fields in the COBOL copy code have a COBOL clause determined by the following factors:
length and format of the corresponding Predict field object
file type of the file containing the field
the compiler for which you are generating.
File type A(SQL) in the table below represents files of type A with parameter Adabas SQL usage set ot Y.
Predict Format | Predict Length | File Type or Compiler | COBOL Clause | Note |
---|---|---|---|---|
B | l=1,3,5,6,7 | PIC X(l) | ||
I | 1 | File Type: JT, JV | PIC S9(2) COMP | |
other file types | PIC X(1) | |||
B/I | 2 |
File Type: BT, BV or |
PIC S9(4) BINARY | aligned on half word boundary (if word length=4) |
File Type: JT, JV or |
PIC S9(4) COMP | |||
4 |
File Type: BT, BV or |
PIC S9(9) BINARY | aligned on word boundary (if word length=4) | |
File Type: JT, JV or |
PIC S9(9) COMP | |||
8 | Compiler: WANG/VS | PIC X(8) | ||
other compiler | PIC S9(18) COMP | aligned on word boundary (if word length=4) | ||
B | l=>9 | PIC X(l) | ||
F | l=4,8 |
File Type: not BT, BV, JT, JV |
PIC X(l) | |
File Type: JT, JV | PIC S9(10)V9(8) COMP-3 | |||
4 |
File Type: BT, BV or |
COMP-1 | aligned on word boundary (if word length=4) | |
8 |
File Type: BT, BV or |
COMP-2 | aligned on double word boundary (if word length=4) | |
N/U |
nn.m |
PIC 9(nn)V9(m) | if m=0, V9(m) is not applicable | |
nn.m |
PIC X(nn+m) | |||
NS/US |
nn.m |
File Type: B, A(SQL), AT | PIC X(nn+m) | |
nn.m |
PIC S9(nn)V9(m) | if m=0, V9(m) is not applicable | ||
nn.m |
PIC X(nn+m) | |||
P |
nn.m |
Compiler: 74 | PIC 9(nn)V9(m)COMP-3 | if m=0, V9(m) is not applicable |
Compiler: 85 | PIC 9(nn)V9(m)PACKED DECIMAL | |||
Compiler: WANG | PIC 9(nn)V9(m)COMP | |||
nn.m |
PIC X(l) | l=(nn+m+2)/2 | ||
PS |
nn.m |
File Type: B, A(SQL) AT | PIC X(l) | l=(nn+m+2)/2 |
nn.m |
File Type: BT, BV or |
PIC S9(nn)V9(m) PACKED-DECIMAL | if m=0, V9(m) is not applicable | |
File Type: not BT, BV or |
PIC S9(nn)V9(m)COMP-3 | |||
File Type: not BT, BV or |
PIC S9(nn)V9(m)COMP | |||
nn.m |
PIC X(l) | l=(nn+m+2)/2 | ||
D | File Type: D, E, BT, BV | PIC X(10) | ||
File Type: XT, XV | see format I, length 4 | |||
other file types | see Format P, length 6 | |||
T | File Type: D, E, BT, BV | PIC X(8) | ||
other file types | see Format P, length 12 | |||
L | File Type: BT, BV | PIC S9(4) BINARY | ||
other file types | PIC X(1) | |||
BT | File Type: YT, YV | PIC X(1) | ||
DT | File Type: JT, JV | PIC X(25) | ||
File Type: OT, OV | PIC X(9) | |||
File Type: XT, XV | PIC X(23) | |||
File Type: YT, YV | PIC X(32) | |||
DS | File Type: YT, YV | PIC X(28) | ||
G |
n | File Type: D, E | PIC X(m) | m=2*n |
IV | 7 / 17 | File Type: XT, XV | PIC X (n) | |
S | File Type: XT, XV | see format I, length 4 | ||
TK | File Type: JT, JV | PIC X(8) | ||
TS | File Type: BT, BV, D, E | PIC X(26) | ||
File Type: YT, YV | PIC X(8) | |||
OK | File Type: JT, JV | PIC X(16) | ||
MO | File Type: JT, JV, YT, YV | see format F, length 8 | ||
n.m | File Type: XT, XV | PIC S9(n)V9(m) | ||
MS | File Type: YT, YV | see format F, length 4 |
A numeric or binary format field with a length not included in the table above is treated in COBOL copy code as an alphanumeric format field and cannot have an initial value generated for it. A warning message is issued.
File Type in Predict | Predict Format | Predict Char Set | Length | COBOL Clause | Note |
---|---|---|---|---|---|
YT, YV | A | S | n | PIC X(n) | |
B | n | PIC X(m) | m=2*n | ||
D | n | PIC X(m) | m=2*n | ||
AV | S | n |
Two-level group is generated:
02 Fieldname |
m=n | |
B, D | m=2*n | ||||
JT, JV | A, AV | any | n | PIC X(n) | |
AL | B | n | PIC X(n) | Field is skipped if no length is specified | |
BL | n | PIC X(n) | Field is skipped if no length is specified | ||
BV | n | PIC X(n) | |||
XT, XV, OT, OV, | A, AL | any | n | PIC X(n) | |
AV | there is only one Char Set | n |
Two-level group is generated:
02 Fieldname |
||
D, E | A, AL | any | n | PIC X(n) | |
AV | any | n |
Two-level group is generated:
02 Fieldname |
||
A, U | A | there is only one Char Set | n | PIC X(n) | |
AV | n |
Two-level group is generated:
02 Fieldname |
|||
A(SQL), AT, B | A, AV | there is only one Char Set | n | PIC X(n) | |
BT, BV | A | any | n | PIC X(n) | |
AL | any | n |
Two-level group is generated:
02 Fieldname |
Field is skipped if no length is specified | |
AV | any | n |
Two-level group is generated:
02 Fieldname |
An automatically generated counter field has the following clause, depending on the COBOL compiler used:
Compiler | Clause |
---|---|
COBOL 74, COBOL 85 | PIC S9(4) COMP |
WANG | PIC S9(4) BINARY |
If COBOL copy code for DB2 Tables/Views is generated, the format NS or US is converted to the following COBOL format depending on the COBOL compiler used:
Compiler | Clause |
---|---|
COBOL 74 | PIC S9(nn)V9(m) COMP-3 |
COBOL 85 | PIC S9(nn)V9(m) COMP |
WANG | PIC S9(nn)V9(m) PACKED-DECIMAL |
Any redefinitions that exist for this field are skipped.
A DB2 large object is generated as locator like an I4 field.
File ID .. GENERATION-EXAMPLE ***************************************************************** * THIS RECORD-BUFFER LAYOUT WAS GENERATED BY PREDICT * FOR FILE: GENERATION-EXAMPLE * ON: 2007-05-31 STARTING AT 13:27:53 * FILE-COMMENTS: Example file for the * PREDICT generation subsystem. * .. ***************************************************************** 01 GENERATION-EXAMPLE. 02 GROUP-1. 03 ELE-N-9V5 PIC 9(9)V9(5). 03 GR-IN-GROUP. 04 ELE-B-4 PIC S9(9) COMP SYNC. 88 INIT-ELE-B-4 VALUE IS 4096. 88 COND-ELE-B-4-V-1 VALUE IS -1. 04 ELE-PS-5V2 PIC S9(5)V9(2) COMP-3. 04 R-MU-B-4. 05 MU-B-4 OCCURS 5 TIMES PIC S9(9) COMP SYNC. 04 R-MU-B-4-REGR REDEFINES R-MU-B-4. 05 MU-RED-B-7 PIC X(7). * >>> DIC1818 WARNING: FORMAT(S) CHANGED ( ' B ' --> ' A ') 05 MU-RED-US-13 PIC S9(13). 04 R-MU-B-4-REGR1 REDEFINES R-MU-B-4. 05 MU-RED-B-8 PIC S9(18) COMP. 88 MU-RED-B-8-COND1 VALUE IS 1118481. 03 ELE-A-42 PIC X(42). 88 COND-NAME-START VALUE IS 'COND-START' THRU 'COND-ZEND'. 88 FILL-WITH-STRING VALUE IS ALL 'A'. 03 ELE-F-8 COMP-2 SYNC. 03 ELE-B-3 PIC X(3). File ID .. GENERATION-EXAMPLE * >>> DIC1818 WARNING: FORMAT(S) CHANGED ( ' B ' --> ' A ') 02 C-PC-OCC-7 PIC S9(4) COMP SYNC. 02 PC-OCC-7 OCCURS 7 TIMES. 03 PC-ELE-DE-NS-7V3 PIC S9(7)V9(3). 03 C-PC-MC-PS-6V1 PIC S9(4) COMP SYNC. 03 PC-MC-PS-6V1 OCCURS 11 TIMES PIC S9(6)V9(1) COMP-3. 03 PC-GR. 04 PC-ELE-I-2 PIC S9(4) COMP SYNC. 04 PC-PS-20V7 PIC X(14). * >>> DIC1818 WARNING: FORMAT(S) CHANGED ( ' PS ' --> ' A ') 03 PC-ELE-F-4 COMP-1 SYNC. 02 ELE-D PIC 9(6) COMP-3. 02 ELE-T PIC 9(12) COMP-3. 02 ELE-L PIC X(1). 88 N-ELE-L VALUE IS LOW-VALUE. ***************************************************************** * THIS FORMAT-BUFFER WAS GENERATED BY PREDICT * FOR FILE: GENERATION-EXAMPLE * ON: 2007-05-31 STARTING AT 13:27:53 ***************************************************************** 01 FORMAT-BUFFER-GENERATION-EXAMP. * >>> DIC1809 WARNING: FIELDNAME(S) TRUNCATED 02 FILLER PIC X(54) VALUE IS 'AB,2X,AD,AE,AF1-5,AG,2X,AH,AI,1X,ALC,2,AM1,AN1C,2,AN1('. 02 FILLER PIC X(54) VALUE IS '1-11),AO1,2X,AR1,2X,AM2,AN2C,2,AN2(1-11),AO2,2X,AR2,2X'. 02 FILLER PIC X(54) VALUE IS ',AM3,AN3C,2,AN3(1-11),AO3,2X,AR3,2X,AM4,AN4C,2,AN4(1-1'. 02 FILLER PIC X(54) VALUE IS '1),AO4,2X,AR4,2X,AM5,AN5C,2,AN5(1-11),AO5,2X,AR5,2X,AM'. 02 FILLER PIC X(54) VALUE IS '6,AN6C,2,AN6(1-11),AO6,2X,AR6,2X,AM7,AN7C,2,AN7(1-11),'. 02 FILLER PIC X(23) VALUE IS 'AO7,2X,AR7,2X,AS,AT,AU.'. * **************************************************************** DIC1800 SUMMARY: 25 FIELD(S) PROCESSED DIC1809 WARNING: 1 FIELDNAME(S) TRUNCATED DIC1818 WARNING: 3 FORMAT(S) CHANGED DIC1819 MESSAGE: 33 SLACK BYTE(S) GENERATED DIC1847 MESSAGE: 3 FIELD(S) SKIPPED FOR RECORDBUFFER STRUCTURE