Generating KSAMFILE Definitions [ HP SYSTEM DICTIONARY XL COBOL DEFINITION EXTRACTOR Reference Manual ] MPE/iX 5.0 Documentation
HP SYSTEM DICTIONARY XL COBOL DEFINITION EXTRACTOR Reference Manual
Generating KSAMFILE Definitions
If you specify KSAMFILE as entity name given in the GENERATE command,
then SDCDE generates a COBOL record definition for the KSAM file with the
given entity name.
If you set the SELECT-FILE parameter of the OPTIONS command to ON, SDCDE
issues prompts requesting the module name for the SELECT statement and
the FILE SECTION entry. These prompts have the following format:
Module name for KSAMFILE ksam-file-name's SELECT statement >
Module name for KSAMFILE ksam-file-name's FILE SECTION entry >
If you enter a [[RETURN]] for the SELECT statement prompt, SDCDE does not
generate any code for the SELECT statement. If you enter a [[RETURN]]
for the FILE SECTION prompt, SDCDE does not generate any code for the
FILE SECTION.
In all cases SDCDE issues a prompt requesting the copy library module
name to be assigned to the record layout generated for the KSAM file in
the WORKING-STORAGE SECTION:
Module name for KSAMFILE ksam-file-name's WORKING-STORAGE >
If you enter a [[RETURN]], SDCDE defines the record layout in the FILE
SECTION. If no FILE SECTION module is created, then SDCDE does not define
a record layout. If you specify a non-blank entry to this prompt, SDCDE
issues the following prompt:
Include KSAM FILETABLE parameter (N/Y) >
Enter a Y to generate the KSAM FILETABLE parameter for the current KSAM
file. Use this table structure when invoking intrinsics provided by KSAM
for COBOL.
If you specify the ELEM-QUALIFY parameter of the OPTIONS command, and you
define a record layout in either the FILE SECTION or the WORKING-STORAGE
SECTION, SDCDE responds with one of the following prompts, depending on
the value you specify:
Value Prompt
PREFIX Element prefix >
SUFFIX Element suffix >
NONE No prompt
SDCDE attaches the prefix or suffix characters to all of the elements
contained by the KSAM file. If you enter a [[RETURN]], SDCDE does not
attach a prefix or suffix.
When you complete the answers to the prompts, SDCDE generates the code
for the KSAM file definition. If any module name already exists in the
current copy library, the copy library's OPEN-MODE parameter determines
whether to append all generated code to the existing module or to replace
the existing module.
If you set the CONSTANTS parameter of the OPTIONS command to ON and the
WORKING-STORAGE SECTION is generated, the KSAMFILE name and lockword
constants are generated in the WORKING-STORAGE SECTION. The KSAMFILE name
constant value uses the standard-alias attribute value if one exists. If
the SECONDARY-REC option is OFF, only the primary record and those
records that explicitly redefine it through a RECORD redefines RECORD
relationship, have definitions generated using the REDEFINES clause. If
you set the SECONDARY-REC parameter of the OPTIONS command to ON, all
records explicitly redefining the primary record, as well as all
secondary records contained by the file, through a FILE contains RECORD
relationship, have definitions generated using the REDEFINES clause. If
you set the QUALIFY parameter of the OPTIONS command to ON, all record
names are prefixed by the KSAMFILE name.
SDCDE supports KSAMFILE handling for COBOL and COBOL II. If you use KSAM
support provided by COBOL II, only the SELECT statement and FILE SECTION
modules are needed. By entering a [[RETURN]] for the WORKING-STORAGE
SECTION module, the record layout is generated in the FILE SECTION. If
you use the intrinsics supplied by KSAM for use by COBOL, only the record
layout in the WORKING-STORAGE SECTION module is needed. No code should
be generated for the SELECT statement or the FILE SECTION.
The SELECT statement uses the primary-flag and unique attributes of the
KSAMFILE key ELEMENT relationship to generate the KEY clause. The ASSIGN
clause uses the primary record name from the KSAMFILE contains RECORD
relationship.
The FD statement uses the following attributes from the KSAMFILE entity:
blocking-min
blocking-max
blocking-units
min-record-size
max-record-size
record-format
Example 1
The following example generates a KSAM definition for COBOL II. In this
example, the KSAM file name is ORDERK, SELECT-FILE = ON, CONSTANTS = ON,
andELEM-QUALIFY = SUFFIX.
Module name for KSAMFILE ORDERK's SELECT Statement > ORDERKED
Module name for KSAMFILE ORDERK's FILE SECTION entry > ORDERKS
Module name for KSAMFILE ORDERK's WORKING-STORAGE > [[RETURN]]
Include KSAM FILETABLE parameter (Y/N) > N
Element Suffix > [[RETURN]]
Module name is ORDERKED
000100
000200 SELECT ORDERK
000300 ASSIGN "ORDERK"
000400 ORGANIZATION INDEXED
000500 RECORD ORDER-NO
000600 ALTERNATE RECORD CUST-ACCT DUPLICATES.
000700
Module name is ORDERKFS
000100
000200 FD ORDERK BLOCK 1 TO 5 RECORDS
000300 RECORDING MODE V
000400 RECORD 48 CHARACTERS.
000500
000600
000700 01 ORDERK-DATA.
000800 05 CUST-ACCT PIC X(10).
000900 05 CUST-NAME PIC X(25).
001000 05 ORDER-NO PIC X(12).
001100 05 ORDER-STATUS PIC X.
001200
001300
Example 2
The following example generates a KSAM definition for COBOL. In this
example, the KSAM file name is ORDERK, SELECT-FILE = ON, CONSTANTS = ON,
and ELEM-QUALIFY = SUFFIX.
Module name for KSAMFILE ORDERK's SELECT Statement > [[RETURN]]
Module name for KSAMFILE ORDERK's FILE SECTION entry > [[RETURN]]
Module name for KSAMFILE ORDERK's WORKING-STORAGE > ORDERKWS
Include KSAM FILETABLE parameter (Y/N) > Y
Element Suffix > [[RETURN]]
Module name is ORDERKWS
000100
000200 01 ORDERK-DATA.
000300 05 CUST-ACCT PIC X(10).
000400 05 CUST-NAME PIC X(25).
000500 05 ORDER-NO PIC X(12).
000600 05 ORDER-STATUS PIC X.
000700
000800 01 ORDERK-FILETAB.
000900 05 FILENUMBER PIC S9(4) COMP VALUE 0.
001000 05 FILENAME PIC X(8) VALUE "ORDERK ".
001100 05 I-O-TYPE PIC S9(4) COMP VALUE 0.
001200 05 A-MODE PIC S9(4) COMP VALUE 0.
001300 05 PREV-OP PIC S9(4) COMP VALUE 0.
001400
001500 01 KSAM-ORDERK PIC X(7) VALUE "ORDERK ".
001600 01 LWD-ORDERK PIC X(6) VALUE "SECRET".
001700
MPE/iX 5.0 Documentation