Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

COBOL Working Storage getting corrupted

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Fri Jan 27, 2012 10:41 am    Post subject: COBOL Working Storage getting corrupted
Reply with quote

Hi
I have following sort of group data item in working storage.
Code:

01  WW-REQ.                                                 
    03  WW-F1                   PIC X(5)        VALUE SPACES.
    03  WW-HYPHEN-1             PIC X           VALUE '-'.   
    03  WW-F2                   PIC 9(2)        VALUE ZERO. 
    03  WW-HYPHEN-2             PIC X           VALUE '-'.   
    03  WW-F3                   PIC X(5)        VALUE SPACES.
    03  WW-HYPHEN-3             PIC X           VALUE '-'.   
    03  WW-F4                   PIC X           VALUE SPACES.
    03  WW-HYPHEN-4             PIC X           VALUE ' '.   
    03  WW-F5                   PIC X(6)        VALUE SPACES.

01  WW-CHECK                                       
    REDEFINES                                             
    WW-REQ           PIC X(23).                 
    88 WW-VALID-REQ                         VALUES     
       'YYXXX-00-PPQQQ-M       ',                         
       'YYXXX-00-PPQQQ-B-UNIQUE',                         
       'YYXXX-00-PPQQQ-R       ',                         
       'YYXXX-00-PPQQQ-B-UNIQUE',                         
       'YYXXX-00-PPQQQ-M       ',                         
       'YYXXX-00-PPQQQ-R       ',                         
       'YYXXX-00-PPQQQ-B-FIRST ',                         
       'YYXXX-00-PPQQQ-B-NEXT  ',                         
       'YYXXX-00-PPQQQ-B-CLOSE '.                         


there are no INITIALIZE statements in the program for the WW-REQ or WW-CHECK. only move statements like

Code:

MOVE 'YYXXX' TO WW-F1                   
MOVE 0 TO WW-F2       
.
.
MOVE '-' TO      WW-HYPHEN-4       

etc.. giving a valid combination. (nothing is moved to hyphen-1,2 &3)

But when the check is performed on the field like
Code:

IF WW-VALID-REQ                         
  .....
ELSE
  ERROR
END-IF



the HYPHEN-1,2 and 3 are showing X'00' values (and the check fails). HYPHEN-4 is fine because there is an explicit move for this field.

Could you pls share your thoughts on what could cause the VALUEs to get overwritten by X'00'. If I wasn't clear, i can provide more information if needed.
Back to top
View user's profile Send private message

Narayanan Annamalai

New User


Joined: 20 Jan 2012
Posts: 6
Location: India

PostPosted: Fri Jan 27, 2012 11:49 am    Post subject:
Reply with quote

I tried the same and it's working fine here..

I even used the display statements before and after MOVE :

Code:

BEFORE WW-REQ:    -00-     -
BEFORE WW-CHECK:     -00-     -
AFTER WW-REQ: YYXXX-00-PPQQQ-R-UNIQUE
AFTER WW-CHECK: YYXXX-00-PPQQQ-R-UNIQUE


I don't find any issues. I think probably the variables should have got initialized to low-values somewhere in between the code logic without your knowledge. It really happens sometimes.

You can use XPEDITOR or some debugging tool to find out the exact place causing the issue.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7233

PostPosted: Fri Jan 27, 2012 12:56 pm    Post subject:
Reply with quote

Narayanan Annamalai wrote:
I tried the same and it's working fine here..

I even used the display statements before and after MOVE :

Code:

BEFORE WW-REQ:    -00-     -
BEFORE WW-CHECK:     -00-     -
AFTER WW-REQ: YYXXX-00-PPQQQ-R-UNIQUE
AFTER WW-CHECK: YYXXX-00-PPQQQ-R-UNIQUE


I don't find any issues. I think probably the variables should have got initialized to low-values somewhere in between the code logic without your knowledge. It really happens sometimes.

You can use XPEDITOR or some debugging tool to find out the exact place causing the issue.


