20 pts.
 SET verb in COBOL
Hi The SET verb in COBOL set the value of a particular variable to a specified value. Now say I decalred a variable as 05 WS-SWITCH PIC X(01). 88 VALID-VALUES VALUE 'A', 'B', 'C'. 88 NOT-VALID-VALUES VALUE 'D', 'E', 'F'. If I want to set the value of WS-SWITCH as 'A', we can do as SET VALID-VALUES TO TRUE. however, I do not know any way in which I can set the value of WS-SWITCH as 'B' or say 'E'. Can anyone please suggest how i can accomplish this in COBOL?

Software/Hardware used:
ASKED: December 1, 2005  3:36 AM
UPDATED: December 3, 2005  4:29 PM

Answer Wiki:
This may seem too easy, but how about SET WS-SWITCH TO 'B'. -- Sheldon Linker Linker Systems, Inc. www.linkersystems.com sol@linker.com 800-315-1174 +1-949-552-1904
Last Wiki Answer Submitted:  December 1, 2005  4:00 am  by  SheldonLinker   15 pts.
All Answer Wiki Contributors:  SheldonLinker   15 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Or maybe even move “B” to WS-Switch.

 0 pts.

 

or add a new 88-level such as:

88 WS-B-VALUE VALUE ‘B’.

Then do:

SET WS-B-VALUE TO TRUE

The simplest way (as stated by msutherland) would be:

MOVE ‘B’ TO WS-SWITCH

I don’t think:

SET WS-SWITCH TO ‘B’

is valid syntax for COBOL/400

 0 pts.

 

05 WS-SWITCH PIC X(01).
88 VALID-VALUES VALUE ‘A’, ‘B’, ‘C’.
88 A-VALUE VALUE ‘A’.
88 B-VALUE VALUE ‘B’.
88 C-VALUE VALUE ‘C’.

88 NOT-VALID-VALUES VALUE ‘D’, ‘E’, ‘F’.
88 D-VALUE VALUE ‘D’.
88 E-VALUE VALUE ‘E’.
88 F-VALUE VALUE ‘F’.

Create an individual 88 level for each value you want to work with and still retain your original conditionals.

Set B-Value to TRUE. …

Or like a previous reply simply MOVE ‘B’ TO WS-SWITCH.

 0 pts.