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

non-positive reference modification error


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

New User


Joined: 13 Apr 2007
Posts: 36
Location: Pune

PostPosted: Fri Sep 04, 2009 11:22 am
Reply with quote

Hi,
We have to find if the contents of a character field (WS-VAR1 in example) are numeric and then accordingly proceed in the logic.
We are using the following logic:

---working storage---

WS-VAR1 PIC X(30)
LEN1 PIC 9(18) VALUE 0
LEN2 PIC 9(18) VALUE 0
--------------------------

Logic is as follows: -

*--- WS-VAR1 is a char of length 30 and we have to find the length of its contents--
INSPECT FUNCTION REVERSE(WS-VAR1)
TALLYING LEN1 FOR LEADING SPACES.
COMPUTE LEN2= 30 - LEN1

*-- then we are checking if the values in the field are numeric

IF WS-VAR1(1:LEN2) NUMERIC
MOVE 'XYZ' TO WS-VAR3
DISPLAY 'Is Numeric'
END-IF
DISPLAY 'Not Numeric'


The logic tested fine initially . However, now my peer has got the following error when WS-VAR1 is spaces. He says, that in case WS-VAR1 is spaces, LEN1 will be 30 and LEN2 will be 0.

The below line according to him is giving error:
IF WS-VAR1(1:LEN2) NUMERIC (*-- LEN2 being 0)
Error :- A non-positive reference modification length value of 0 on line
xxxx was found in a reference...

However when I run the program I get the following results through displays:

WS-VAR1 = ' ' (To test this, I passed spaces in this variable a little earlier in logic)

LEN1 = 000000000000000020

LEN2 = 000000000000000000

'Not Numeric'

So, I am not getting the same error, though the conditions are the same.