It's not really the point whether it works for you. Of course it should work, that's why the TS coded it like that, to work.

Quote:
It really happens sometimes.
No, these are computers. If something has the conditions to happen, then it will always happen. If not, then it will never happen. There's no "inbetween" route.

TS suspects the working-storage has been overwritten. Perhaps you can test that for us? Overwrite your version of the data definition and then see if the code still works, please.

Yes, genesis786, it looks like you have a problem with being overwritten. Are you using compile option SSRANGE? If not, try it if you are able, it will nicely tell you if a subscript/index is busted.
Back to top
View user's profile Send private message
Narayanan Annamalai

New User


Joined: 20 Jan 2012
Posts: 6
Location: India

PostPosted: Fri Jan 27, 2012 1:04 pm    Post subject:
Reply with quote

Quote:
TS suspects the working-storage has been overwritten. Perhaps you can test that for us? Overwrite your version of the data definition and then see if the code still works, please.


Yes Bill. I have already tried overwriting the data several times before posting this. It worked fine. I think this answered your question.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7233

PostPosted: Fri Jan 27, 2012 1:09 pm    Post subject: Reply to: COBOL Working Storage getting corrupt.
Reply with quote

You mean you overwrote the data and the 88's still worked? Let's see.
Code:

MOVE LOW-VALUES TO WW-REQ
IF WW-VALID-REQ
    DISPLAY "WOW, MAGIC IS REAL"
END-IF
.

Nope, magic isn't real.

Or did you mean something else?
Back to top
View user's profile Send private message
Narayanan Annamalai

New User


Joined: 20 Jan 2012
Posts: 6
Location: India

PostPosted: Fri Jan 27, 2012 1:30 pm    Post subject:
Reply with quote

I think the problem statement mentioned here is that when the data is populated to the selective variables in the group data item using MOVE, the constant values (WW-HYPHEN-1, etc) defined are not getting retained, though they are not initialized/populated anywhere in the program.

Of course, WW-HYPHEN-4 is populated and hence retained.

I recreated the scenario and overwrote only the varaibles as mentioned by genesis786. I did not initialize or move values to the entire group variable. It worked fine.

Quote:

there are no INITIALIZE statements in the program for the WW-REQ or WW-CHECK. only move statements like

Code:

MOVE 'YYXXX' TO WW-F1
MOVE 0 TO WW-F2
.
.
MOVE '-' TO WW-HYPHEN-4


etc.. giving a valid combination. (nothing is moved to hyphen-1,2 &3)



It's obvious when you try to flush out the entire group variable with low-
values, none will get retained.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7233

PostPosted: Fri Jan 27, 2012 2:06 pm    Post subject:
Reply with quote

Narayanan Annamalai,

If you want to help, can you please apply yourself to the actual question. Anything else just gets in the way.

TS has some code that should work, and he has/claims no code in his program which would make it fail to work. He does not INITIALIZE the group and he does not have explicit moves to the three "hyphens" in question.

