Logo

Programming-Idioms

History of Idiom 110 > diff from v67 to v68

Edit summary for version 68 by testee:
[Cobol] test

Version 67

2021-08-19, 09:06:27

Version 68

2021-08-30, 20:54:55

Idiom #110 Check if string is blank

Set boolean blank to true if string s is empty, or null, or contains only whitespace ; false otherwise.

Idiom #110 Check if string is blank

Set boolean blank to true if string s is empty, or null, or contains only whitespace ; false otherwise.

Code
IDENTIFICATION DIVISION.
PROGRAM-ID. blank string.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 BOOLEAN-BLANK     PIC X.
   88 BLANK          VALUE "T".
   88 NOT-BLANK      VALUE "F".
PROCEDURE DIVISION.
    IF s = ' '
       SET BLANK     TO TRUE
    ELSE
       SET NOT-BLANK TO TRUE
    END-IF 	 	
STOP RUN.
Code
IDENTIFICATION DIVISION.
PROGRAM-ID. blank string.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 BOOLEAN-BLANK     PIC X.
   88 BLANK          VALUE "T".
   88 NOT-BLANK      VALUE "F".
PROCEDURE DIVISION.
    IF s > SPACES
       SET BLANK     TO TRUE
    ELSE
       SET NOT-BLANK TO TRUE
    END-IF 	 	
STOP RUN.