000001 Identification Division.
000002 Program-ID. testantlr132.
000003 Data Division.
000004 Working-Storage Section.
000005 01  CONSTANTS.
000006     05  MYNAME               PIC X(012) VALUE 'testantlr132'.
000007
000008 01  SWITCHES.
000009     05  SD-001-TRUTH-SW      PIC X(008).
000010         88  SD-001-TRUTH     VALUE 'ZAPHOD'.
000011
000012* 
000013 01  SOME-DATA.
000014     05  SD-001               PIC X(008).
000015     05  SD-002.
000016         10  SD-002-A         PIC X(001).
000017         10  SD-002-B         PIC X(001).
000018     05  SD-003               PIC X(008).
000019
000020 01  WS-BUF                   PIC X(100).
000021
000022 77  WS-COUNT                 PIC 9(008) COMP-5 VALUE 0.
000023
000024 Procedure Division.
000025     DISPLAY MYNAME ' Begin'
000026     
000027     JSON GENERATE WS-BUF FROM SOME-DATA END-JSON
000028
000029     JSON GENERATE
000030         WS-BUF FROM SOME-DATA
000031         COUNT WS-COUNT
000032         NAME SD-001 'ARTHUR'
000033              SD-002 'DENT'
000034         SUPPRESS 
000035              SD-001
000036              SD-002
000037         ON EXCEPTION CALL 'CEE3ABD' END-CALL
000038         NOT ON EXCEPTION PERFORM 1000-para
000039     END-JSON
000040
000041     JSON GENERATE
000042         WS-BUF FROM SOME-DATA
000043         COUNT IN WS-COUNT
000044         NAME OF SD-001 IS 'ARTHUR'
000045                 SD-002 IS 'DENT'
000046         SUPPRESS SD-001 SD-003
000047         ON EXCEPTION CALL 'CEE3ABD' END-CALL
000048         NOT ON EXCEPTION PERFORM 1000-para
000049     END-JSON
000050
000051     JSON GENERATE
000052         WS-BUF FROM SOME-DATA
000053         COUNT IN WS-COUNT
000054         NAME OF SD-001 IS 'ARTHUR'
000055                 SD-002 IS 'DENT'
000056         SUPPRESS EVERY NUMERIC WHEN ZEROES
000057         ON EXCEPTION CALL 'CEE3ABD' END-CALL
000058         NOT ON EXCEPTION PERFORM 1000-para
000059     END-JSON
000060
000061     JSON GENERATE
000062         WS-BUF FROM SOME-DATA
000063         COUNT IN WS-COUNT
000064         NAME OF SD-001 IS 'ARTHUR'
000065                 SD-002 IS 'DENT'
000066         SUPPRESS 
000067                 EVERY NUMERIC WHEN ZEROES
000068                 EVERY NONNUMERIC WHEN SPACES
000069                 EVERY NONNUMERIC WHEN LOW-VALUES
000070                 EVERY WHEN HIGH-VALUES OR HIGH-VALUE
000071         ON EXCEPTION CALL 'CEE3ABD' END-CALL
000072         NOT ON EXCEPTION PERFORM 1000-para
000073     END-JSON
000074
000075     JSON GENERATE
000076         WS-BUF FROM SOME-DATA
000077         COUNT WS-COUNT
000078         NAME SD-001 'ARTHUR'
000079              SD-002 'DENT'
000080         SUPPRESS 
000081              SD-001 WHEN SPACES
000082              SD-002 WHEN LOW-VALUES
000083         ON EXCEPTION CALL 'CEE3ABD' END-CALL
000084         NOT ON EXCEPTION PERFORM 1000-para
000085     END-JSON
000086
000087     JSON GENERATE
000088         WS-BUF FROM SOME-DATA
000089         COUNT WS-COUNT
000090         NAME SD-001 'ARTHUR'
000091              SD-002 'DENT'
000092         SUPPRESS 
000093              SD-001
000094              SD-002
000095         CONVERTING SD-001 TO JSON BOOLEAN USING SD-001-TRUTH
000096         ON EXCEPTION CALL 'CEE3ABD' END-CALL
000097         NOT ON EXCEPTION PERFORM 1000-para
000098     END-JSON
000099
000100     JSON GENERATE
000101         WS-BUF FROM SOME-DATA
000102         COUNT WS-COUNT
000103         NAME SD-001 'ARTHUR'
000104              SD-002 'DENT'
000105         SUPPRESS 
000106              SD-001
000107              SD-002
000108         CONVERTING SD-001 JSON BOOLEAN USING SD-001-TRUTH
000109         ON EXCEPTION CALL 'CEE3ABD' END-CALL
000110         NOT ON EXCEPTION PERFORM 1000-para
000111     END-JSON
000112
000113     JSON GENERATE
000114         WS-BUF FROM SOME-DATA
000115         COUNT WS-COUNT
000116         NAME SD-001 'ARTHUR'
000117              SD-002 'DENT'
000118         SUPPRESS 
000119              SD-001
000120              SD-002
000121         CONVERTING SD-001 BOOLEAN USING SD-001-TRUTH
000122         ON EXCEPTION CALL 'CEE3ABD' END-CALL
000123         NOT ON EXCEPTION PERFORM 1000-para
000124     END-JSON
000125
000126     JSON GENERATE
000127         WS-BUF FROM SOME-DATA
000128         COUNT WS-COUNT
000129         NAME SD-001 'ARTHUR'
000130              SD-002 'DENT'
000131         SUPPRESS 
000132              SD-001
000133              SD-002
000134         CONVERTING SD-001 BOOLEAN SD-001-TRUTH
000135         ON EXCEPTION CALL 'CEE3ABD' END-CALL
000136         NOT ON EXCEPTION PERFORM 1000-para
000137     END-JSON
000138
000139     JSON GENERATE
000140         WS-BUF FROM SOME-DATA
000141         COUNT WS-COUNT
000142         NAME SD-001 'ARTHUR'
000143              SD-002 'DENT'
000144         SUPPRESS 
000145              SD-001
000146              SD-002
000147         CONVERTING SD-001 TO JSON BOOL USING SD-001-TRUTH
000148         ON EXCEPTION CALL 'CEE3ABD' END-CALL
000149         NOT ON EXCEPTION PERFORM 1000-para
000150     END-JSON
000151
000152     JSON GENERATE
000153         WS-BUF FROM SOME-DATA
000154         COUNT WS-COUNT
000155         NAME SD-001 'ARTHUR'
000156              SD-002 'DENT'
000157         SUPPRESS 
000158              SD-001
000159              SD-002
000160         CONVERTING SD-001 TO JSON BOOLEAN USING 'FPREFECT'
000161         ON EXCEPTION CALL 'CEE3ABD' END-CALL
000162         NOT ON EXCEPTION PERFORM 1000-para
000163     END-JSON
000164
000165     JSON GENERATE
000166         WS-BUF FROM SOME-DATA
000167         COUNT WS-COUNT
000168         NAME SD-001 'ARTHUR'
000169              SD-002 'DENT'
000170         SUPPRESS 
000171              SD-001
000172              SD-002
000173         CONVERTING 
000174              SD-001 TO JSON BOOLEAN USING 'FPREFECT'
000175              ALSO SD-002 BOOL '&&'
000176         ON EXCEPTION CALL 'CEE3ABD' END-CALL
000177         NOT ON EXCEPTION PERFORM 1000-para
000178     END-JSON
000179
000180
000181     DISPLAY MYNAME ' End'
000182     
000183     GOBACK
000184     .
000185
000186 1000-para.
000187
000188     .
000189
