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

Display Comp-3 variable in sysout


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

New User


Joined: 24 Mar 2012
Posts: 17
Location: pune

PostPosted: Fri Aug 24, 2012 6:44 am
Reply with quote

Hi,
I have a table field say

PB-LMT(2,3) PIC S9(07)V99 COMP-3.
I want to display its value in sysout for testing purpose. I tried to MOVE it in a working storage variable declared as

WS-PB-LMT1 PIC Z(07)V9(2). but getting SOC4 error

Can anyone pls help me on it.
Thanks.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Fri Aug 24, 2012 7:26 am
Reply with quote

1. Why not just display the table element with the leading zeroes?

2. An S0C4 ABEND is a storage violation -- meaning you are going outside your table bounds or otherwise attempting to use storage that is not assigned to your program. Without specific code, there's not much more we can say.

3. You posted invalid syntax -- what is this supposed to be?
Quote:

PB-LMT(2,3) PIC S9(07)V99 COMP-3.
Back to top
View user's profile Send private message
Ravi Kirti

New User


Joined: 24 Mar 2012
Posts: 17
Location: pune

PostPosted: Fri Aug 24, 2012 7:50 am
Reply with quote

Thanks Robert for quick!

In Copybook the field PB-LMT is declared as below.

Code:
10  PB-ACCUM-G.                                       
    15  PB-LMT-E            OCCURS  32 TIMES         
                         INDEXED BY PB-LMT-IDX.       
        20  PB-LMT          OCCURS 3 TIMES           
                               PIC S9(07)V99 COMP-3. 

And the VSAM file from which I am reading is in compressed format, so I'm not able to view the field values in FILE-AID.
I want to see the value of PB-LMT(2,3). So I need this value in sysout.

I tried to display other table variable value also with simple display statement after reading VSAM file. Like -

DISPLAY '__________________________________'
DISPLAY 'PB-LMT(2, 1) : ' PB-LMT(2, 1)
DISPLAY 'PB-LMT(2, 2) : ' PB-LMT(2, 2)
DISPLAY 'PB-LMT(2, 3) : ' PB-LMT(2, 3)
DISPLAY '__________________________________'

But, it's not reflecting correct value. Below os sysout result -

__________________________________
PB-LMT(2, 1) : 0079600 0
PB-LMT(2, 2) : 110000000
PB-LMT(2, 3) : 0 0000000
__________________________________

Thanks
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 Aug 24, 2012 7:52 am
Reply with quote

Hello,

Is the PB-LMT field in a 2-dimensional array?

It looks like your index(es)/subscript(s) are wrong (outside of the array) when you try to move the value to the WS field. . . You could try using SSRANGE to see when the error happens.
Back to top
View user's profile Send private message
Ravi Kirti

New User


Joined: 24 Mar 2012
Posts: 17
Location: pune

PostPosted: Fri Aug 24, 2012 7:59 am
Reply with quote

Yes, Dick It's in 2 dimensional array.
Back to top
View user's profile Send private message
Ravi Kirti

New User


Joined: 24 Mar 2012
Posts: 17
Location: pune

PostPosted: Fri Aug 24, 2012 8:10 am
Reply with quote

I did try with SSRANGE before ID DIV but getting SOC4 again.

CBL SSRANGE
IDENTIFICATION DIVISION.
*************************
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 Aug 24, 2012 8:12 am
Reply with quote

Hello,

Your post has been "Code'd" to improve readabiliby.

What about an index for the second array?

How did you get from the 0c4 to incorrect results?

It sounds like there multiple things wrong and rather than actually fixing one problem at a time, a shotgun approach is being taken. . .
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 Aug 24, 2012 8:12 am
Reply with quote

Follow on:

Which instruction causes the 0c4?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Aug 24, 2012 8:16 am
Reply with quote

looks like the 2 dimensional table within the vsam record is corrupted,
typical reason: program updating the record is not properly written -
different record definition
different working-storage definition

Looks like you have a short record. DFSORT can validate your record lengths.

and why are you not using the work-area option on your reads?

any module that references the record should be checked.

are there different record types within the vsam file?

did not know that file-aid could not handle a compressed vsam record.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Aug 24, 2012 8:19 am
Reply with quote

if you require an extra dd parm to read/write the file,
maybe some update job is not using the required parm.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Aug 24, 2012 9:47 am
Reply with quote

