Coding IF condition..



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Coding IF condition..

Postby chetan_007 » Wed Sep 09, 2009 9:44 pm

PARA-1.


.......
,.........
............

IF CONDITION

MOVE SPACES TO ...........


IF

ELSE

END-IF

IF

ELSE

END-IF


Move Statements.......

IF
.........
END-IF


IF

ELSE

END-IF


IF

ELSE

END-IF

END-IF

CONTINUE.


In the above code pattern, I need to put the IF condition (before moving spaces), so that it should skip rest of the lines and control shld move next to line after CONTINUE.

So how to code IF statement here.....

I tried with IF condition in the first line and End-if before CONTINUE....
But I'm getting error message as SCOPE TERMINATOR DISCARDED.


Plesae suggest me how to code these IF and END-IF so that it will skip all the lines in between.

IF CONTIION (If condition is statisfied, then it should skip all the lines mentioned above and control should move to next line after CONTINUE Verb).


Thanks in advance.
chetan_007
 
Posts: 24
Joined: Sun Mar 02, 2008 3:22 am
Has thanked: 0 time
Been thanked: 0 time

Re: Coding IF condition..

 

Re: Coding IF condition..

Postby dick scherrer » Thu Sep 10, 2009 12:38 am

Hello,

Describe the processing rules (i.e. what should happen and in what order). Show a bit of your actual code and the problem(s) encountered.Please post wthout all of the interleaved space lines.

Use the "Code" tag (and Preview) to create/edit your post. The Code tag preserves alignment and greatly improves readability.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Coding IF condition..

Postby Anuj Dhawan » Thu Sep 10, 2009 6:33 pm

You show us this
IF

ELSE

END-IF

IF

ELSE

END-IF
and then you ask the question
Plesae suggest me how to code these IF and END-IF so that it will skip all the lines in between.
ah...it's just too tough to suggest something from what you posted. Please post some actual code, as Dick suggested. Possibly post the compiled post which shows
SCOPE TERMINATOR DISCARDED
Anuj
Anuj Dhawan
 
Posts: 274
Joined: Mon Feb 25, 2008 3:53 am
Location: Mumbai, India
Has thanked: 6 times
Been thanked: 4 times

Re: Coding IF condition..

Postby GuyC » Fri Sep 11, 2009 1:04 pm

Probably a point still there somewhere.
in the compile listing , left of code/line number you can see the "level of nesting" something like 1122211122233321 (a number in each line).
Check if the nesting matches with what you would expect.
I can explain it to you, but i can not understand it for you.
GuyC
 
Posts: 315
Joined: Tue Aug 11, 2009 3:23 pm
Has thanked: 1 time
Been thanked: 4 times

Re: Coding IF condition..

Postby KMG » Fri Oct 30, 2009 2:39 pm

It seems that there is a period '.' somewhere in between. There should not be any period between outermost IF-ENDIF.
Further I totally agree with Anuj & Dick, please put some piece of code.
Regards, KMG
KMG
 
Posts: 3
Joined: Fri Oct 30, 2009 2:18 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Coding IF condition..

Postby Anuj Dhawan » Tue Nov 03, 2009 7:24 pm

Or go by what GuyC has suggested.
Anuj
Anuj Dhawan
 
Posts: 274
Joined: Mon Feb 25, 2008 3:53 am
Location: Mumbai, India
Has thanked: 6 times
Been thanked: 4 times

Re: Coding IF condition..

Postby ramyasree » Tue Nov 10, 2009 6:22 am

Hi ,

Make sure you don't have any full stop '.' in the IF and END-IF .

IF CONDITION

IF CONDITION
NEXT STATEMENT
ELSE
MOVE SPACES TO ...........


IF

ELSE

END-IF

IF

ELSE

END-IF


Move Statements.......

IF
.........
END-IF


IF

ELSE

END-IF


IF

ELSE

END-IF

END-IF

CONTINUE.

Next Statement takes the cursor next statement after the full stop. Hope this helps

:)
ramyasree
 
Posts: 1
Joined: Tue Nov 10, 2009 5:46 am
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post