[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference clt::cobol

Title:VAX/DEC COBOL
Notice:Kit,doc,performance talk info-->DIR/KEY=KIT or DOC or PERF_TALK
Moderator:PACKED::BRAFFITT
Created:Mon Feb 03 1986
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3250
Total number of notes:13077

3234.0. "/check=decimal switch producing stange results" by SWAM1::COHEN_RO (Ron Cohen: DTN 531-3742) Thu Apr 24 1997 00:31

    This is related to Note #3228. As a result of needing to compile
    the programs with /check=decimal (in order to force an invalid data
    exception in DEC Cobol 2.4) the programs are aborting in places
    they do not without this switch. Without the switch , the programs
    have all worked smoothly (except for the forced data exception).
    With the switch I received an invalid operand abort. A debug session
    follows.
    (partial working storage definitions)
    	05 det-line-type	pic x(7).
    
    	05 det-save-line-no-comm	pic 9(4).
    
    	05 det-save-line-no		pic 9(4).
    
    	05 repco-line			pic 9(4).
    
    The abort is at line 7018. At that time det-line-type = "       "
    so it should go to line #7020 and then to line #7023.
    
    
->7018:                 MOVE DET-SAVE-LINE-NO-COMM      TO RECPO-LINE
  7019:         ELSE
  7020:                 MOVE DET-SAVE-LINE-NO   TO RECPO-LINE
  7021:         END-IF.
  7022:
  7023:         READ RECPO-FILE INVALID KEY
- OUT -output-------------------------------------------------------------------
stepped to POE00100\%LINE 7016
stepped to POE00100\%LINE 7017
stepped to POE00100\%LINE 7020
stepped to POE00100\%LINE 7020
stepped to POE00100\%LINE 7018
break on unhandled exception preceding POE00100\%LINE 7018

- PROMPT -error-program-prompt--------------------------------------------------
DBG> Step
%SYSTEM-F-DECINV, decimal invalid operand, PC=B281ED5C, PS=007AA4A4




- SRC: module POE00100 -scroll-source-------------------------------------------
  7013:         MOVE 0                                  TO RECPO-LINE.
  7014: * get key information from smg-data.
  7015:         MOVE HOLD-LOC               TO RECPO-LOC-1
  7016:         MOVE HOLD-PONUM             TO RECPO-NUMBER
  7017:         IF      DET-LINE-TYPE = 'CX     ' OR 'CL     '
->7018:                 MOVE DET-SAVE-LINE-NO-COMM      TO RECPO-LINE
  7019:         ELSE
  7020:                 MOVE DET-SAVE-LINE-NO   TO RECPO-LINE
  7021:         END-IF.
  7022:
  7023:         READ RECPO-FILE INVALID KEY
- OUT -output-------------------------------------------------------------------
stepped to POE00100\%LINE 7017
DET-LINE-TYPE of POE00100\DETAIL-COMMENT-LINE:  "       "
DET-SAVE-LINE-NO-COMM of DET-SAVE-COMM of POE00100\DETAIL-COMMENT-LINE: 0
DET-SAVE-LINE-NO of POE00100\DETAIL-LINE:       10100
stepped to POE00100\%LINE 7020
stepped to POE00100\%LINE 7020
stepped to POE00100\%LINE 7018
- PROMPT -error-program-prompt--------------------------------------------------



    
    Any suggestions? 
    Thanks,
    Ron
    
    
    
T.RTitleUserPersonal
Name
DateLines
3234.1Is det-line-type really ''?PACKED::BRAFFITTThu Apr 24 1997 11:3268
>    The abort is at line 7018. At that time det-line-type = "       "
>    so it should go to line #7020 and then to line #7023.
    
    This is what you need to track down.  If det-line-type = "       " then
    7018 should not be executed.  I recommend that you put a DISPLAY
    statement before line 7017 and after line 7017 to verify the contents
    of det-line-type.  Also compile /deb/noopt/check=decimal to make
    debugging easier.
        
  7017:         IF      DET-LINE-TYPE = 'CX     ' OR 'CL     '
->7018:                 MOVE DET-SAVE-LINE-NO-COMM      TO RECPO-LINE
  7019:         ELSE
  7020:                 MOVE DET-SAVE-LINE-NO   TO RECPO-LINE
  7021:         END-IF.
    
    Here's the program I tried.
    
IDENTIFICATION DIVISION.
PROGRAM-ID. C3234.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WSS.
    	05 det-line-type	pic x(7).
    	05 det-save-line-no-comm	pic 9(4).
    	05 det-save-line-no		pic 9(4).
    	05 repco-line			pic 9(4).
	05 hold-loc			pic 9(4).
	05 hold-ponum			pic 9(4).
	05 recpo-loc-1			pic 9(4).
	05 recpo-number			pic 9(4).
	05 recpo-line			pic 9(4) comp.

PROCEDURE DIVISION.
P0.	DISPLAY "***C3234***".

*    The abort is at line 7018. At that time det-line-type = "       "
*    so it should go to line #7020 and then to line #7023.
*
*  7013:         MOVE 0                      TO RECPO-LINE.
*  7014: * get key information from smg-data.
*  7015:         MOVE HOLD-LOC               TO RECPO-LOC-1
*  7016:         MOVE HOLD-PONUM             TO RECPO-NUMBER
*  7017:         IF      DET-LINE-TYPE = 'CX     ' OR 'CL     '
*->7018:                 MOVE DET-SAVE-LINE-NO-COMM      TO RECPO-LINE
*  7019:         ELSE
*  7020:                 MOVE DET-SAVE-LINE-NO           TO RECPO-LINE
*  7021:         END-IF.
*  7022:
*  7023:         READ RECPO-FILE INVALID KEY

	MOVE SPACES TO WSS.
	MOVE 0 TO HOLD-LOC.
	MOVE 0 TO HOLD-PONUM.
	MOVE 0                      TO RECPO-LINE.
	MOVE HOLD-LOC               TO RECPO-LOC-1
	MOVE HOLD-PONUM             TO RECPO-NUMBER
	MOVE 'CX' to DET-LINE-TYPE.
	DISPLAY "** DET-LINE-TYPE: 1**" DET-LINE-TYPE "**"
	IF      DET-LINE-TYPE = 'CX     ' OR 'CL     '
		DISPLAY "** DET-LINE-TYPE: 2**" DET-LINE-TYPE "**"
		MOVE DET-SAVE-LINE-NO-COMM TO RECPO-LINE
	ELSE
		MOVE DET-SAVE-LINE-NO      TO RECPO-LINE
	END-IF.

	DISPLAY "***END***".
	STOP RUN.
3234.2det-line-type does = spacesSWAM1::COHEN_RORon Cohen: DTN 531-3742Thu Apr 24 1997 14:4340
    The debug session in .0 was done using your suggestion in .1.
    Following is another debug session. What seems to be happening is
    that it is this time executing the else statement (det-line-type does
    = spaces) at line 7023 but then executes the first part of the if
    statement (line #7020) and aborts with  an 'invalid decimal'.
    
    My concern is that all the programs are aborting with invalid decimal
    data when the /check=decimal switch is used.
    
    det-line-type before if = **      
    **-------------------------------------------
      7015:         MOVE HOLD-LOC               TO RECPO-LOC-1
      7016:         MOVE HOLD-PONUM             TO RECPO-NUMBER
      7017:         display "det-line-type before if = **" det-line-type
    "**"
      7018:         IF      DET-LINE-TYPE = 'CX     ' OR 'CL     '
      7019:                 display "det-line-type in if = **"
    det-line-type "**"
    ->7020:                 MOVE DET-SAVE-LINE-NO-COMM      TO RECPO-LINE
      7021:         ELSE
      7022:                 display "det-line-type in else = **"
    det-line-type "**"
      7023:                 MOVE DET-SAVE-LINE-NO   TO RECPO-LINE
      7024:         END-IF.
      7025:
    - OUT
    -output-------------------------------------------------------------------
    DET-SAVE-LINE-NO of POE00100\DETAIL-LINE:       10100
    10100
    0
    stepped to POE00100\%LINE 7023
    stepped to POE00100\%LINE 7023
    stepped to POE00100\%LINE 7020
    break on unhandled exception preceding POE00100\%LINE 7020
    - PROMPT
    -error-program-prompt--------------------------------------------------
    DBG> Step
    %SYSTEM-F-DECINV, decimal invalid operand, PC=B281ECD4, PS=007AAEB0
    
    
3234.3QUARRY::nethCraig NethThu Apr 24 1997 15:155
Well, the debugger could be fibbing about what line you are really
on.

What is in DET-SAVE-LINE-NO and DET-SAVE-LINE-NO-COMM.  If both are non-numeric,
then it doesn't matter what the value of DET-LINE-TYPE is.   
3234.4Both are numericSWAM1::COHEN_RORon Cohen: DTN 531-3742Thu Apr 24 1997 15:313
    Det-save-line-no-comm = 0 / Det-save-line-no = 10100
    These results are displayed in the bottom debug session in .0.
    They both seem to be numeric.
3234.5Check variable values with DISPLAY before the IFPACKED::BRAFFITTThu Apr 24 1997 15:536
>    Det-save-line-no-comm = 0 / Det-save-line-no = 10100
>    These results are displayed in the bottom debug session in .0.
>    They both seem to be numeric.
    
    Try doing DISPLAY WITH CONVERSION for both these variables before
    the IF.
3234.6WENDYL::BLATTThu Apr 24 1997 18:068
Caveat: notice also that the exception message states that the
exception is *preceding* %LINE xxxx.

Also you could do a /MAC/LIS and see where the TRAPs actually
are located.

The line numbers associated with the TRAP in the /MAC code listing 
correspond to the stepping behavior in debugger.