Appendix E. Example of a COBOL Formatted Dump
Figure 1 shows an example of a COBOL formatted dump. A dump is usually available if something goes wrong when you try to run your program.
Defining a data item in the Data Division as a user-defined data type does not change how the data is represented in a dump. Data items defined using the TYPE clause behave exactly as if they had been defined without using the TYPE clause.
You can request two types of dumps, a data dump and an extended dump. The example in Figure 1 is an extended dump.
The data dump contains the
following information. The labels identify where on the formatted
dump you will find the information.
- A
- The name of each variable
- B
- The data type
- C
- The value
- D
- The hexadecimal value
Note: Only the first 250 characters will be shown
in the dump.
The extended dump also
contains the following additional information. The labels identify
where on the formatted dump you will find the information.
- E
- The name of each file
- F
- The system name of each file
- G
- External/internal flag
- H
- Last I/O operation attempted
- I
- Last file status
- J
- Last extended status
- K
- Open/close status
- L
- Blocking information
- M
- Blocking factor
- N
- I/O feedback area information
- O
- Open feedback area information
- P
- Offset in bytes of the array element
If you do not want a user to be able to see the values
of your program's variables in a formatted dump, do one of the following:
- Ensure that debug data is not present in the program by removing observability.
- Give the user sufficient authority to run the program, but not to perform the formatted dump. This can be done by giving *OBJOPR plus *EXECUTE authority.
5722WDS V5R4M0 060210 LN IBM ILE COBOL CBLGUIDE/SAMPDUMP ISERIES1 06/02/15 15:10:06 Page 2
S o u r c e
STMT PL SEQNBR -A 1 B..+....2....+....3....+....4....+....5....+....6....+....7..IDENTFCN S COPYNAME CHG DATE
1 000100 IDENTIFICATION DIVISION.
2 000200 PROGRAM-ID. SAMPDUMP.
000300
3 000400 ENVIRONMENT DIVISION.
4 000500 CONFIGURATION SECTION.
5 000600 SOURCE-COMPUTER. IBM-ISERIES.
6 000700 OBJECT-COMPUTER. IBM-ISERIES.
7 000800 INPUT-OUTPUT SECTION.
8 000900 FILE-CONTROL.
9 001000 SELECT FILE-1 ASSIGN TO DISK-DBSRC.
11 001100 DATA DIVISION.
12 001200 FILE SECTION.
13 001300 FD FILE-1.
14 001400 01 RECORD-1.
15 001500 05 R-TYPE PIC X(1).
16 001600 05 R-AREA-CODE PIC 9(2).
17 001700 88 R-NORTH-EAST VALUES 15 THROUGH 30.
18 001800 05 R-SALES-CAT-1 PIC S9(5)V9(2) COMP-3.
19 001900 05 R-SALES-CAT-2 PIC S9(5)V9(2) COMP-3.
20 002000 05 FILLER PIC X(1).
002100
21 002200 WORKING-STORAGE SECTION.
22 002300 01 W-SALES-VALUES.
23 002400 05 W-CAT-1 PIC S9(8)V9(2).
24 002500 05 W-CAT-2 PIC S9(8)V9(2).
25 002600 05 W-TOTAL PIC S9(8)V9(2).
24 002500 01 ALPHACODE.
25 002600 05 STORECODE PIC XX OCCURS 20 TIMES indexed by PMIND.
002700
26 002800 01 W-EDIT-VALUES.
27 002900 05 FILLER PIC X(8) VALUE "TOTALS: ".
28 003000 05 W-EDIT-1 PIC Z(7)9.9(2)-.
29 003100 05 FILLER PIC X(3) VALUE SPACES.
30 003200 05 W-EDIT-2 PIC Z(7)9.9(2)-.
31 003300 05 FILLER PIC X(3) VALUE SPACES.
32 003400 05 W-EDIT-TOTAL PIC Z(7)9.9(2)-.
003500
33 003600 01 END-FLAG PIC X(1) VALUE SPACE.
34 003700 88 END-OF-INPUT VALUE "Y".
003800
35 003900 PROCEDURE DIVISION.
004000 MAIN-PROGRAM SECTION.
004100 MAINLINE.
004200****************************************************************
004300* OPEN THE INPUT FILE AND CLEAR TOTALS. *
004400****************************************************************
36 004500 OPEN INPUT FILE-1.
37 004600 MOVE ZEROS TO W-SALES-VALUES.
004700
004800****************************************************************
004900* READ THE INPUT FILE PROCESSING ONLY THOSE RECORDS FOR THE *
005000* NORTH EAST AREA. WHEN END-OF-INPUT REACHED, SET THE FLAG *
005100****************************************************************
38 005200 PERFORM UNTIL END-OF-INPUT
39 005300 READ FILE-1
40 005400 AT END SET END-OF-INPUT TO TRUE
005500 END-READ
41 005600 IF R-NORTH-EAST AND NOT END-OF-INPUT THEN
42 005700 ADD R-SALES-CAT-1 TO W-CAT-1, W-TOTAL
43 005800 ADD R-SALES-CAT-2 TO W-CAT-2, W-TOTAL
005900 END-IF
006000 END-PERFORM.
44 006100 SET PMIND to 5.
45 006200 MOVE 'Z1' TO STORECODE(PMIND).
006100
006200****************************************************************
006300* DISPLAY THE RESULTS AND END THE PROGRAM. *
006400****************************************************************
44 006500 MOVE W-CAT-1 TO W-EDIT-1.
45 006600 MOVE W-CAT-2 TO W-EDIT-2.
46 006700 MOVE W-TOTAL TO W-EDIT-TOTAL.
47 006800 DISPLAY W-EDIT-VALUES.
48 006900 STOP RUN.
* * * * * E N D O F S O U R C E * * * * *
LNR7200 exception in module 'SAMPDUMP ', program 'SAMPDUMP ' in library 'TESTLIB ' at statement number 42.
Formatted data dump for module 'SAMPDUMP ', program 'SAMPDUMP ' in library 'TESTLIB '.
NAME ATTRIBUTE VALUE
DB-FORMAT-NAME A
CHAR(10) B "DBSRC " C
"C4C2E2D9C34040404040"X D
END-FLAG
CHAR(1) " "
"40"X
PMIND
IX(4) 5
"00000008"X P
R-AREA-CODE OF RECORD-1 OF FILE-1
ZONED(2 0) 0.
"0000"X
R-SALES-CAT-1 OF RECORD-1 OF FILE-1
PACKED(7 2) 00000.00
"00000000"X
R-SALES-CAT-2 OF RECORD-1 OF FILE-1
PACKED(7 2) 0000Û.7²
"0000B7A0"X
RETURN-CODE
BIN(2) 0000.
"0000"X
STORECODE OF ALPHACODE
DIM(1) (1 20)
STORECODE OF ALPHACODE
CHAR(2)
(1) " "
"4040"X
... ...
(5) "Z1"
"E9F1"X
(6) " "
"4040"X
... ...
W-CAT-1 OF W-SALES-VALUES
ZONED(10 2) 00311111.08
"F0F0F3F1F1F1F1F1F0F8"X
W-CAT-2 OF W-SALES-VALUES
ZONED(10 2) 00622222.16
"F0F0F6F2F2F2F2F2F1F6"X
W-EDIT-TOTAL OF W-EDIT-VALUES
CHAR(12) " "
"404040404040404040404040"X
W-EDIT-1 OF W-EDIT-VALUES
CHAR(12) " "
"404040404040404040404040"X
W-EDIT-2 OF W-EDIT-VALUES
CHAR(12) " "
"404040404040404040404040"X
W-TOTAL OF W-SALES-VALUES
ZONED(10 2) 00933333.24
"F0F0F9F3F3F3F3F3F2F4"X
E F
Current active file: FILE-1 (DISK-DBSRC).
Information pertaining to file FILE-1 (DISK-DBSRC).
File is internal. G
Last I-O operation attempted for file: READ. H
Last file status: '00'. I
Last extended file status: ' '. J
File is open. K
Blocking is in effect. L
Blocking factor: 17. M
I-O Feedback Area. N
Number of successful PUT operations: 0.
Number of successful GET operations: 1.
Number of successful PUTGET operations: 0.
Number of other successful operations: 0.
Current data management operation: 1.
Record format: 'DBSRC '.
Device class and type: ' '.
Program device name: ' '.
Length of last record: 228.
Number of records for blocked PUT or GET: 17.
Length of all data returned: 0.
Number of blocks successfully read or written: 0.
Offset: '090'. Value: '00000000000000000001000004800004'.
Offset: '0A0'. Value: '00000000000000000001000000110000'.
Offset: '0B0'. Value: '0000'.
Open Feedback Area. O
Actual file name: 'DBSRC '.
Actual library name: 'TESTLIB '.
Member name: 'SALES '.
File type: 21.
Open file count: 1.
Max record length: 0.
CCSID: 65535.
Offset: '000'. Value: 'C4C2C4C2E2D9C34040404040D9D4C9E2'.
Offset: '010'. Value: 'E3D9E840404000000000000000000000'.
Offset: '020'. Value: '00000000000000000000000000E40000'.
Offset: '030'. Value: 'E2C1D3C5E24040404040FFFFFFE00000'.
Offset: '040'. Value: '000000150000000000000000000011C1'.
Offset: '050'. Value: 'D900D5A5000000000000500000000000'.
Offset: '060'. Value: '0000000000000000000011000000EF00'.
Offset: '070'. Value: '0003E000000000000000000000000001'.
Offset: '080'. Value: '000000010200730000FFFF0000000000'.
Offset: '090'. Value: '00010001C4C1E3C1C2C1E2C540400000'.
Offset: '0A0'. Value: '00000000000000000302000E00450045'.
Offset: '0B0'. Value: '0045004500450045006F004500450045'.
Offset: '0C0'. Value: '00450BFD068E0045000D001100000001'.
Offset: '0D0'. Value: '00000000000000000000000000000000'.
Offset: '0E0'. Value: '00000000000000000000000000000000'.
Offset: '0F0'. Value: '00000000000000000000000000000000'.
Offset: '100'. Value: '00000000000000000000000000000000'.
Offset: '110'. Value: '000000000000'.