View previous topic :: View next topic
|
Author |
Message |
rupesh gullu
New User
Joined: 12 Dec 2008 Posts: 96 Location: Gurgaon
|
|
|
|
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 |
|
|
Mathiv Anan
Active User
Joined: 23 Jul 2008 Posts: 106 Location: USA
|
|
|
|
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 |
|
|
rupesh gullu
New User
Joined: 12 Dec 2008 Posts: 96 Location: Gurgaon
|
|
|
|
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 |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
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 |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
Bang_1
New User
Joined: 08 May 2009 Posts: 39 Location: Bangalore
|
|
|
|
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 |
|
|
rupesh gullu
New User
Joined: 12 Dec 2008 Posts: 96 Location: Gurgaon
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
rupesh gullu
New User
Joined: 12 Dec 2008 Posts: 96 Location: Gurgaon
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
Back to top |
|
|
|