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
 

 

Getting S0C7 when comparing two COMP-3 fields

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

New User


Joined: 12 Dec 2008
Posts: 96
Location: Gurgaon

PostPosted: Thu Apr 29, 2010 10:25 am    Post subject: Getting S0C7 when comparing two COMP-3 fields
Reply with quote

Hi,

I have two fields which are comp-3 and having initial val as +50 as shown

Code:


01  WS-LINES-PRINTED               PIC S9(03) COMP-3 VALUE +50.
01  WS-PAGE-SIZE                   PIC S9(03) COMP-3 VALUE +50.


When i am comparing them it is giving me 0c7 error. Here is my comparision

Code:

IF WS-LINES-PRINTED = WS-PAGE-SIZE                           
   MOVE WS-PAGE-NO  TO HD01-PAGE-NO                           
   WRITE RPT-REC FROM HEAD-LINE-1 AFTER ADVANCING 1 LINE     
   WRITE RPT-REC FROM HEAD-LINE-2 AFTER ADVANCING 1 LINE     
   WRITE RPT-REC FROM HEAD-LINE-3 AFTER ADVANCING 1 LINE     
   WRITE RPT-REC FROM HEAD-LINE-4 AFTER ADVANCING 1 LINE     
   WRITE RPT-REC FROM HEAD-LINE-5 AFTER ADVANCING 1 LINE     
   WRITE RPT-REC FROM HEAD-LINE-6 AFTER ADVANCING 1 LINE     
   WRITE RPT-REC FROM HEAD-LINE-4 AFTER ADVANCING 1 LINE     
   MOVE +7 TO WS-LINES-PRINTED                               
   DISPLAY 'HELLO IN IF'                                     
   ADD +1 TO WS-PAGE-NO                                       
END-IF.                   
                                   


please help me in this issue.

regards,
rupesh gupta
Back to top
View user's profile Send private message

Mathiv Anan

Active User


Joined: 23 Jul 2008
Posts: 106
Location: USA

PostPosted: Thu Apr 29, 2010 12:08 pm    Post subject: Reply to: Getting S0C7 when comparing two COMP-3 fields
Reply with quote

Are you sure it gives S0C7 while comparing?

If you get S0C7, it means that there is non-numeric data involved.

Please check.
Back to top
View user's profile Send private message
rupesh gullu

New User


Joined: 12 Dec 2008
Posts: 96
Location: Gurgaon

PostPosted: Thu Apr 29, 2010 12:31 pm    Post subject: Reply to: Getting S0C7 when comparing two COMP-3 fields
Reply with quote

Hi Mathi,

Yes I have declared COMP-3 fileds and I am comparing them. I havn't initialized it anywhere

regards,
rupesh gupta
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Thu Apr 29, 2010 12:45 pm    Post subject:
Reply with quote

This is initializing :

MOVE +7 TO WS-LINES-PRINTED

If you try as assignment like :

WS-LINES-PRINTED = 7

you still get the 0C7?
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Thu Apr 29, 2010 12:54 pm    Post subject:
Reply with quote

Hi Rupesh,

Couple of suggestions ...

Just to be sure that you haven't modified the fields.. you can use a debugging tool to see the value what it is having at the time of comparison... or .. you could redefine the fields as ALPHANUMERIC and display these fields just before comparison.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Thu Apr 29, 2010 1:29 pm    Post subject:
Reply with quote

It could also be an uninitialized WS-PAGE-NO......

Ten minutes of dump reading and the answer would be known, What assembler instruction does the PSW point to?
Back to top
View user's profile Send private message
Bang_1

New User


Joined: 08 May 2009
Posts: 39
Location: Bangalore

PostPosted: Thu Apr 29, 2010 1:45 pm    Post subject: Reply to: Getting S0C7 when comparing two COMP-3 fields
Reply with quote

This S0C7 is not from comparision. I copied declaration & IF, works for me... Here is the code snippet


