Jump to content

COBOL logic issue

Matthew Waring
Go to solution Solved by Matthew Waring,
On 12/21/2018 at 9:38 AM, Dat Guy said:

Tried GO TO?

 

On 12/22/2018 at 12:03 AM, Tadiaush said:

Hi!

 

after IF condition try to add GoBack.

 

but I would add a Flag indicator:

01 WS-if-correct-FLAG   PIC X VALUE ‘T’.

      88 WS-if-correct  Pic x value ‘t’.

      88 ws-if-correct-false pic x value ‘f’. 

 

Then after the if condition set this flag to true - SET WS-IF-CORRECT TO TRUE

And with others if condition check this flag. (If you are not using else) 

Hi guys, sorry for the late reply... been rather busy. I managed to fix it by using a GO TO which took me to the end of the section so that it would do not more processing.

I am trying to create a program but I am having difficulty with some logic. I am looking for a command that once a condition is met, it will then exit the section and carry on instead of going through the other IF statements. Example being:

image.png.0779aa5e18d803b20b7331dfc89baafc.png

Link to comment
Share on other sites

Link to post
Share on other sites

Hi!

 

after IF condition try to add GoBack.

 

but I would add a Flag indicator:

01 WS-if-correct-FLAG   PIC X VALUE ‘T’.

      88 WS-if-correct  Pic x value ‘t’.

      88 ws-if-correct-false pic x value ‘f’. 

 

Then after the if condition set this flag to true - SET WS-IF-CORRECT TO TRUE

And with others if condition check this flag. (If you are not using else) 

Link to comment
Share on other sites

Link to post
Share on other sites

  • 3 weeks later...
On 12/21/2018 at 9:38 AM, Dat Guy said:

Tried GO TO?

 

On 12/22/2018 at 12:03 AM, Tadiaush said:

Hi!

 

after IF condition try to add GoBack.

 

but I would add a Flag indicator:

01 WS-if-correct-FLAG   PIC X VALUE ‘T’.

      88 WS-if-correct  Pic x value ‘t’.

      88 ws-if-correct-false pic x value ‘f’. 

 

Then after the if condition set this flag to true - SET WS-IF-CORRECT TO TRUE

And with others if condition check this flag. (If you are not using else) 

Hi guys, sorry for the late reply... been rather busy. I managed to fix it by using a GO TO which took me to the end of the section so that it would do not more processing.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×