Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions cobj/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -4312,7 +4312,6 @@ static void write_json_info(struct cb_program *prog) {
}

fprintf(fp, "{\n");
fprintf(fp, " \"json_format_version\": \"1.0.0\",\n");
fprintf(fp, " \"opensourcecobol4j_version\": \"%s\",\n", PACKAGE_VERSION);
fprintf(fp, " \"program_id\": \"%s\",\n", prog->program_id);
fprintf(fp, " \"procedure_division_using_parameters\": [\n");
Expand All @@ -4321,8 +4320,8 @@ static void write_json_info(struct cb_program *prog) {
struct cb_field *arg_field = cb_field(CB_VALUE(l));
int type = cb_tree_type(CB_TREE(arg_field));
fprintf(fp, " {\n");
fprintf(fp, " \"name\": \"%s\",\n", arg_field->name);
fprintf(fp, " \"type\": ");
fprintf(fp, " \"variable_name\": \"%s\",\n", arg_field->name);
fprintf(fp, " \"java_type\": ");
if (type & COB_TYPE_NUMERIC) {
if (arg_field->pic->scale > 0) {
fprintf(fp, "\"double\"");
Expand Down
20 changes: 8 additions & 12 deletions tests/command-line-options.src/info-java-dir.at
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,23 @@ AT_DATA([prog.cbl], [
AT_CHECK([${COBJ} -info-json-dir=./ callee.cbl prog.cbl])
AT_CHECK([cat info_callee.json], [0],
[{
"json_format_version": "1.0.0",
"opensourcecobol4j_version": "1.0.20",
"program_id": "callee",
"procedure_division_using_parameters": @<:@
{
"name": "P1",
"type": "String"
"variable_name": "P1",
"java_type": "String"
},
{
"name": "P2",
"type": "int"
"variable_name": "P2",
"java_type": "int"
}
@:>@
}
])

AT_CHECK([cat info_prog.json], [0],
[{
"json_format_version": "1.0.0",
"opensourcecobol4j_version": "1.0.20",
"program_id": "prog",
"procedure_division_using_parameters": @<:@
Expand All @@ -66,25 +64,23 @@ AT_CHECK([${COBJ} -info-json-dir=bbb callee.cbl prog.cbl])

AT_CHECK([cat bbb/info_callee.json], [0],
[{
"json_format_version": "1.0.0",
"opensourcecobol4j_version": "1.0.20",
"program_id": "callee",
"procedure_division_using_parameters": @<:@
{
"name": "P1",
"type": "String"
"variable_name": "P1",
"java_type": "String"
},
{
"name": "P2",
"type": "int"
"variable_name": "P2",
"java_type": "int"
}
@:>@
}
])

AT_CHECK([cat bbb/info_prog.json], [0],
[{
"json_format_version": "1.0.0",
"opensourcecobol4j_version": "1.0.20",
"program_id": "prog",
"procedure_division_using_parameters": @<:@
Expand Down