Example: sample LangX COBOL program for debugging
The program below is used in various topics to demonstrate debugging tasks. It is an OS/VS COBOL program which is being used as a representative of LangX COBOL programs.
To run this sample program, do the following steps:
- Prepare the sample program as described in Preparing a LangX COBOL program.
- Verify that the debug information for this program is located in the COB03O and COB03AO members of the yourid.EQALANGX data set.
- Start z/OS® Debugger as described in Starting z/OS Debugger for programs that start outside of Language Environment.
- To load the debug information for this program, enter the following
command:
LDD (COB03O,COB03AO) ;
This program is a small example of an OS/VS COBOL program (COB03O) that calls another OS/VS COBOL program (COB03A0).
Load module: COB03O
COB03O
******************************************************
* PROGRAM NAME: COB03O *
* *
* COMPILED WITH IBM OS/VS COBOL COMPILER *
******************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. COB03O.
******************************************************************
* *
* LICENSED MATERIALS - PROPERTY OF IBM *
* *
* 5655-P14: Debug Tool *
* (C) Copyright IBM Corp. 2005 All Rights Reserved *
* *
* US GOVERNMENT USERS RESTRICTED RIGHTS - USE, DUPLICATION OR *
* DISCLOSURE RESTRICTED BY GSA ADP SCHEDULE CONTRACT WITH IBM *
* CORP. *
* *
* *
******************************************************************
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 LOAN PIC 999999.
01 INTEREST-RATE PIC 99V99.
01 INTEREST-DUE PIC 999999.
01 INTEREST-SAVE PIC 999999.
01 INTEREST-AFTER-MULTIPLY PIC 999999.
01 INTEREST-AFTER-DIVIDE PIC 999999.
* DATE THAT WILL RECEIVE INCREMENTED JULIAN-DATE
01 INC-DATE PIC 9(7).
* LOOP COUNT TO INCREMENT DATE 1000 TIMES *
01 LOOPCOUNT PIC 9999.
* JULIAN DATE
01 JULIAN-DATE PIC 9(7).
01 J-DATE REDEFINES JULIAN-DATE.
05 J-YEAR PIC 9(4).
05 J-DAY PIC 9(3).
* SAVE DATE
01 SAVE-DATE PIC 9(7).
PROCEDURE DIVISION.
PROG.
ACCEPT JULIAN-DATE FROM DAY
DISPLAY 'JULIAN DATE: ' JULIAN-DATE
MOVE JULIAN-DATE TO SAVE-DATE
MOVE 10000 TO LOAN
CALL 'COB03AO' USING LOAN INTEREST-DUE.
DISPLAY 'LOAN: ' LOAN
DISPLAY 'INTEREST-DUE: ' INTEREST-DUE
STOP RUN.
COB03AO
******************************************************
* PROGRAM NAME: COB03AO *
* *
* COMPILED WITH IBM OS/VS COBOL COMPILER *
******************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. COB03AO.
******************************************************************
* *
* LICENSED MATERIALS - PROPERTY OF IBM *
* *
* 5655-P14: Debug Tool *
* (C) Copyright IBM Corp. 2005 All Rights Reserved *
* *
* US GOVERNMENT USERS RESTRICTED RIGHTS - USE, DUPLICATION OR *
* DISCLOSURE RESTRICTED BY GSA ADP SCHEDULE CONTRACT WITH IBM *
* CORP. *
* *
* *
******************************************************************
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 INTEREST-RATE PIC 99V99 VALUE 0.22.
LINKAGE SECTION.
01 USING-LIST.
02 LOANAMT PIC 999999.
02 INTEREST PIC 999999.
PROCEDURE DIVISION USING USING-LIST.
PROG.
COMPUTE INTEREST = LOANAMT * INTEREST-RATE.
DISPLAY 'INTEREST-RATE: ' INTEREST-RATE.
GOBACK.