- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Debug single COBOL paragraph
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-01-2006 11:53 AM
тАО02-01-2006 11:53 AM
Debug single COBOL paragraph
I'm trying to determine if it is possible to execute a single arbitrary COBOL paragraph from within the debugger. The scenario I have in mind is:
(1) Start program under debugger control and get to main entry point.
(2) Deposit required values into variables.
(3) Execute the paragraph under test.
(4) Examine contents of variables to see what happened.
The attachment contains a simple test program and the results of some experiments. My initial conclusion is that this might not be a good idea... but I'd really like to be proved wrong!
Environment is:
Compaq COBOL V2.8-1286
OpenVMS V7.3-2
Alpha
cheers
andrew
- Tags:
- COBOL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-01-2006 04:07 PM
тАО02-01-2006 04:07 PM
Re: Debug single COBOL paragraph
And I think that between the first go to the program entry, and the first executable line (11), there are some setups, so you needs at least an step/line.
Check the .lis file from $cob /list/mach/debu/noopt.
Warning: not for the those that get dizy quickly.
I think you are stuck woth the classic:
1) set brea `label`
2) go
3) deposit...
4) go or step further
fwiw,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-01-2006 06:19 PM
тАО02-01-2006 06:19 PM
Re: Debug single COBOL paragraph
Maybe the break/return has disrupted the return mechanism, as it is a small program why don't you include a SET TRACE?
I would suggest adding spurious paragraphs between the 3 executable paragraphs like
TwoLevelsDown.
DISPLAY ">>>>>>>> Now in TwoLevelsDown."
PERFORM ThreeLevelsDown.
DISPLAY ">>>>>>>> Back in TwoLevelsDown.".
Limbo1.
DISPLAY "In limbo1 - where next".
OneLevelDown.
DISPLAY ">>>> Now in OneLevelDown"
PERFORM TwoLevelsDown
DISPLAY ">>>> Back in OneLevelDown".
Limbo2.
DISPLAY "In limbo2 - where next".
Make sure you compile with /noopt or it will remove unreferenced code.
On alphas I have always regarded the line numbers displayed by the debugger as an estimate.
Phil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-02-2006 06:57 AM
тАО02-02-2006 06:57 AM
Re: Debug single COBOL paragraph
sorry, no help from me on this one, but I noticed it is your first entry, so:
WELCOME to the VMS forum!
Proost.
Have one on me.
jpe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-02-2006 08:31 AM
тАО02-02-2006 08:31 AM
Re: Debug single COBOL paragraph
Thanks for your suggestions so far. I'd already looked at the assembly listing, I'd expected the paragraphs to be invoked with a JSB (or whatever on Alpha) and exited with RSB (ditto) like it used to be on VAX a long long time ago... nope, looked like unconditional branch instructions to me. This probably explains some of the behaviour.
I think the suggestion to use STEP to execute the paragraph is probably the way to go if I can just get to the start of it in a clean way first!
The dream is to be able to use the debugger as a universal test harness for unit testing parts of typical monolithic Cobol programs.
cheers
andrew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-05-2006 07:34 AM
тАО02-05-2006 07:34 AM
Re: Debug single COBOL paragraph
There many ways to force DEBUG to stop exactly where you want it, and/or easily build debug harnesses.
STEP/BRANCH may do what you want already. It will stop at any branch instruction. Here's an example:
DBG> step/branch
In TopLevel. Starting to run program
>>>> Now in OneLevelDown
>>>>>>>> Now in TwoLevelsDown.
>>>>>>>>>>>> Now in ThreeLevelsDown
stepped to PERFORMFORMAT1\%LINE 30+52: JMP R31,(R0)
30: DISPLAY ">>>>>>>>>>>> Now in ThreeLevelsDown".
DBG> step/branch
>>>>>>>> Back in TwoLevelsDown.
stepped to PERFORMFORMAT1\%LINE 20+48: JMP R31,(R0)
20: DISPLAY ">>>>>>>> Back in TwoLevelsDown.".
DBG> step/branch
>>>> Back in OneLevelDown
stepped to PERFORMFORMAT1\%LINE 26+56: JMP R31,(R0)
26: DISPLAY ">>>> Back in OneLevelDown".
DBG> step/branch
Back in TopLevel.
%DEBUG-I-EXITSTATUS, is '%SYSTEM-S-NORMAL, normal successful completion'
Another option is to use COBOL CONTINUE statements to give you lines that you can set break points at. Just put one as the first and one as the last line in your code.
You could also declare a variable, say DEBUG-LEVEL which you increment at the top of each paragraph and decrement at the bottom. That way the single DEBUG command:
DBG> SET WATCH DEBUG-LEVEL
will stop at the top and bottom of every paragraph, but you could also be more selective:
DBG> SET WATCH DEBUG-LEVEL WHEN(DEBUG-LEVEL > 2)
This will only stop at depths greater than 2 (I'm not 100% certain of the conditional syntax used for COBOL programs - it may be "GREATER THAN")
Explore the DEBUG commands. SET BREAK and SET WATCH have LOTS of options and optional clauses. If you can think of a way of debugging code, the DEBUG engineers are probably ahead of you, and have provided it already!
More complex... try writing each paragraph as an independent program. You can then CALL the program from DEBUG. See attachment. Here's an example run.
OpenVMS Alpha Debug64 Version V7.2-01R
%DEBUG-I-INITIAL, Language: COBOL, Module: PERFORMFORMAT1
%DEBUG-I-NOTATMAIN, Type GO to reach MAIN program
DBG> Go
break at routine PERFORMFORMAT1
2: PROGRAM-ID. PerformFormat1.
DBG> CALL LevelOne
>>>> Now in OneLevelDown
>>>>>>>> Now in TwoLevelsDown.
>>>>>>>>>>>> Now in ThreeLevelsDown
>>>>>>>> Back in TwoLevelsDown.
>>>> Back in OneLevelDown
value returned is 1
DBG> CALL LevelThree
>>>>>>>>>>>> Now in ThreeLevelsDown
value returned is 1
DBG> CALL LevelTwo
>>>>>>>> Now in TwoLevelsDown.
>>>>>>>>>>>> Now in ThreeLevelsDown
>>>>>>>> Back in TwoLevelsDown.
value returned is 1
DBG> Exit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-05-2006 09:44 AM
тАО02-05-2006 09:44 AM
Re: Debug single COBOL paragraph
Thanks for your detailed and thoughtful response. A few comments if I may...
(1) STEP/BRANCH is something I had not thought of and it certainly appears to work in this simple case. It might get a little confusing where EVALUATE (switch) statements are involved in the body of a paragraph, I suspect the compiler might start generating a few branch instructions here as well. There will probably be other cases where branch instructions are generated that are not involved in the entry/exit of a paragraph. This would lead to confusion.
(2) The CONTINUE statement. Tried that, seemed to get optimized out of existence even when /DEBUG/NOOPT specified. At least SET BREAK %LINE couldn't find it.
(3) DEBUG-LEVEL. This will work and I will include it in my discussions with the developers.
(4) Refactoring. This is absolutely the correct way to go. However the reluctance of developers to touch a large complicated piece of code that might succesfully implement some bizarre legislative requirement cannot be underestimated. If it works there is no desire to fix it! Hence the attempt to test fragments of the code in-situ.
My current, less than optimal 'solution', is to insert code at the end of the module along the lines of:
DBGMYPARA.
PERFORM MYPARA.
CALL LIB$SIGNAL USING BY VALUE SS$_DEBUG.
This gives me the ability to execute each paragraph normally with instructions like:
DBG> GO DBGMYPARA
The SS$_DEBUG gets control back to the debugger in a 'graceful' way. It doesn't rely on knowledge of the code generated by the compiler and the additional lines could be added by a simple automated editing procedure.
To all those who responded. Thank you.
cheers
andrew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-07-2006 08:45 AM
тАО02-07-2006 08:45 AM