Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
identification division.
program-id. unstring-fields.
data division.
working-storage section.
01 binary.
02 I PIC S9(4).
02 J PIC S9(4).
01 the-delimiter PIC X(3).
01 INPUT-FIELD PIC X(123) VALUE
'Bill Smith,"444-55-6666",999999999,1234567,"$1,060.46 "'.
78 INPUT-FIELD-SIZE value LENGTH OF INPUT-FIELD.
01 .
02 OCCURS 40.
03 FIELD-HOLDER PIC X(50).
03 FIELD-LENGTH PIC 9(4).
procedure division.
a.
MOVE 1 to I.
MOVE 1 TO J.
PERFORM UNTIL I > INPUT-FIELD-SIZE
INSPECT INPUT-FIELD (I:) TALLYING I FOR LEADING SPACE
IF I NOT > INPUT-FIELD-SIZE
EVALUATE INPUT-FIELD (I:1)
WHEN '"'
ADD 1 TO I
IF I NOT > INPUT-FIELD-SIZE
UNSTRING INPUT-FIELD
DELIMITED BY '",' OR '"'
INTO FIELD-HOLDER (J)
DELIMITER IN THE-DELIMITER
COUNT IN FIELD-LENGTH (J)
POINTER I
END-UNSTRING
ADD 1 to J
END-IF
WHEN OTHER
UNSTRING INPUT-FIELD DELIMITED BY ","
INTO FIELD-HOLDER (J)
DELIMITER IN THE-DELIMITER
COUNT IN FIELD-LENGTH (J)
POINTER I
END-UNSTRING
ADD 1 to J
END-EVALUATE
END-IF
END-PERFORM.
SUBTRACT 1 FROM J.
stop run.