[an error occurred while processing this directive]
HP OpenVMS Systems Documentation |
HP COBOL
|
Previous | Contents | Index |
The FETCH CURRENT PART statement uses the RETAINING clause to keep the current SUPPLY record as current of PART_SUPPLY.
Continue testing, starting with the new FETCH statement.
dbq> FETCH CURRENT PART RETAINING PART_SUPPLY |
Figure 7-5 shows that executing FETCH CURRENT PART RETAINING PART_SUPPLY makes PART the current record type, while the RETAINING clause keeps SUPPLY current of PART_SUPPLY set. Retaining the current supply record as current of PART_SUPPLY means the next execution of FETCH NEXT WITHIN PART_SUPPLY uses the current SUPPLY record's currency to locate the next SUPPLY record. If you executed a FETCH CURRENT PART without the RETAINING clause, a FETCH NEXT WITHIN PART_SUPPLY would use PART's currency and FETCH the first SUPPLY record belonging to PART.
Figure 7-5 Split Screen After FETCH CURRENT PART RETAINING PART_SUPPLY
Now you can retest the MODIFY PART_STATUS.
dbq> MODIFY PART_STATUS PART_STATUS [CHARACTER(1)]= X dbq> |
The DBQ prompt indicates the MODIFY was successful.
With the logic error found and fixed, you can test to see if the next execution of the FETCH NEXT WITHIN PART_SUPPLY fetches the next SUPPLY record belonging to the first PART record.
dbq> FETCH NEXT WITHIN PART_SUPPLY |
The database keys displayed by the currency update messages in Figure 7-6 and Figure 7-7 are the same, thereby showing the A100-LOOP paragraph will fetch the next SUPPLY record owned by the first PART record.
Notice the data items also have the same value. Comparing data item contents instead of database key values is not a good practice because duplicate records may be allowed. For example, a PART may have two or more SUPPLY records containing the same data. Also, each SUPPLY record could point to a different owner in the VENDOR_SUPPLY set type.
Figure 7-6 Split Screen After FETCH NEXT WITHIN PART_SUPPLY
To show that the record is indeed the second SUPPLY record belonging to the first PART record, execute the following statement:
dbq> FETCH 2 WITHIN PART_SUPPLY |
Figure 7-7 Split Screen After FETCH 2 WITHIN PART_SUPPLY
Listings are different on OpenVMS Alpha and OpenVMS I64 systems than
they are on OpenVMS VAX systems. This section shows two listings on
Alpha and I64 and two on VAX.
7.3.1 Listings on Alpha and I64
This section shows two compiler listing examples for OpenVMS Alpha and OpenVMS I64.
PARTSS1 Program Map Listing (Alpha, I64)
PARTSS1-PROGRAM in Example 7-3 includes the Oracle CODASYL DBMS data-names of the PARTSS1 subschema. The complete subschema can be obtained from the Oracle CDD/Repository DICTIONARY utility, using the following commands (refer to the Oracle CDD/Repository documentation):
$ DICTIONARY OPERATOR CDO> SET OUTPUT filename.extension CDO> SHO GENERIC CDD$DATABASE/FULL database-name |
(The logical CDD$DEFAULT must have been previously defined.)
Example 7-3 PARTSS1-PROGRAM Compiler Listing (Alpha, I64) |
---|
PARTSS1-PROGRAM Source Listing 18-JUN-2004 08:20:37 HP COBOL V2.8 Page 1 0 Source Listing 18-JUN-2004 08:17:19 DEVICE:[COBOL.EXAMPLES]PARTSS1.COB;1 1 IDENTIFICATION DIVISION. 2 PROGRAM-ID. PARTSS1-PROGRAM. 3 4 DATA DIVISION. 5 SUB-SCHEMA SECTION. 6 DB PARTSS5 WITHIN PARTS FOR "DBM$IVP_OUTPUT:DBMPARTS". 7 8 PROCEDURE DIVISION. 9 END PROGRAM PARTSS1-PROGRAM. PARTSS1-PROGRAM Source Listing 18-JUN-2004 08:20:37 HP COBOL V2.8 Page 2 0 Program Section Summary 18-JUN-2004 08:17:19 DEVICE:[COBOL.EXAMPLES]PARTSS1.COB;1 PROGRAM SECTION INDEX Index Name Bytes Alignment Attributes ----- ---------------- ---------- --------- ------------------------------------------------------------- 11 DBM$UWA_B 576 OCTA 4 PIC OVR REL GBL SHR NOEXE RD WRT NOVEC 12 DBM$SSC_B 48 OCTA 4 PIC CON REL GBL NOSHR NOEXE RD NOWRT NOVEC DIAGNOSTICS SUMMARY Informationals 1 (suppressed) ---------------------- Total 1 PARTSS1_PROGRAM\PARTSS1_PROGRAM Source Listing 18-JUN-2004 08:20:37 HP COBOL V2.8 Page 3 0 Data Names in Alphabetic Order 18-JUN-2004 08:17:19 DEVICE:[COBOL.EXAMPLES]PARTSS1.COB;1 Line Level Name Location Size Bytes Usage Category Subs Attribute ----- ----- ------------- ------------- ---------- ---------- -------- -------- ---- --------- 6 01 CATEGORY 11 000000C8 23 23 DISPLAY Group Glo 6 02 CLASS_CODE 11 000000C8 2 2 DISPLAY AN Glo 6 02 CLASS_DESC 11 000000CA 20 20 DISPLAY AN Glo 6 02 CLASS_STATUS 11 000000DE 1 1 DISPLAY AN Glo 6 02 COMP_MEASURE 11 000000F0 1 1 DISPLAY AN Glo 6 02 COMP_OWNER_PART 11 000000E8 8 8 DISPLAY AN Glo 6 02 COMP_QUANTITY 11 000000F1 5 3 COMP-3 N Glo 6 02 COMP_SUB_PART 11 000000E0 8 8 DISPLAY AN Glo 6 01 COMPONENT 11 000000E0 20 20 DISPLAY Group Glo 6 01 DB-CONDITION 11 0000003C 9 4 COMP N Glo 6 01 DB-CURRENT-RECORD-ID 11 00000000 4 2 COMP N Glo 6 01 DB-CURRENT-RECORD-NAME 11 00000019 31 31 DISPLAY AN Glo 6 01 DB-KEY 11 0000007A 18 8 COMP N Glo 6 01 DB-UWA 11 00000000 108 108 DISPLAY AN Glo 6 02 EMP_FIRST_NAME 11 0000010F 10 10 DISPLAY AN Glo 6 02 EMP_ID 11 000000F8 5 3 COMP-3 N Glo 6 02 EMP_LAST_NAME 11 000000FB 20 20 DISPLAY AN Glo 6 02 EMP_LOC 11 00000120 5 5 DISPLAY AN Glo 6 02 EMP_PHONE 11 00000119 7 7 DISPLAY AN Glo 6 01 EMPLOYEE 11 000000F8 45 45 DISPLAY Group Glo 6 02 GROUP_NAME 11 00000128 20 20 DISPLAY AN Glo 6 01 PART 11 00000140 71 71 DISPLAY Group Glo 6 02 PART_COST 11 00000180 9 5 COMP-3 N Glo 6 02 PART_DESC 11 00000148 50 50 DISPLAY AN Glo 6 02 PART_ID 11 00000140 8 8 DISPLAY AN Glo 6 02 PART_PRICE 11 0000017B 9 5 COMP-3 N Glo 6 02 PART_STATUS 11 0000017A 1 1 DISPLAY AN Glo 6 02 PART_SUPPORT 11 00000185 2 2 DISPLAY AN Glo 6 01 PR_QUOTE 11 00000188 26 26 DISPLAY Group Glo 6 02 QUOTE_DATE 11 0000018F 6 6 DISPLAY AN Glo 6 02 QUOTE_ID 11 00000188 7 7 DISPLAY AN Glo 6 02 QUOTE_MIN_ORDER 11 00000195 5 3 COMP-3 N Glo 6 02 QUOTE_QTY_PRICE 11 0000019D 9 5 COMP-3 N Glo 6 02 QUOTE_UNIT_PRIC 11 00000198 9 5 COMP-3 N Glo 6 02 SUP_LAG_TIME 11 000001AD 10 10 DISPLAY AN Glo 6 02 SUP_RATING 11 000001A8 1 1 DISPLAY AN Glo 6 02 SUP_TYPE 11 000001A9 4 4 DISPLAY AN Glo 6 01 SUPPLY 11 000001A8 15 15 DISPLAY Group Glo 6 02 VEND_ADDRESS 11 00000206 15 15 DISPLAY AN 1 Glo 6 02 VEND_CONTACT 11 000001E8 30 30 DISPLAY AN Glo 6 02 VEND_ID 11 000001B8 8 8 DISPLAY AN Glo 6 02 VEND_NAME 11 000001C0 40 40 DISPLAY AN Glo 6 02 VEND_PHONE 11 00000233 10 10 DISPLAY AN Glo 6 01 VENDOR 11 000001B8 133 133 DISPLAY Group Glo 6 01 WK_GROUP 11 00000128 20 20 DISPLAY Group Glo PARTSS1_PROGRAM\PARTSS1_PROGRAM Source Listing 18-JUN-2004 08:20:37 HP COBOL Page 4 0 Procedure Names in Alpha Order 18-JUN-2004 08:17:19 DEVICE:[COBOL.EXAMPLES]PARTSS1.COB;1 Line Name Location Type ----- ------------------------------- ------------- ----------------------------------------------------- 2 PARTSS1-PROGRAM ** Program PARTSS1_PROGRAM\PARTSS1_PROGRAM Source Listing 18-JUN-2004 08:20:37 HP COBOL V2.8 Page 5 0 Compilation Summary 18-JUN-2004 08:17:19 DEVICE:[COBOL.EXAMPLES]PARTSS1.COB;1 COMMAND QUALIFIERS COBOL /NOALIGNMENT /GRANULARITY = QUAD /NOANALYSIS_DATA /NOINCLUDE /NOANSI_FORMAT /LIST /ARCHITECTURE = GENERIC /NOMACHINE_CODE /ARITHMETIC = NATIVE /MAP = ALPHABETICAL /NOAUDIT /MATH_INTERMEDIATE = FLOAT /CHECK = (NOPERFORM, NOBOUNDS, NODECIMAL, NODUPLICATE_KEYS) /NATIONALITY = US /NOCONDITIONALS /NOOBJECT /NOCONVERT = LEADING_BLANKS /OPTIMIZE = (LEVEL=4,TUNE=GENERIC) /NOCOPY_LIST /RESERVED_WORDS = (XOPEN, NOFOREIGN_EXTENSIONS, NO200X) /NOCROSS_REFERENCE /NOSEPARATE_COMPILATION /DEBUG = (NOSYMBOLS, TRACEBACK) /NOSEQUENCE_CHECK /NODEPENDENCY_DATA /STANDARD = (NOXOPEN, NOSYNTAX, NOV3, 85, NOMIA) /NODIAGNOSTICS /NOTIE /NODISPLAY_FORMATTED /NOTRUNCATE /NOFIPS /VFC /NOFLAGGER /WARNINGS = (NOINFORMATION, OTHER) /FLOAT = D_FLOAT COMPILATION STATISTICS CPU time: 1.59 seconds Elapsed time: 7.59 seconds Pagefaults: 1014 I/O Count: 343 Source lines: 9 339 lines per CPU minute. |
Previous | Next | Contents | Index |