Arch Linux package GnuCobol does not support JSON GENERATE, original software does
Task Info (Flyspray) | |
---|---|
Opened By | Elmar Klausmeier (eklausmeier) |
Task ID | 71821 |
Type | Bug Report |
Project | Arch Linux |
Category | Packages: Extra |
Version | None |
OS | All |
Opened | 2021-08-12 19:34:34 UTC |
Status | Assigned |
Assignee | Jerome Leclanche (Adys) |
Details
Description: GnuCobol 3.1.2 officially supports JSON GENERATE, but the Arch Linux version does not.
I removed the Arch Linux package and downloaded the GnuCobol source code and compiled + installed it (configure+make+make install). This original downloaded version does not contain the error.
Additional info:
- package version(s): 3.1.2-1
- config and/or log files etc.
- link to upstream bug report, if any
Steps to reproduce:
Run below COBOL program:
IDENTIFICATION DIVISION.
PROGRAM-ID. json.
AUTHOR. Elmar Klausmeier.
DATE-WRITTEN. 12-Aug-2021.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 I USAGE BINARY-LONG.
01 IMAX USAGE BINARY-LONG VALUE 20.
01 ARGV PIC X(100) VALUE SPACES.
77 j usage binary-long value 3.
77 jsono pic x(256) value spaces.
01 a1.
02 b.
* 03 c occurs 0 to 2 depending j.
03 c.
04 d pic x value 'd'.
02 e pic x value 'e'.
01 rec.
03 a PIC X(3) VALUE 'A'.
03 b PIC X(3) VALUE ALL 'B'.
03 c.
05 d PIC X(3) VALUE SPACES.
PROCEDURE DIVISION.
DISPLAY "Converting from COBOL to JSON".
ACCEPT ARGV FROM ARGUMENT-VALUE.
MOVE ARGV TO j.
DISPLAY "j = " j.
DISPLAY "a1 = " a1.
JSON GENERATE jsono FROM a1 ON EXCEPTION
display 'cannot generate json from a1'.
DISPLAY "jsono = " function trim(jsono).
DISPLAY "rec = " rec.
JSON GENERATE jsono FROM rec ON EXCEPTION
display 'cannot generate json from rec'.
DISPLAY "jsono = " function trim(jsono).
STOP RUN.
Output:
./json 3
Converting from COBOL to JSON
j = +0000000003
a1 = de
jsono =
rec = A BBB
jsono =
Expected output:
./json 4
Converting from COBOL to JSON
j = +0000000004
a1 = de
jsono = {"a1":{"b":{"c":{"d":"d"}},"e":"e"}}
rec = A BBB
jsono = {"rec":{"a":"A","b":"BBB","c":{"d":" "}}}
To me it looks that during configuration of GnuCobol, i.e., ./configure step, the config for
configure: Used for XML I/O: libxml2
configure: Used for JSON I/O: json-c
was missing.