Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
compile error on conditional if and move

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: compile error on conditional if and move
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: 8189
Location: East Dubuque, Illinois, USA

PostPosted: Fri Oct 08, 2010 10:21 pm    Post subject:
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

Active Member


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

PostPosted: Fri Oct 08, 2010 10:22 pm    Post subject:
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    Post subject:
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: 2504
Location: Atlanta, Georgia, USA

PostPosted: Fri Oct 08, 2010 11:03 pm    Post subject: Reply to: compile error on conditional if and move
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    Post subject:
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    Post subject:
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

Active Member


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

PostPosted: Fri Oct 08, 2010 11:08 pm    Post subject:
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: 2504
Location: Atlanta, Georgia, USA

PostPosted: Sat Oct 09, 2010 12:27 am    Post subject: Reply to: compile error on conditional if and move
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    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 CONDITIONAL USING COMP-2 WITH PROBLEMS. JOSUEGENTIL COBOL Programming 7 Wed Nov 08, 2017 11:13 pm
No new posts how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am
No new posts Move from Comp3 variable to Edited Va... Revathy.nair0485 COBOL Programming 7 Fri Nov 03, 2017 3:30 pm
No new posts -502 Error - Cursor already open anand jeyapaul DB2 7 Sun Oct 29, 2017 4:22 am
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us