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

compile error on conditional if and move


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

Active User


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

PostPosted: Fri Oct 08, 2010 10:10 pm
Reply with quote

Code:
05 WS-FORMAT-DOB.
  10 WS-DOB-MM                PIC 9(02) VALUE ZEROES.
  10 FILLER                   PIC X(01) VALUE '/'.
  10 WS-DOB-DD                PIC 9(02) VALUE ZEROES.
  10 FILLER                   PIC X(01) VALUE '/'.
  10 WS-DOB-CC                PIC 9(02) VALUE ZEROES.
  10 WS-DOB-YY                PIC 9(02) VALUE ZEROES.


10 WS-XRF-PER-DOB-FD        PIC X(10) VALUE SPACES.


IF WS-DOB-MM > 0
  AND WS-DOB-DD > 0
    MOVE WS-FORMAT-DOB TO WS-XRF-PER-DOB-FD <---- ERROR
ELSE
  MOVE '01/01/0001'    TO WS-XRF-PER-DOB-FD
END-IF

IBM Enterprise COBOL for z/OS  4.2.0

IGYOP3091-W Code from "MOVE (line 1836.01)" to "MOVE (line 1836.01)" can never be executed and was therefore discarded.

I have tried various attempts on this if statement and I still get the same
error, anyone have a solutition.??
[/code]
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Fri Oct 08, 2010 10:21 pm
Reply with quote

Have you ever moved anything to WS-DOB-MM, WS-DOB-DD, or WS-FORMAT-DOB?
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


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

PostPosted: Fri Oct 08, 2010 10:22 pm
Reply with quote

You have two MOVE's, but have not shown the compiler line numbers, so we cannot know which the compiler has flagged.

Also need code statically preceding this code.

The (smart, eh?) compiler "knows" the value of variables that are hard-coded statically before your IF, so it knows that one of these tests has to fail.

Please provide the additional info.
Back to top
View user's profile Send private message
Mickeydusaor

Active User


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

PostPosted: Fri Oct 08, 2010 11:01 pm
Reply with quote

Code:
05 WS-UNFORMAT-DOB            PIC 9(06) VALUE ZEROES.


MOVE DATE-BRTH-OBLO       TO WS-UNFORMAT-DOB
MOVE WS-UNFORMAT-DOB(5:2) TO WS-DOB-DD
MOVE WS-UNFORMAT-DOB(3:2) TO WS-DOB-MM
MOVE WS-UNFORMAT-DOB(1:2) TO WS-DOB-YY

IF WS-DOB-YY > WSSUT13W-DATE-CURR6-YY
  MOVE 19 TO WS-DOB-CC
ELSE
  MOVE 20 TO WS-DOB-CC
END-IF


this is the code just before the if statement.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Fri Oct 08, 2010 11:03 pm
Reply with quote

Mickey,

You're moving a group to an elementary item belonging to this same group.

Try making ===> WS-XRF-PER-DOB-FD an 05 level (same as the group level), defining it outside of the group.

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

Active User


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

PostPosted: Fri Oct 08, 2010 11:04 pm
Reply with quote

Phil, if you look at the if statement I have marked the line with the
error with <---- ERROR


Code:
IF WS-DOB-MM > 0
  AND WS-DOB-DD > 0
    MOVE WS-FORMAT-DOB TO WS-XRF-PER-DOB-FD <---- ERROR
ELSE
  MOVE '01/01/0001'    TO WS-XRF-PER-DOB-FD
END-IF
Back to top
View user's profile Send private message
Mickeydusaor

Active User


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

PostPosted: Fri Oct 08, 2010 11:06 pm
Reply with quote

Bill,

Thanks that was the exact problem and I never thought about that
as being the issue. Once again many thanks..
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


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

PostPosted: Fri Oct 08, 2010 11:08 pm
Reply with quote

Hadn't noticed that - good catch.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Sat Oct 09, 2010 12:27 am
Reply with quote

Mickey,

Delving into some of these COBOL "Nuances", it makes me curious if -

Code:

MOVE WS-FORMAT-DOB (1:8) TO WS-XRF-PER-DOB-FD (1:)

Would work, leaving WS-XRF-PER-DOB-FD as a level 10 (still part of the group)?

The COBOL compiler may generate an MVCL (what a waste of cycles) and perhaps that's why it would work and boggle the mind!

Just a SWAG on my part....

Bill
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 Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts C Compile time time stamps Java & MQSeries 10
Search our Forums:

Back to Top