• Subject: Re: Free format question on D specs
  • From: Barbara Morris <bmorris@xxxxxxxxxx>
  • Date: Fri, 25 Jan 2019 13:31:23 -0500
  • Arc-authentication-results: i=1; mx.google.com; spf=neutral (google.com: is neither permitted nor denied by best guess record for domain of rpg400@xxxxxxxxxxx) smtp.mailfrom=rpg400@xxxxxxxxxxx; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-language:in-reply-to:user-agent:content-transfer-encoding :mime-version:reply-to:references:message-id:organization:date :subject:from:to; bh=5GrGqn/aPtanNLiCWHJxt7HmM5w8jYfupKltTvSkfGs=; b=C/lyvX0O9QByb7YkfN3bBXiWeRT+ejWv3XcRx2QoVvwUV+4TDd1ykX3rXyvtGk4mOg uTO1IAUkbnW/2yZoO+rh3PB6TwZhQ3MP975rYYGaajnA/ejUGAskFowhQLo3k1hgrelW 6zS0PB6mC0dAZG9esEDKuNVtR1IOY9CDjydR9T9Jtjhx0DJzb+KBjyJ5O4r+ZXBQ7M3A JTZLnXqBuqDAT1UG2bgW1JdzR47auNfJX1eHJ2r0nTBB7hGHf6OKGcH2mYvCLpa9kclc hR02whVBMNYrGm6oqco3ovea5A1kAEOm8PnONNUAM4a2eFzG8fLG8Q0QmeDB2AOnEtTx xQgA==
  • Arc-seal: i=1; a=rsa-sha256; t=1548441094; cv=none; d=google.com; s=arc-20160816; b=RZrzH9+6K3acLUVvJKCsd+JY2q7tQOWeRYjkCsGCYoAgMZa5SAPn0k/KYdPdzrbRdY 1RBI8X0eUTRtVVaI2UcV4Pr0VHwLOHqRU9VGwXJS5LFdJh0CopR/34r3e8hbno9Pb0VL YJcjdMJwqSB84HGrDOawWY6CoiGTVKyKpSC/05HmRdgSUH8QQACZ+DrelsfWEiKHKnl6 7eMyzY7uuJdyX0gkmr3T2EU6RVLIzce4matYnVTYS8NCD+jGq3KRaiYKJ/IMIj7/Y4XC QBRCjvV/pJLv0kOOnB+g3iMaMcyPr8KnhmSikajYwgHmI1uUvXodalAce9BzOvTdbJ9O odHQ==
  • List-archive: <https://archive.midrange.com/rpg400-l/>
  • List-help: <mailto:rpg400-l-request@lists.midrange.com?subject=help>
  • List-id: "RPG programming on the IBM i \(AS/400 and iSeries\)" <rpg400-l.lists.midrange.com>
  • List-post: <mailto:rpg400-l@lists.midrange.com>
  • List-subscribe: <https://lists.midrange.com/mailman/listinfo/rpg400-l>, <mailto:rpg400-l-request@lists.midrange.com?subject=subscribe>
  • List-unsubscribe: <https://lists.midrange.com/mailman/options/rpg400-l>, <mailto:rpg400-l-request@lists.midrange.com?subject=unsubscribe>

On 2019-01-24 8:17 PM, Thomas Burrows wrote:
I have the following.

Dcl-s x_yes char(01);
Dcl-s x_no char(01);

How do I get x_yes set to 'Y' and x_no set to 'N';

I don't think anyone answered this part of your question yet. Use INZ.

Dcl-s x_yes char(01) inz('Y');
Dcl-s x_no char(01) inz('N');

(But I agree with others that using named constants would be best for things like these that should always have the same value.)

*shudder* I'm having a nasty flashback to some code I worked on long ago and far away that had global variables named N0 N1 N2 N3 N4 ... N100 and X1 X2 X3 ... X100, used throughout the code instead of numeric literals 0 1 2 etc, for who knows what reason. A coding error had set one of them (N1 if I recall correctly) to a new value which caused a bug that took me way too long to find. Lesson somewhat learned: Never assume that a variable contains what its name suggests.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].