SET verb in COBOL

20 pts.
Tags:
AS/400
CLP
IBM DB2
RPG
RPGLE
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?

Answer Wiki

Thanks. We'll let you know when a new response is added.

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

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Msutherland
    Or maybe even move "B" to WS-Switch.
    0 pointsBadges:
    report
  • TheQuigs
    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 pointsBadges:
    report
  • Happyjoe
    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 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following