Logo

Programming-Idioms

History of Idiom 110 > diff from v44 to v45

Edit summary for version 45 by Roie8:
[Cobol] fix

Version 44

2019-09-27, 21:12:58

Version 45

2019-09-27, 21:39:30

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. reverse 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 = ' '
       SET BLANK     TO TRUE
    ELSE
       SET NOT-BLANK TO TRUE
    END-IF 	 	
STOP RUN.