COBOL - Debug / Step Through

 2 Replies
 1 Subscribed to this topic
 17 Subscribed to this forum
Sort:
Author
Messages
klkemp100
Basic Member
Posts: 14
Basic Member
New Poster
New Poster
Congrats on posting!
Engaged Reader
Engaged Reader
You are an engaged reader!

Been YEARS since i've done any COBOL, as well as in Lawson.

I'm trying to read through the MA531 PD file to understand exactly what / how it is processing our EDI data, possibly looking at doing a small modification.

Anyway, looking through it and following everything is driving me crazy.

Is there a way to run the program in our TEST environment in a debug mode where I can make the program step through and follow the path it takes in the PD file?

Many thanks!

Ragu Raghavan
Veteran Member
Posts: 477
Veteran Member
New Poster
New Poster
Congrats on posting!
Engaged Poster
Engaged Poster
Wow, you're on a roll!
Avid Poster
Avid Poster
Seriously, you're a posting maniac!
Engaged Reader
Engaged Reader
You are an engaged reader!
Avid Reader
Avid Reader
Avid Reader art thou!
qcompile with the trace option (-T) will show all the routines performed, in the job log.
johne
Basic Member
Posts: 11
Basic Member
New Poster
New Poster
Congrats on posting!

before doing these steps,  make sure you have a jobdef already set up for  the program you want to debug,  and that it has run to completion;

disclaimer:  my background is in HR/PR,  so i'm using programs from that area for examples;  and i work in a UNIX environment


compile the program in a debugger mode:   
    *** this does not work well w/ interactive forms,  stick to this w/ batch programs

    *** do not do this in a production environment,  anyone else using the program will also be working in a debug mode!


    qcompile -D productline systemcode programcode
        e.g.:  qcompile -D prod pr pr514
        this will put a .int version of the source code in the   ../obj   source code directory

fyi... you made want to put your session into a character mode at this time.
    export LATERM=pt80-e;  export LATERM
        ** after you do this,  to reset easily... sign out & sign back in
    
run the debugger:
    batchanim formname dataarea username jobname stepnbr
        e.g.:  batchanim pr514 prd klkemp100 pr514-klk 1
        
        this will kick off the program in a debugger mode
        commands are shown at the bottom of the screen
            F = find,  S = step   B = break   Z = zoom    etc.
        F & search for 050-EDIT
        put a break point there,  then hit Z to zoom to that spot

        moving the cursor to a data item you can view the value;  you can also set up a monitor of data elements;
        
        fyi...
            good idea to have the program source open in a view mode in another session;
            using that view, find the spots that you want to focus in on,  maybe putting
            break points on the first sentence of certain routines;
            
            if the program is large,  S command to step thru the program may take a long
            time,  especially if the program calls a lot of Lawson routines... because
            you'll be stepping thru a lot of routines you don't care about

 

remember to reset the program source by performing a standard compile.


            
other option....
    put in some display statements  and  dump pertinent information to the job log