IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Finding logical error using offset value.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
VinayCM

New User


Joined: 06 Nov 2007
Posts: 36
Location: Bengaluru

PostPosted: Tue Nov 27, 2007 3:13 pm
Reply with quote

Can anybody suggest me how to find logical error using offset value displayed in spool area..
thanks in advance
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Nov 27, 2007 3:59 pm
Reply with quote

Vinay,

Quote:
Can anybody suggest me how to find logical error using offset value displayed in spool area..


How do you define 'logical error'? From the system perspective, everything is proper (including garbage) as long as syntaxs are fine.
Back to top
View user's profile Send private message
VinayCM

New User


Joined: 06 Nov 2007
Posts: 36
Location: Bengaluru

PostPosted: Tue Nov 27, 2007 5:09 pm
Reply with quote

Murali,
I'm getting error at following specified offset... so how to find the location in program using that offset....
Code:
The flow of control in program SORT2 proceeded beyond the last line of the program. From compile unit SORT2 at entry point SORT2 at compile unit offset +00000890 at address 00006E00.



Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Tue Nov 27, 2007 5:31 pm
Reply with quote

You will have to find the listing produced during compilation of the program, or use some debugging tool.

O.
Back to top
View user's profile Send private message
VinayCM

New User


Joined: 06 Nov 2007
Posts: 36
Location: Bengaluru

PostPosted: Tue Nov 27, 2007 6:17 pm
Reply with quote

Thanks for your valuable suggestions.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Tue Nov 27, 2007 6:20 pm
Reply with quote

Do you use CHGMAN or Endevor; if you use CHGMAN, I can provide some suggestions. By the time check this link, might be useful.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Nov 27, 2007 7:37 pm
Reply with quote

This doesn't ans your ques, but may solve your problem.

The usual reason for that kind of problem is that you executed the last coded line of your program and didn't exit the pgm via goback or stop run.

Tracing through the code you'll find that you either "fell thru" to that point or "go to"ed to it.
Back to top
View user's profile Send private message
VinayCM

New User


Joined: 06 Nov 2007
Posts: 36
Location: Bengaluru

PostPosted: Wed Nov 28, 2007 2:27 pm
Reply with quote

Jack,
Here i'm posting my code, can you tell me where is the mistake.
Code:
PROCEDURE DIVISION USING LS-FIELD.                   
    ACCEPT LS-FIELD.                                 
    PERFORM A00-OPEN-FILES.                           
    PERFORM A11-SORT-PARA.                           
    PERFORM C00-CLOSE-FILES.                         
    STOP RUN.                                         
A11-SORT-PARA.                                       
    IF LS-FIELD = 'A'                                 
        DISPLAY 'ASCENDING ORDER SELECTED'           
        SORT SYS-FILE ON ASCENDING KEY S-TELNO       
             INPUT PROCEDURE IS A10-INPUT-PROCEDURE   
             OUTPUT PROCEDURE IS B10-OUTPUT-PROCEDURE
    END-IF.                                           
    IF LS-FIELD = 'D'                                 
        DISPLAY 'DESCENDING ORDER SELECTED'           
        SORT SYS-FILE ON DESCENDING KEY S-TELNO       
             INPUT PROCEDURE IS A10-INPUT-PROCEDURE   
             OUTPUT PROCEDURE IS B10-OUTPUT-PROCEDURE
    END-IF.                                           
A00-OPEN-FILES.                                 
    OPEN INPUT IN-FILE.                         
    OPEN OUTPUT OUT-FILE.                       
                                               
A10-INPUT-PROCEDURE.                           
    READ IN-FILE AT END MOVE 'Y' TO WS-FLAG     
         NOT AT END MOVE IN-REC TO SYS-REC     
    END-READ.                                   
    PERFORM UNTIL WS-FLAG = 'Y'                 
       RELEASE SYS-REC                         
       READ IN-FILE AT END MOVE 'Y' TO WS-FLAG 
           NOT AT END MOVE IN-REC TO SYS-REC   
       END-READ                                 
    END-PERFORM.                               
B10-OUTPUT-PROCEDURE.                           
    RETURN SYS-FILE                             
         AT END GO TO B10-EXIT.                 
    MOVE SYS-REC TO OUT-REC.                   
     WRITE OUT-REC.             
     GO TO B10-OUTPUT-PROCEDURE.
 B10-EXIT.                     
     EXIT.                     
 C00-CLOSE-FILES.               
     CLOSE IN-FILE, OUT-FILE.   
Back to top
View user's profile Send private message
pmn

New User


Joined: 29 Jan 2006
Posts: 1
Location: bangalore

PostPosted: Wed Nov 28, 2007 4:00 pm
Reply with quote

When you get abend ,,along with that you will get offset number as well,,,
then you do the following steps,,
1. find that offset no in your source listing pgm
2. when you find offset no in source pgm,,,just above that offset number you will get pgm statement number
3. take that statement number and find out what statment has come over there
4.then verify the field values of that particular statement

Thanks,
Praveen
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Nov 28, 2007 7:25 pm
Reply with quote

Hi Vinaykumar,

1st, I think you misunderstand the functioning of the SORT verb. Take a look at an example in your shop or the manual and compare it to what you're attempting.

2nd, if you're using EXITs you must use the "THRU" option in the SORT stmt.

3rd, use a pgraph name to start your code, e.g. 000-MAINLINE. I don't remember the specifics, but some hinky things can happen w/o it.

If you have any ques on what you found don't hesitate...
If you get it to work let us know what did it for you.

Good luck
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Wed Nov 28, 2007 9:40 pm
Reply with quote

Hello,

Code:
RETURN SYS-FILE                             
         AT END GO TO B10-EXIT. 
When AT END is reached, the GO TO causes the program to "fall out the bottom".

As Jack mentioned, you could use "THRU". You could also also make the input and output procedures be SECTIONs.
Back to top
View user's profile Send private message
VinayCM

New User


Joined: 06 Nov 2007
Posts: 36
Location: Bengaluru

PostPosted: Thu Nov 29, 2007 10:40 am
Reply with quote

Can anybody send me example code... because my shop doesn't contain it..
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Fri Nov 30, 2007 3:04 am
Reply with quote

Hello,

If you change this
Code:
OUTPUT PROCEDURE IS B10-OUTPUT-PROCEDURE
to
Code:
OUTPUT PROCEDURE IS B10-OUTPUT-PROCEDURE
               THRU B10-EXIT
your code should not fall out the bottom.

You need to do this both places in the code.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Help on IMS -API URL migrating from P... IMS DB/DC 1
No new posts JES datasets IO Error ABENDS & Debugging 3
No new posts Error to invoke MPP program through B... IMS DB/DC 3
No new posts PKZIP error ZPFM121E and ZPCE009E JCL & VSAM 6
No new posts OpenPGP Decryption job getting LRECL ... IBM Tools 7
Search our Forums:

Back to Top