It is not always clear how to calculate offsets within a COBOL program for use with the CA IDMS Online Debugger. This document walks through the steps necessary to calculate the offsets as well as the overall procedure involved.
To display data element contents in a Debugger session of a COBOL Program, two pieces of information are needed from the program's compile listing (be sure to specify the LIST and MAP compiler options). They are the TGT (Task Global Table) Map and the DATA map. The TGT map indicates a base offset to each area of the program's storage (WS plus Linkage Sections). These offsets actually point to a chain of BLL addresses, beginning with 0. The Data Map indicates unique assignments for each data element, in the form of BLL plus an offset.
The IDMS Inline Debugger can be used in any online IDMS environment, DC or UCF, on any operating system.
To display a piece of storage in a COBOL program using the CA IDMS online debugger, there are two distinct processes necessary. The first one will show us the run-time addresses for the BLL chains; we take a part of the information we get in that display, and use it in subsequent steps to display the actual data item. Here's how it works.
In the online debugger, REG 9 will always hold the address of the TGT for a COBOL/LE program (For COBOL/II programs, R13 will hold the TGT address).
- In the program's output listing (produced with the LIST and MAP compiler options as noted above), find the offset within the TGT of the program's storage. To do this, browse the program compile output and issue a F 'Variable Portion of TGT'. Within that listing, find the BASE LOCATORS FOR WORKING-STORAGE or BASE LOCATORS FOR LINKAGE-SECTION (depending on where your data field is located). Note that offset within the TGT; you will use that in the next step. For purposes of demonstration, let's assume we want to display the contents of a field called EL-OFFC-0213 which is a field is in the linkage section of the program's storage; and that the output shows the linkage storage beginning at offset 000134.
- The other piece of information we will need from the program listing is from the data map. In the Data Map, find the element in question. Note the BLL cell and offset for that data item. Continuing with our example, let's assume the field EL-OFFC-0213 appears in the data map as mapped at hex displacement 980 in base locator BLL=00004.
- You'll need both of the above pieces of information before beginning your Debug session. Once you've initiated the online debugger session, the next step is to display this portion of the program's TGT storage at run-time, so we can see the actual values that are used for the base locators. To do this, you issue LIST %:R9 + X'NNN1' where 'NNN1' is the offset we found in step 1 above. This will show you the BLL Chain, beginning with 0, for that part of the program's storage. Each BLL address will take up a full-word (4 bytes); i.e. BLL 1 begins at this address plus 4. Since our example points to BLL=0004, we'd be looking at this address plus x'10'. Note this address; we'll use it in subsequent steps. In our example, let's assume it has an address of.
- Add the address from step 3 and the offset from step 2 of the particular data item from the program's data map. This will give you the actual address of the data item in question. In our example, we'd add the address from step 3 + x'980'; remember this is hex arithmetic.
- To display the contents of this data item, use the syntax
where aaaaaa is the address from step #4 above. If you want to avoid the hex arithmetic, as an alternative you can use the syntax
LIST @aaaaaa + @nnn
where aaaaa is the hex BLL address from step 3, and nnn is the hex offset of the data item as listed in the program's data map.
For some clients, the sysgen settings may cause the Online Debug session to 'time out' fairly quickly Because of this, it's important to find all of your memory location values before beginning the session. Otherwise you may not have time to find them during the session. If the session times out you will quickly start getting garbage answers; and when you end the session, it will display a D003 abend. This is not a problem; it just means the task timed out and you will need to begin a new task with all the required information available at the outset.
More details about using the Online Debugger, including specific syntax for all commands, can be found in the CA IDMS Online Debugger Guide.