WORKING-STORAGE SECTION.
01 WS-LINES-PRINTED PIC S9(03) COMP-3 VALUE +50.
01 WS-PAGE-SIZE PIC S9(03) COMP-3 VALUE +50.
PROCEDURE DIVISION.
MAIN-PARA.
IF WS-LINES-PRINTED = WS-PAGE-SIZE
DISPLAY 'EQUAL'
ELSE
DISPLAY 'NOT EQUAL'
END-IF.
MAIN-EXIT.


Output is --> EQUAL

As CICSGuy said, it might be from WS-PAGE-NO...
Back to top
View user's profile Send private message
rupesh gullu

New User


Joined: 12 Dec 2008
Posts: 96
Location: Gurgaon

PostPosted: Thu Apr 29, 2010 1:55 pm    Post subject: Reply to: Getting S0C7 when comparing two COMP-3 fields
Reply with quote

Bang_1,

I wil try to look into the code and let me verify. Thanks for help. Will let you know once I am done with it.

regards,
rupesh gupta
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Thu Apr 29, 2010 6:33 pm    Post subject: Re: Reply to: Getting S0C7 when comparing two COMP-3 fields
Reply with quote

Bang_1 wrote:
This S0C7 is not from comparision. I copied declaration & IF, works for me...
It can be, but one of the compared values would need to be garbage, somehow stepped on. A Compare Packed will throw a data exception......
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: Thu Apr 29, 2010 6:39 pm    Post subject: Reply to: Getting S0C7 when comparing two COMP-3 fields
Reply with quote

If one or both of the COMP-3 fields is elementary to a group-level, make sure no one is moving ZEROS (which are X'F0's) or anything else for that matter, to the group-level.

That will burn you every time....

Bill
Back to top
View user's profile Send private message
rupesh gullu

New User


Joined: 12 Dec 2008
Posts: 96
Location: Gurgaon

PostPosted: Thu Apr 29, 2010 6:55 pm    Post subject: Reply to: Getting S0C7 when comparing two COMP-3 fields
Reply with quote

Hi,

I am still getting the errors. Here are the display statements:

Code:

WS-LINES-PRINTED 0 
WS-PAGE-SIZE 3     
WS-PAGE-NO0002     


I tried to compare two values which are comp-3 as Bang_1 suggested and its running fine .. i am also not able to get why page no is displaying val 2 as have not increased its value any where.

regards,
rupesh
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: Thu Apr 29, 2010 7:10 pm    Post subject: Reply to: Getting S0C7 when comparing two COMP-3 fields
Reply with quote

As CICS Guy said (and I don't want to beat on a dead horse), it could be that all you need to do is to initialize WS-PAGE-NO to a valid packed-decimal value of your choosing.

Have you tried this?

WS-PAGE-SIZE should have displayed as 4-Bytes numeric and it seems to be a static variable, initialized to +50, same with WS-LINES-PRINTED.

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

REXX Moderator


Joined: 13 Mar 2006
Posts: 1219
Location: Israel

PostPosted: Thu Apr 29, 2010 7:56 pm    Post subject:
Reply with quote

CICS Guy wrote:
It could also be an uninitialized WS-PAGE-NO......

I'm with Bill and CICS Guy in this.
Do WS-PAGE-NO have an initial value ?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Thu Apr 29, 2010 8:22 pm    Post subject:
Reply with quote

Not to beat a dead horse, but what assembler instruction does the PSW point to?
Compare Packed?
Zero and Add Packed?
Add Packed?
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: Thu Apr 29, 2010 8:53 pm    Post subject: Reply to: Getting S0C7 when comparing two COMP-3 fields
Reply with quote

Anyone care to join? icon_wink.gif

http://theroosterstrikes.files.wordpress.com/2008/01/beating-a-dead-horse.gif

Bill
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
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 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 Need help to populate date in COMP-3 ... chetanambi DFSORT/ICETOOL 3 Tue Jun 21, 2016 12:25 pm


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