Can we use false syntax with set keyword



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

Can we use false syntax with set keyword

Postby arya_starc » Mon May 09, 2016 2:18 pm


 DATA DIVISION.                                      
 FILE SECTION.                                      
*                                                    
 WORKING-STORAGE SECTION.                            
 01  WS-VATATAR-STATUS       PIC X     VALUE 'N'.    
     88 VATATAR-STATUS       VALUE 'Y'.              
*                                                    
 PROCEDURE DIVISION.                                
     SET VATATAR-STATUS TO FALSE                                  
         DISPLAY 'ST2:' WS-VATATAR-STATUS                        
        STOP RUN.                                                
 
arya_starc
 
Posts: 136
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

Re: Can we use false syntax with set keyword

Postby Aki88 » Mon May 09, 2016 2:53 pm

Hello,

And what happened when you tried to compile the below code piece? Did you get a compilation error for the 'FALSE' keyword?

Also, from the good old COBOL Language Reference:
Format 4: SET for condition-names
When this form of the SET statement is executed, the value associated with a
condition-name is placed in its conditional variable according to the rules of the
VALUE clause.

Format 4: SET statement for condition-names

SET  condition-name-1 TO TRUE 
condition-name-1
Must be associated with a conditional variable.


If more than one literal is specified in the VALUE clause of condition-name-1, its
associated conditional variable is set equal to the first literal.
If multiple condition-names are specified, the results are the same as if a separate
SET statement had been written for each condition-name in the same order in
which they are specified in the SET statement.
Aki88
 
Posts: 381
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times

Re: Can we use false syntax with set keyword

Postby arya_starc » Mon May 09, 2016 3:07 pm

yes i got a error message on using false syntax. below in the message
IGYPS2106-S "FALSE" WAS FOUND IN THE "SET" STATEMENT. IT WAS NOT ALLOWED IN THIS CONTEXT. THE STATEMENT WAS DISCARDED.
arya_starc
 
Posts: 136
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

Re: Can we use false syntax with set keyword

Postby Aki88 » Mon May 09, 2016 3:28 pm

arya_starc wrote:yes i got a error message on using false syntax. below in the message
IGYPS2106-S "FALSE" WAS FOUND IN THE "SET" STATEMENT. IT WAS NOT ALLOWED IN THIS CONTEXT. THE STATEMENT WAS DISCARDED.


As you can see, the compilation error message is self-explanatory; for further reading, refer the COBOL Language Reference snippet I'd posted earlier. That should explain why only TRUE is allowed.

Emphasis on the portion that says:

When this form of the SET statement is executed, the value associated with a
condition-name is placed in its conditional variable
according to the rules of the
VALUE clause.


In simpler terms, if you do not use 'SET - TRUE', then the group variable for the 88th level variable will not hold the value passed by the 88th level variable.
Aki88
 
Posts: 381
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times

Re: Can we use false syntax with set keyword

Postby BillyBoyo » Mon May 09, 2016 5:28 pm

Enterprise COBOL does not, yet, support FALSE. There are other COBOL compilers which do.

It would be a useful addition. You can consider raising an RFE (Request For Enhancement) at https://www.ibm.com/developerworks/rfe/

IBM are keen to know what features from the COBOL 2002/2014 Standard people would find useful, so that they can schedule enhancements for future releases of Enterprise COBOL. This is an RFE which I thing would be very popular.

At the moment the general technique is to define two 88-levels, the "off" one setting to a value which does not exist in the "on".
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Can we use false syntax with set keyword

Postby arya_starc » Mon May 09, 2016 10:56 pm

BillyBoyo wrote:Enterprise COBOL does not, yet, support FALSE. There are other COBOL compilers which do.

It would be a useful addition. You can consider raising an RFE (Request For Enhancement) at https://www.ibm.com/developerworks/rfe/

IBM are keen to know what features from the COBOL 2002/2014 Standard people would find useful, so that they can schedule enhancements for future releases of Enterprise COBOL. This is an RFE which I thing would be very popular.

At the moment the general technique is to define two 88-levels, the "off" one setting to a value which does not exist in the "on".


Thanks billy for the link i tries to raise RFE but in registration they asking for the IBMer id and i am non-ibmer, i am not able to raise the RFE.
arya_starc
 
Posts: 136
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

Re: Can we use false syntax with set keyword

Postby enrico-sorichetti » Tue May 10, 2016 12:50 am

Thanks billy for the link i tries to raise RFE but in registration they asking for the IBMer id and i am non-ibmer, i am not able to raise the RFE.


anybody can register on the IBM site,
You have to do it in order to download the manuals, and to vote on a RFE
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Can we use false syntax with set keyword

Postby BillyBoyo » Tue May 10, 2016 3:28 am

Yes, sorry. forgot to mention the IBM ID. It is simple, painless and free to register. There's other interesting stuff at the Developerworks generally as well.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post