Cobol /36 – Splitten von Zeichenketten

0001.00 DATA DIVISION.
0002.00
0003.00 WORKING-STORAGE SECTION.
0004.00
0005.00 01 SEARCHTEXT PIC X(30) VALUE ‘2408410-916-10F1A06AJ’.
0006.00 01 SEARCHVAL PIC X(1) VALUE ‘O’.
0007.00 01 SUBSTRING1 PIC X(30) VALUE SPACE.
0008.00 01 SUBSTRING2 PIC X(30) VALUE SPACE.
0009.00 01 SUBSTRING3 PIC X(30) VALUE SPACE.
0010.00 01 COUNTER PIC 9(1) VALUE 0.
0011.00
0012.00 PROCEDURE DIVISION.
0013.00
0014.00 PERFORM COUNT-IT THRU COUNT-IT-ENDE.
0015.00 STOP RUN.
0016.00
0017.00 COUNT-IT.
0018.00 UNSTRING SEARCHTEXT DELIMITED BY ALL SEARCHVAL
0019.00 INTO SUBSTRING1
0020.00 SUBSTRING2
0021.00 SUBSTRING3
0022.00 TALLYING IN COUNTER.
0023.00
0024.00 IF SUBSTRING1 = SEARCHTEXT
025.00 DISPLAY ‘KEINE ÜBEREINSTIMMUNG’.
0026.00
0027.00 IF COUNTER < 3 OR COUNTER > 3
0028.00 DISPLAY ‘FORMATFEHLER’.
0029.00
0030.00 DISPLAY SUBSTRING1.
0031.00 DISPLAY SUBSTRING2.
0032.00 DISPLAY SUBSTRING3.
0033.00 DISPLAY COUNTER.
0034.00 COUNT-IT-ENDE. EXIT.

Cobol /36 – Splitten von Zeichenketten

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s