Can anyone help here? I tried searching for this kind of issue but could not find anything, except that value of length should be +ve (greater than 0. But I am not getting any error for this.

Am I missing something here?

Thanks,
Ashutosh
Back to top
View user's profile Send private message
Girish Firke

New User


Joined: 04 Feb 2009
Posts: 5
Location: Mumbai

PostPosted: Fri Sep 04, 2009 12:09 pm
Reply with quote

Hi Ashutosh.

Quote:

However when I run the program I get the following results through displays:

WS-VAR1 = ' ' (To test this, I passed spaces in this variable a little earlier in logic)

LEN1 = 000000000000000020

LEN2 = 000000000000000000

'Not Numeric'

So, I am not getting the same error, though the conditions are the same.


If you have tested your logic with WS-VAR1 as spcaes then I think you should get LEN1 = 000000000000000030 but you got 000000000000000020
Whether you passed correct value?
Back to top
View user's profile Send private message
ashutosh.pr

New User


Joined: 13 Apr 2007
Posts: 36
Location: Pune

PostPosted: Fri Sep 04, 2009 1:25 pm
Reply with quote

OOPS!!
Thats a Typo..
These are the displays:

LEN1 = 000000000000000030

LEN2 = 000000000000000000

Thanks
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Sep 04, 2009 3:18 pm
Reply with quote

you have provided nothing but pseudo-code.

you need to supply the data layout and the code of your module,
cut & paste.

another typo and you can solve this problem yourself.

obviously, had you the same code as your peer, you would have the same error.

you are not having the same error, and without your data definitions/code, we can not offer any solutions.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Fri Sep 04, 2009 6:25 pm
Reply with quote

Not to stray off topic, but what is all this crap I've been seeing lately where -ve is supposed to mean negative and +ve is supposed to mean positive? icon_evil.gif Have these bulletin boards become "chat speak" outlets for people or what? Does it really take that much extra time out of our lives to use proper terminology and spell words correctly?
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Sat Sep 05, 2009 11:10 am
Reply with quote

Terry, I agree with you. I've seen too a "-ve" post and had to scratch my head for a few seconds before I understood what it means.
However, in this case, it is apparently the way IBM has phrased its error message.

The Enterprise COBOL Language Reference says , about Reference modification:
Quote:
The evaluation of length must result in a positive nonzero integer.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Sat Sep 05, 2009 11:23 am
Reply with quote

Oooh, OK, now I've seen a "+ve" too.... icon_cry.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Mon Sep 07, 2009 5:48 pm
Reply with quote

I believe this
Quote:
Does it really take that much extra time out of our lives to use proper terminology and spell words correctly?
needs a proper education rather.

Other factor is, many of us learned English as a second language and some times many of us mold the sentences/words as per our need (and knowledge of language) with the assumption that such a modification would make sentences compact and rather easy to interepret.

And, I also agree with Terry -- On Technical Boards one should not use such short-forms. That way we can easily avoid many unnecessary confusions.

Regards,
Back to top
View user's profile Send private message
ashutosh.pr

New User


Joined: 13 Apr 2007
Posts: 36
Location: Pune

PostPosted: Tue Sep 08, 2009 12:17 pm
Reply with quote

Apologies for using the short forms here on the board. I will take care of this from the next time.

Regarding the error that my colleague is getting, its in another program which is having exactly same logic (this was a change made in several of the programs for a business requirement). We currently do not have access to run that particular program, but the doubt that we have here is,
"IF LD-SRCH-BANK-REF-CD(1:SUB06) IS NUMERIC " is not giving an error when the value of SUB06 is Zero.

Regarding the actual code. Please find the code below and the Display spool , copy pasted from the code. We have delibirately moved spaces to
the variable LD-SRCH-BANK-REF-CD to get the error, but the program is not failing (moving spaces to LD-SRCH-BANK-REF-CD is not the part of logic).

----Working Storage--
05 SUB05 PIC 9(18) VALUE 0.
05 SUB06 PIC 9(18) VALUE 0.
05 LD-SRCH-BANK-REF-CD PIC X(20).


--- Code----

MOVE ZEROES TO SUB05,SUB06
MOVE SPACES TO LD-SRCH-BANK-REF-CD
INSPECT FUNCTION REVERSE(LD-SRCH-BANK-REF-CD)
TALLYING SUB05 FOR LEADING SPACES
COMPUTE SUB06 = 20 - SUB05
DISPLAY 'SUB06 IS :' SUB06':'
DISPLAY 'BANK-REF-CD :' LD-SRCH-BANK-REF-CD':'
IF LD-SRCH-BANK-REF-CD(1:SUB06) IS NUMERIC
DISPLAY 'IN NUMERIC'
MOVE ALL ZEROES TO WS-SRCH-BANK-REF-CD
ADD 1 TO SUB05
MOVE LD-SRCH-BANK-REF-CD(1:SUB06) TO
WS-SRCH-BANK-REF-CD(SUB05:20)
MOVE WS-SRCH-BANK-REF-CD TO LD-SRCH-BANK-REF-CD
END-IF
DISPLAY 'NOT IN NUMERIC'


----- display output ---
PROGRAM STARTED ON 2009-09-08
PROGRAM STARTED AT 02:27:13:30

SUB05 IS :000000000000000020:
SUB06 IS :000000000000000000:
BANK-REF-CD : :
NOT IN NUMERIC
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Sep 08, 2009 8:43 pm
Reply with quote

Anyway, it shouldn't be too difficult to add
Code:
IF LD-SRCH-BANK-REF-CD = SPACES
    MOVE ALL ZEROES TO WS-SRCH-BANK-REF-CD
ELSE
before the INSPECT

Why do you use:
Code:
05 SUB05 PIC 9(18) VALUE 0.
05 SUB06 PIC 9(18) VALUE 0.
icon_question.gif icon_question.gif
This is much better:
Code:
05 SUB05 PIC 9(4) COMP VALUE 0.
05 SUB06 PIC 9(4) COMP VALUE 0.
Back to top
View user's profile Send private message
ashutosh.pr

New User


Joined: 13 Apr 2007
Posts: 36
Location: Pune

PostPosted: Wed Sep 09, 2009 8:30 am
Reply with quote

Thanks Marso,
Yes, we have made the changes as the previous logic did not look very stable.
But I am still not sure why even explicitly setting the length value to zeroes has not given the reference modification error.
Another thing that we noted was that the error which was encountered was in an online CICS program ( with the same logic), but we did not get any errors in the above program that is a batch program.
Does anyone know if online or batch environments make a difference?
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 Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Error while running web tool kit REXX... CLIST & REXX 5
No new posts Getting Error while trying to establi... DB2 3
Search our Forums:

Back to Top