Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ******************************************************************
- * Author: Sezen
- * Date: 12/30/2019
- * Purpose: Pseudo-English word generator
- ******************************************************************
- * Returns:
- * THEOME
- * HATER
- * ONSE
- * THEATH
- * ATYS
- * INOPYS
- * RIITH
- * TOOPING
- * THEITY
- * HATTERYS
- ******************************************************************
- IDENTIFICATION DIVISION.
- PROGRAM-ID. WORD-GEN.
- ENVIRONMENT DIVISION.
- CONFIGURATION SECTION.
- REPOSITORY.
- FUNCTION ALL INTRINSIC.
- DATA DIVISION.
- FILE SECTION.
- WORKING-STORAGE SECTION.
- 01 BLAH PIC X.
- 01 WORD PIC X(12).
- 01 NUM1 PIC 99.
- 01 NUM2 PIC 99.
- 01 RET-NUM PIC 9.
- 01 SYL-COUNT PIC 9.
- 88 TWO-SYL VALUE 2.
- 88 THREE-SYL VALUE 3.
- 01 FIRST-SYL PIC 9.
- 88 1ST-BIGRAM VALUE 1 THRU 2.
- 88 1ST-TRIGRAM VALUE 3.
- 01 MIDDLE-SYL PIC 9.
- 88 2ND-BIGRAM VALUE 1 THRU 3.
- 88 2ND-TRIGRAM VALUE 4.
- 01 LAST-SYL PIC 9.
- 88 3RD-BIGRAM VALUE 1.
- 88 3RD-TRIGRAM VALUE 2.
- 01 WS-BIGRAM.
- 05 WS-FIRST-BIGRAM VALUE 'POHEINTORERIATARLESECOON'.
- 10 WS-1-SYL PIC XX OCCURS 12 TIMES.
- 05 WS-SEC-BIGRAM VALUE 'ILOUMEOPINA E SO'.
- 10 WS-2-SYL PIC XX OCCURS 8 TIMES.
- 05 WS-END-BIGRAM VALUE 'STSETHERATEDTYYS '.
- 10 WS-3-SYL PIC XX OCCURS 8 TIMES.
- 01 WS-TRIGRAM.
- 05 WS-FIRST-TRIGRAM
- VALUE 'THETHAANDHERINTHATEVESHETHISHIBRORET'.
- 10 WS-1-TRI PIC XXX OCCURS 12 TIMES.
- 05 WS-MID-TRIGRAM VALUE 'TIOEREATIRANCATSINTER'.
- 10 WS-2-TRI PIC XXX OCCURS 8 TIMES.
- 05 WS-END-TRIGRAM VALUE 'IONINGOMEITHTERASTATHITY'.
- 10 WS-3-TRI PIC XXX OCCURS 8 TIMES.
- 01 WS-COUNT PIC 99.
- PROCEDURE DIVISION.
- MAIN-PROCEDURE.
- PERFORM UNTIL WS-COUNT = 10
- MOVE SPACES TO WORD
- MOVE 12 TO NUM1
- MOVE 1 TO NUM2
- CALL 'RNG-GEN' USING NUM1,NUM2,RET-NUM
- MOVE 3 TO NUM1
- CALL 'RNG-GEN' USING NUM1, NUM2, FIRST-SYL
- EVALUATE TRUE
- WHEN 1ST-BIGRAM
- STRING TRIM(WS-1-SYL(RET-NUM)),WORD INTO WORD
- WHEN 1ST-TRIGRAM
- STRING TRIM(WS-1-TRI(RET-NUM)),WORD INTO WORD
- END-EVALUATE
- MOVE 2.25 TO NUM1
- MOVE 2 TO NUM2
- CALL 'RNG-GEN' USING NUM1, NUM2, SYL-COUNT
- MOVE 1 TO NUM2
- EVALUATE TRUE
- WHEN TWO-SYL
- MOVE 4 TO NUM1
- MOVE 1 TO NUM2
- CALL 'RNG-GEN' USING NUM1,NUM2,MIDDLE-SYL
- MOVE 8 TO NUM1
- EVALUATE TRUE
- WHEN 2ND-BIGRAM
- CALL 'RNG-GEN' USING NUM1,NUM2,RET-NUM
- STRING TRIM(WORD),TRIM(WS-3-SYL(RET-NUM)) INTO WORD
- WHEN 2ND-TRIGRAM
- CALL 'RNG-GEN' USING NUM1,NUM2,RET-NUM
- STRING TRIM(WORD),TRIM(WS-3-TRI(RET-NUM)) INTO WORD
- END-EVALUATE
- WHEN THREE-SYL
- MOVE 4 TO NUM1
- MOVE 1 TO NUM2
- CALL 'RNG-GEN' USING NUM1,NUM2,MIDDLE-SYL
- MOVE 8 TO NUM1
- EVALUATE TRUE
- WHEN 2ND-BIGRAM
- CALL 'RNG-GEN' USING NUM1,NUM2,RET-NUM
- STRING TRIM(WORD),TRIM(WS-2-SYL(RET-NUM)) INTO WORD
- WHEN 2ND-TRIGRAM
- CALL 'RNG-GEN' USING NUM1,NUM2,RET-NUM
- STRING TRIM(WORD),TRIM(WS-2-TRI(RET-NUM)) INTO WORD
- END-EVALUATE
- MOVE 2 TO NUM1
- CALL 'RNG-GEN' USING NUM1,NUM2,LAST-SYL
- MOVE 8 TO NUM1
- EVALUATE TRUE
- WHEN 3RD-BIGRAM
- CALL 'RNG-GEN' USING NUM1,NUM2,RET-NUM
- STRING TRIM(WORD),TRIM(WS-3-SYL(RET-NUM)) INTO WORD
- WHEN 3RD-TRIGRAM
- CALL 'RNG-GEN' USING NUM1,NUM2,RET-NUM
- STRING TRIM(WORD),TRIM(WS-3-TRI(RET-NUM)) INTO WORD
- END-EVALUATE
- END-EVALUATE
- IF FIRST-SYL = 1 OR 2 THEN
- DISPLAY WORD(3:)
- ELSE
- DISPLAY WORD(4:)
- END-IF
- ADD 1 TO WS-COUNT
- END-PERFORM.
- STOP RUN.
- *
- IDENTIFICATION DIVISION.
- PROGRAM-ID. RNG-GEN.
- DATA DIVISION.
- WORKING-STORAGE SECTION.
- 01 WS-RNG-GEN PIC 9(10).
- LINKAGE SECTION.
- 01 LS-1 PIC 99.
- 01 LS-2 PIC 99.
- 01 LS-RAND PIC 99 COMP.
- PROCEDURE DIVISION USING LS-1, LS-2, LS-RAND.
- COMPUTE WS-RNG-GEN = FUNCTION RANDOM(FUNCTION CURRENT-DATE (1
- - 5:2)) * 90000000000.
- CALL 'CBL_OC_NANOSLEEP' USING WS-RNG-GEN.
- COMPUTE LS-RAND = FUNCTION RANDOM(WS-RNG-GEN) * LS-1 + LS-2.
- COMPUTE WS-RNG-GEN = FUNCTION RANDOM(FUNCTION CURRENT-DATE (1
- - 5:2)) * 9150040200.
- CALL 'CBL_OC_NANOSLEEP' USING WS-RNG-GEN.
- .
- END PROGRAM RNG-GEN.
- END PROGRAM WORD-GEN.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement