This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROCEDURE DIVISION. | |
CALCULATOR-ROUTINE. | |
DISPLAY "COBOL CALCULATOR" LINE 4 POSITION 10 ERASE SCREEN. | |
PERFORM ACCEPT-NUM1. | |
PERFORM ACCEPT-OPERATOR THRU ACCEPT-OPERATOR-EXIT. | |
PERFORM ACCEPT-NUM2. | |
IF OPERATOR = "+" | |
ADD NUM1, NUM2 GIVING RESULT. | |
IF OPERATOR = "-" | |
SUBTRACT NUM2 FROM NUM1 GIVING RESULT. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WORKING-STORAGE SECTION. | |
01 WS-CCYYMMDD PIC X(8). | |
01 WS-YYMMDD PIC X(6). | |
01 WS-DATE-IN PIC X(8). | |
01 WS-DATE-IN-NUM REDEFINES WS-DATE-IN PIC 9(8). | |
01 WS-DATE-OUT. | |
05 WS-DATE-OUT-CC PIC XX. | |
05 WS-DATE-OUT-YY PIC XX. | |
05 WS-DATE-OUT-MM PIC XX. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
READ INPUT-FILE AT END | |
GO TO ALL-DONE. | |
IF INPUT-RECORD (1:17) = "FIRST17CHARACTERS" | |
STOP "RIGHT HERE". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WORKING-STORAGE SECTION. | |
01 LONG-FIELD PIC X(20). | |
01 ZIP-CODE PIC X(5). | |
01 LEADING-CTR PIC 99 VALUE 0. | |
01 TRAILING-CTR PIC 99 VALUE 0. | |
01 SPACE-CTR PIC 99 VALUE 0. | |
01 POPULATED PIC 99 VALUE 0. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CONVERT-EMPLOYEE-NAME. | |
INSPECT EMPLOYEE-NAME CONVERTING "abcdefghijklmnopqrstuvwxyz" | |
TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSPECT PART_NUMBER REPLACING ALL "*" BY "-". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MOVE 0 TO CTR. | |
INSPECT TEXT-FIELD TALLYING CTR FOR ALL LEADING ZEROES. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSPECT PART-NUMBER REPLACING INTIAL "*" BY "-". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MOVE 0 TO CTR. | |
INSPECT TEXT-FIELD TALLYING CTR FOR ALL ZEROES. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSPECT FRUSTRATION REPLACING INITIAL "U" BY "A". |