YET, they turn out to contain X'00' at some point when TS interrogates them with an 88, so the test fails. The VALUE, which has been respected by the Compiler, is missing. TS would like to know how their working-storage has become corrupted (note the subject of TS's post) so that they can get on with their work.

Unless I am way off beam with this (TS will let us know), keep other irrelevancies out of this, please. It is pointless to say that when you use the code it works - the whole point is that the code should work and doesn't.
Back to top
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Fri Jan 27, 2012 3:04 pm    Post subject:
Reply with quote

Hi Bill - thanks for your inputs.

I just took a look at the compiled options for the program and it is compiled with NOSSRANGE. (I shall try with SSRANGE to see what's going on)

1 quick doubt - do you think that some other working storage data item (with subscript) could be the culprit? Because the group data item i am interested in has no subscripts..

Thanks!
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7233

PostPosted: Fri Jan 27, 2012 3:34 pm    Post subject: Reply to: COBOL Working Storage getting corrupt.
Reply with quote

Yes, anything else anything with a subscript/index could be wrecking this, defined before (simple) or after (-ve value for subscript).

There are other possibilities. Do you have any "MOVE LOW-VALUES" to anything?
Back to top
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Fri Jan 27, 2012 5:47 pm    Post subject:
Reply with quote

I don't see any MOVE LOW-VALUES, but there are chances that subscripts before/after the grp data item are creating a problem. I will run a few tests and let you know. Thanks a lot!
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7233

PostPosted: Fri Jan 27, 2012 6:19 pm    Post subject: Reply to: COBOL Working Storage getting corrupt.
Reply with quote

No problem.

A dump can be useful. You might "see" a pattern of data, and be able to follow it backwards or forwards to the offending table. Plus you get to see the current values in subscripts/indexes (although they can have been changed since the overwriting).

SSRANGE is a simple way to check the subscripts/indexes/reference modification/occurs depending on. If SSRANGE doesn't spot anything, then it is something else, and we suggest some other things.
Back to top
View user's profile Send private message
Jose Mateo

Active User


Joined: 29 Oct 2010
Posts: 110
Location: Puerto Rico

PostPosted: Fri Jan 27, 2012 7:13 pm    Post subject:
Reply with quote

Good day to all!

Genesis, is your program a online program?
Back to top
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Fri Jan 27, 2012 9:50 pm    Post subject:
Reply with quote

Hi Jose - yes it is an online program.. the transaction runs every few seconds and processes a set of records.. (i haven't been able to test further.. will be able to after i am back from my holiday on 2nd Feb)...
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7233

PostPosted: Fri Jan 27, 2012 11:03 pm    Post subject: Reply to: COBOL Working Storage getting corrupt.
Reply with quote

Thanks (seriously) for letting us know about the holiday. Usually people just tell us when they come back, having left a question festering with us. Have a good one.
Back to top
View user's profile Send private message
Jose Mateo

Active User


Joined: 29 Oct 2010
Posts: 110
Location: Puerto Rico

PostPosted: Fri Jan 27, 2012 11:59 pm    Post subject:
Reply with quote

Happy holiday, Genesis!

That's what I thought that your COBOL program is an online program and CICS resets the working-storage area with low value everytime it re-executes.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Sat Jan 28, 2012 12:07 am    Post subject: Reply to: COBOL Working Storage getting corrupt.
Reply with quote

Now that we know it's a CICS program, is it raising a DFHSM010x message, indicating a Storage Violation? This could happen when you wipe-out the top or (most likely) bottom, SCZ (Storage Check Zone), which causes CICS not to be able to complete an internal FREEMAIN of previous allocated (GETMAINed) Working-Storage.

In other words, have you written past the end of Working-Storage?

Mr. Bill
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Sat Jan 28, 2012 1:03 am    Post subject:
Reply with quote

Jose, That is RUBBISH, if the original working storage items are defined with value clauses, that is what you have when the transaction is entered
again and again. and he has his working storage are defined with value clauses.

Code:
WS-SELECT-DATE  = '1999-12-31-'
WS-SELECT-DATE  = '00.00.00.'
WS-SELECT-DATE  = 000000


this will come back every time in CICS because of the value clause.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 641
Location: Whitby, ON, Canada

PostPosted: Sat Jan 28, 2012 5:06 am    Post subject:
Reply with quote

Whoa! The TS said "online", he didn't say CICS. Could be IMS.

IMS does not necessarily refresh working storage every time a transaction runs.
Back to top
View user's profile Send private message
seagull

New User


Joined: 28 May 2007
Posts: 24
Location: Dublin

PostPosted: Tue Feb 07, 2012 4:43 pm    Post subject:
Reply with quote

What are the fields immediately before these ones? Is there a table anywhere which could be overflowing and wiping out your variables?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am
No new posts Amount field is getting corrupted whe... thesumitk SYNCSORT 5 Tue Oct 18, 2016 8:20 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us