Since I'm retired and have time to fool around with this, I got on PUB400 and tried the following:

CREATE TABLE PCDOW1/TESTB
 (B  BOOLEAN NOT NULL WITH DEFAULT
, C  CHAR(5) NOT NULL WITH DEFAULT
, C1 CHAR(1) NOT NULL WITH DEFAULT
, C2 CHAR(2) NOT NULL WITH DEFAULT
, C3 CHAR(3) NOT NULL WITH DEFAULT
, C4 CHAR(4) NOT NULL WITH DEFAULT
, C5 CHAR(5) NOT NULL WITH DEFAULT
, N  INT     NOT NULL WITH DEFAULT)

which DSPFFD PCDOW1/TESTB shows as

           Data        Field  Buffer    Buffer        Field Column
Field      Type       Length  Length  Position        Usage Heading
B          BOOLEAN         1       1         1        Both     B
C          CHAR            5       5         2        Both     C
  Coded Character Set Identifier  . . . . . :    273
C1         CHAR            1       1         7        Both     C1
  Coded Character Set Identifier  . . . . . :    273
C2         CHAR            2       2         8        Both     C2
  Coded Character Set Identifier  . . . . . :    273
C3         CHAR            3       3        10        Both     C3
  Coded Character Set Identifier  . . . . . :    273
C4         CHAR            4       4        13        Both     C4
  Coded Character Set Identifier  . . . . . :    273
C5         CHAR            5       5        17        Both     C5
  Coded Character Set Identifier  . . . . . :    273
N          BINARY       9  0       4        22        Both     N



INSERT INTO PCDOW1/TESTB (B, C) VALUES
  (on, 'on')
, (off, 'off')
, (true, 'true')
, (false, 'false')
, ('0', '''0''')
, ('1', '''1''')
, ('yes', '''yes''')
, ('no', '''no''')
, ('T', '''T''')
, ('F', '''F''')
, ('t', '''t''')
, ('f', '''f''')


SELECT * FROM PCDOW1/TESTB

 ....+....1....+....2....+....3....+....4....+....5
 B  C      C1  C2  C3   C4    C5                 N
 1  on                                           0
 0  off                                          0
 1  true                                         0
 0  false                                        0
 0  '0'                                          0
 1  '1'                                          0
 1  'yes'                                        0
 0  'no'                                         0
 1  'T'                                          0
 0  'F'                                          0
 1  't'                                          0
 0  'f'                                          0
 ********  End of data  ********

UPDATE PCDOW1/TESTB
SET C1 = B
   ,C2 = B
   ,C3 = B
   ,C4 = B
   ,C5 = B
   ,N  = B
Value for column or variable C1 too long.

UPDATE PCDOW1/TESTB
SET C2 = B
   ,C3 = B
   ,C4 = B
   ,C5 = B
   ,N  = B
Value for column or variable C2 too long.

UPDATE PCDOW1/TESTB
SET C3 = B
   ,C4 = B
   ,C5 = B
   ,N  = B
Value for column or variable C3 too long.

UPDATE PCDOW1/TESTB
SET C4 = B
   ,C5 = B
   ,N  = B
Value for column or variable C4 too long.

UPDATE PCDOW1/TESTB
SET C5 = B
   ,N  = B
12 rows updated in TESTB in PCDOW1.

SELECT * FROM PCDOW1/TESTB

....+....1....+....2....+....3....+....4....+....5
B  C      C1  C2  C3   C4    C5                 N
1  on                  TRUE  TRUE               1
0  off                       FALSE              0
1  true                      TRUE               1
0  false                     FALSE              0
0  '0'                       FALSE              0
1  '1'                       TRUE               1
1  'yes'                     TRUE               1
0  'no'                      FALSE              0
1  'T'                       TRUE               1
0  'F'                       FALSE              0
1  't'                       TRUE               1
0  'f'                       FALSE              0
********  End of data  ********


I find it interesting that you cannot set a CHAR(<4) field to the value of a BOOLEAN field. And you can set a CHAR(4) field to the value of a BOOLEAN field as long as the value of the BOOLEAN field is TRUE, but not if it's FALSE.  The actual value of the BOOLEAN field is either '0' or '1', which makes sense to an RPG programmer, given that the size of the field is 1 byte.

--
*Peter Dow* /
909 793-9050
petercdow@xxxxxxxxx
/

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2026 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.