last but not least,
Dick asked the most important question,
when/where are you getting the soc4?

you are not getting it on 2,3.

between no answer on the soc4 and this silliness about file-aid,
i am afraid we have wasted a lot of time here,
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 24, 2012 1:20 pm
Reply with quote

As has been pointed out, there is much that doesn't add up.

If you can display the ( 2 3 ) without getting a S0C4, then you won't get a S0C4 on the MOVE with the same data.

SSRANGE you have, but with literal subscripts you know they are inside the range.

So,

Show your JCL for the VSAM file
Show the Select from your program
Show the FD and what is subordinate to it
If not shown in the previous, show the full copybook

If you are accessing ( 2 3 ) for a record which only has one entry in the table then sometimes you'll get output with no abend, sometimes you'll get S0C7, and you have a chance of S0C4 as well.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1050
Location: Richmond, Virginia

PostPosted: Fri Aug 24, 2012 5:34 pm
Reply with quote

Just a side note - if you are going to move it to a display field, why not show the sign and the actual (rather than implied) decimal point?
Back to top
View user's profile Send private message
Ravi Kirti

New User


Joined: 24 Mar 2012
Posts: 17
Location: pune

PostPosted: Fri Aug 24, 2012 6:20 pm
Reply with quote

I did try with SSRANGE before ID DIV but getting SOC4 again.

CBL SSRANGE
IDENTIFICATION DIVISION.
*************************
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 24, 2012 6:25 pm
Reply with quote

OK, but I said that SSRANGE is not going to change anything. You are using literal subscripts which are known to be within the range.

Can you provide what has been requested, else it is difficult to say much more?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Fri Aug 24, 2012 6:42 pm
Reply with quote

The S0C4 means your program is attempting to access (read or write) storage which does not belong to your program. There is a good chance this is due to a subscript being out of range (a bad variable value, for example, when the variable is being used for a subscript). However, there is also a good chance that the storage violation has absolutely nothing to do with your table.

The abend messages should include a program name and offset into that program where the problem was identified (note that for S0C4 abends in particular, the location the problem is identified at could be a long way from where the storage violation actually occurred). Using that offset to identify the line of code would be the first step to figuring out the abend.
Back to top
View user's profile Send private message
Peter cobolskolan

Active User


Joined: 06 Feb 2012
Posts: 104
Location: Sweden

PostPosted: Fri Aug 24, 2012 7:49 pm
Reply with quote

Why not a simple Repro of some records to Sysout to verify the contents to start with?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Fri Aug 24, 2012 7:51 pm
Reply with quote

Quote:
And the VSAM file from which I am reading is in compressed format, so I'm not able to view the field values in FILE-AID.

icon_eek.gif icon_eek.gif icon_eek.gif
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 Aug 24, 2012 7:53 pm
Reply with quote

Hello,

As i asked before, which instruction caused the 0c4?

I suspect it may be due to referencing a closed (or not yet opened) file.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Fri Aug 24, 2012 7:56 pm
Reply with quote

looks like the topic is going down the sink

up to now the TS has not posted a single bit of info useful to solve his problem
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 Aug 24, 2012 8:18 pm
Reply with quote

Hi Enrico,

Yup, but some of us "big kids" are having fun tossing out ideas icon_smile.gif

d
Back to top
View user's profile Send private message
Ravi Kirti

New User


Joined: 24 Mar 2012
Posts: 17
Location: pune

PostPosted: Fri Aug 24, 2012 8:37 pm
Reply with quote

Sorry for late response, I was away for some time.


The storage reference exception occurred in the following statement:

MOVE PB-LMT(2,3) TO WS-PB-LMT1

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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 24, 2012 9:21 pm
Reply with quote

Well, if that is all you are going to give us, then Dick's "file not currently open" is the most likely, followed by only one entry on that particular record.

We can keep guessing 'til the cows come ho... Oh, there they are now. 'nuff guessing.
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 Aug 24, 2012 9:21 pm
Reply with quote

Hello,

Where is PB-LMT located (in the FD, working-storage, linkage section)?

If it is in the FD, you have probably already been given the answer. . .
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 REXX/CMS How to place command console... CLIST & REXX 4
No new posts CA7 count with DATE variable CA Products 0
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
Search our Forums:

Back to Top