You said, "It isn't boolean; everything in REXX is a character string." I agree that "it's all strings", but not that "everything in REXX is a *character* string." Try the following: ARG DEBUG IF ABBREV(DEBUG,D,1) THEN , TRACE I SIGNAL ON SYNTAX NAME ERROR0 TRUE = 1 SAY 'TRUE NUMERIC = 'TRUE SAY 'DATATYPE TRUE = 'DATATYPE(TRUE) IF ¬TRUE THEN SAY 'NOT TRUE NUMERIC' IF TRUE THEN SAY 'YES, TRUE NUMERIC'
ERROR0: SIGNAL ON SYNTAX NAME ERROR1 TRUE = '1' SAY 'TRUE CHARACTER = 'TRUE SAY 'DATATYPE TRUE = 'DATATYPE(TRUE) IF ¬TRUE THEN SAY 'NOT TRUE CHARACTER' IF TRUE THEN SAY 'YES, TRUE CHARACTER' ERROR1: SIGNAL ON SYNTAX NAME ERROR2 TRUE = '31'X SAY 'TRUE HEXADECIMAL = 'TRUE SAY 'DATATYPE TRUE = 'DATATYPE(TRUE) IF ¬TRUE THEN SAY 'NOT TRUE HEXADECIMAL' IF TRUE THEN SAY 'YES, TRUE HEXADECIMAL' TRUE = '00110001'B SAY 'TRUE BINARY HEX = 'TRUE SAY 'DATATYPE TRUE = 'DATATYPE(TRUE) IF ¬TRUE THEN SAY 'NOT TRUE BINARY HEX' IF TRUE THEN SAY 'YES, TRUE BINARY HEX' TRUE = '00000001'B SAY 'TRUE BINARY ONLY = 'TRUE SAY 'DATATYPE TRUE = 'DATATYPE(TRUE) IF ¬TRUE THEN SAY 'NOT TRUE BINARY ONLY' IF TRUE THEN SAY 'YES, TRUE BINARY ONLY' ERROR2: SIGNAL ON SYNTAX NAME ERROR3 TRUE = '1'B SAY 'TRUE BINARY BIT = 'TRUE SAY 'DATATYPE TRUE = 'DATATYPE(TRUE) IF ¬TRUE THEN SAY 'NOT TRUE BINARY BIT' IF TRUE THEN SAY 'YES, TRUE BINARY BIT' ERROR3: EXIT 0 ... which produces output: TRUE NUMERIC = 1 DATATYPE TRUE = NUM YES, TRUE NUMERIC TRUE CHARACTER = 1 DATATYPE TRUE = NUM YES, TRUE CHARACTER TRUE HEXADECIMAL = 1 DATATYPE TRUE = NUM YES, TRUE HEXADECIMAL TRUE BINARY HEX = 1 DATATYPE TRUE = NUM YES, TRUE BINARY HEX TRUE BINARY ONLY = ? <-- DATATYPE TRUE = CHAR <-- TRUE BINARY BIT = ? <-- DATATYPE TRUE = CHAR <-- PRESS ANY KEY TO CONTINUE. On 08/09/2020 02:44, Seymour J Metz wrote: > No. REXX has built in functions to test the value of a string, but it's all > strings > > foo =01 > bar = '01' > baz = 0||1 > > all yield the same value, > > shmuel@linux-gn5l:~> rexxtry > /usr/local/bin/rexxtry lets you interactively try REXX statements. > Each string is executed when you hit Enter. > Enter 'call tell' for a description of the features. > Go on - try a few... Enter 'exit' to end. > say datatype(01) > NUM > .................................... /usr/local/bin/rexxtry on LINUX > say datatype('01') > NUM > .................................... /usr/local/bin/rexxtry on LINUX > say datatype(0||1) > NUM > > > > > > > -- > Shmuel (Seymour J.) Metz > http://mason.gmu.edu/~smetz3 > > > ________________________________________ > From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of > CM Poncelet <ponce...@bcs.org.uk> > Sent: Monday, September 7, 2020 9:30 PM > To: IBM-MAIN@LISTSERV.UA.EDU > Subject: Re: REXX true/false (was Constant Identifiers) > > No, REXX has both DATATYPE CHAR and NUM strings. > > Meanwhile C2D, D2X etc. would be useless if REXX could not then process > binary data - as in IPCS REXX: > ADDRESS IPCS > PSA_ADDRESS = '00000000' > "EVALUATE" PSA_ADDRESS||. , > "POSITION("X2D(224)") LENGTH(4) REXX(STORAGE(OLD_ASCB_ADDRESS))" > "EVALUATE" OLD_ASCB_ADDRESS||. , > "POSITION("X2D(6C)") LENGTH(4) REXX(STORAGE(OLD_ASXB_ADDRESS))" > "EVALUATE" OLD_ASXB_ADDRESS||. , > "POSITION("X2D(4)") LENGTH(4) REXX(STORAGE(TCB_CHAIN_START_ADDRESS))" > "EVALUATE" OLD_ASXB_ADDRESS||. , > "POSITION("X2D(8)") LENGTH(4) REXX(STORAGE(TCB_CHAIN_STOP_ADDRESS))" > <etc.> > > My mistake was to think that setting a variable to a quoted value, in > REXX, made that variable a type CHAR. But REXX considers it to be NUM if > it contains only numerics, regardless of whether its set value was > quoted or not. The oddity is that '00000001'b etc. has DATATYPE CHAR > instead of NUM in REXX. This would not happen in Fortran (type logical) > or PL/I (DCL bit) or even COBOL (level-77 or -88, whatever it is). > > > > On 07/09/2020 06:52, Seymour J Metz wrote: >> It isn't boolean; everything in REXX is a character string. >> >> >> -- >> Shmuel (Seymour J.) Metz >> http://mason.gmu.edu/~smetz3 >> >> >> ________________________________________ >> From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of >> CM Poncelet <ponce...@bcs.org.uk> >> Sent: Monday, September 7, 2020 1:30 AM >> To: IBM-MAIN@LISTSERV.UA.EDU >> Subject: Re: REXX true/false (was Constant Identifiers) >> >> "ELSE IF ¬TRUE THEN <whatever else>" was just to demonstrate that "TRUE" is >> Boolean. >> >> >> >> On 07/09/2020 05:24, Seymour J Metz wrote: >>> First, that code is highly obfuscated. Why would you ever want to write "IF >>> foo & TRUE" instead of "IF foo"? >>> >>> Second, "ELSE IF ¬TRUE THEN foo" is dead code. >>> >>> Third, there are no booleans in REXX; the only data type is character >>> string. >>> >>> >>> -- >>> Shmuel (Seymour J.) Metz >>> http://mason.gmu.edu/~smetz3 >>> >>> >>> ________________________________________ >>> From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of >>> CM Poncelet <ponce...@bcs.org.uk> >>> Sent: Sunday, September 6, 2020 9:31 PM >>> To: IBM-MAIN@LISTSERV.UA.EDU >>> Subject: Re: REXX true/false (was Constant Identifiers) >>> >>> In the following example, >>> TRUE = (1 - 1 = 0 & 1 ¬= 0) [or whatever is more appropriate], >>> it is then sufficient e.g. to code: >>> IF 4 ¬= 6 & TRUE THEN <whatever> >>> ELSE IF ¬TRUE THEN <whatever else> >>> >>> I.e. TRUE can be defined as a Boolean '1'b in REXX, as per above. >>> >>> On 06/09/2020 20:43, Paul Gilmartin wrote: >>>> On Sun, 6 Sep 2020 12:03:18 -0400, scott Ford wrote: >>>> >>>>> I have done things like true =‘Y’ and then >>>>> >>>>> If true >>>>> .......... >>>>> end >>>>> >>>> What language? That would certainly be a syntax error in Rexx. >>>> And why? You could just omit the "if true" and code: >>>> do >>>> .......... >>>> end >>>> >>>> >>>> n Sun, 6 Sep 2020 17:39:48 +0000, Seymour J Metz wrote: >>>>> A simple true=1;false=0 should suffice for clarity. >>>>> >>>> Perhaps not to someone most familiar with shell scripts >>>> where the definitions are nearly the opposite (command >>>> status ($?) = 0 means success or true). >>>> >>>> >>>> On Sun, 6 Sep 2020 17:43:04 +0100, Rupert Reynolds wrote: >>>>> The advantage of Boolean is clarity in something like:- >>>>> /* Rexx */ >>>>> TRUE = (1=1) >>>>> ... >>>>> SELECT >>>>> WHEN logmode = "D4A32782" & (GotASCII & GotVBMrecord) THEN do >>>>> ... >>>> Continuing your example, how would you have set the variables >>>> "GotASCII" and "GotVBMrecord" using the quasi-constants TRUE >>>> and FALSE? Does that enhance either clarity or economy of >>>> expression? >>>> >>>> I'm thinking that something like: >>>> if filetype=='ASCII' then GotASCII = TRUE; else GotASCII = FALSE >>>> would more succinctly be written: >>>> GotASCII = ( filetype=='ASCII' ) >>>> >>>> But I've seen even worse, such as: >>>> if GotASCII = true then ... >>>> rather than simply: >>>> if GotASCII then ... >>>> >>>> >>>> On Sun, 6 Sep 2020 19:28:11 +0000, Seymour J Metz wrote: >>>>> Yes, you can count on the truth values of 0 and 1 in REXX never changing. >>>>> >>>> Only if I spent $60 for the ANSI Standard .pdf >>>> >>>> -- gil >>>> >>>> ---------------------------------------------------------------------- >>>> For IBM-MAIN subscribe / signoff / archive access instructions, >>>> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN >>>> . >>>> >>> ---------------------------------------------------------------------- >>> For IBM-MAIN subscribe / signoff / archive access instructions, >>> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN >>> >>> ---------------------------------------------------------------------- >>> For IBM-MAIN subscribe / signoff / archive access instructions, >>> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN >>> . >>> >> ---------------------------------------------------------------------- >> For IBM-MAIN subscribe / signoff / archive access instructions, >> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN >> >> ---------------------------------------------------------------------- >> For IBM-MAIN subscribe / signoff / archive access instructions, >> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN >> . >> > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN > . > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN