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
 

 

Display Comp-3 variable in sysout
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Display Comp-3 variable in sysout
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: 7905
Location: Bellevue, IA

PostPosted: Fri Aug 24, 2012 7:26 am    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Fri Aug 24, 2012 7:52 am    Post subject:
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Fri Aug 24, 2012 8:12 am    Post subject:
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

Site Director


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

PostPosted: Fri Aug 24, 2012 8:12 am    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Aug 24, 2012 1:20 pm    Post subject: Reply to: Comp-3 varibale display in sysout
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

Active Member


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

PostPosted: Fri Aug 24, 2012 5:34 pm    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Aug 24, 2012 6:25 pm    Post subject: Reply to: Comp-3 varibale display in sysout
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: 7905
Location: Bellevue, IA

PostPosted: Fri Aug 24, 2012 6:42 pm    Post subject:
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    Post subject: Reply to: Comp-3 varibale display in sysout
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Aug 24, 2012 7:51 pm    Post subject: Reply to: Comp-3 varibale display in sysout
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

Site Director


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

PostPosted: Fri Aug 24, 2012 7:53 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Aug 24, 2012 7:56 pm    Post subject: Reply to: Comp-3 varibale display in sysout
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts How to display value of an exit param... lind sh CICS 2 Sun Oct 09, 2016 12:28 pm
This topic is locked: you cannot edit posts or make replies. DSList (3.4) cannot display Chinese c... jacobdng TSO/ISPF 4 Wed Oct 05, 2016 2:51 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm


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