Outstanding Contributor.
Outstanding Contributor.
154 views

Json compile error!

Jump to solution

i use a demo json Cobol program found by mf

With netexpress 5.x no error by compiling, with visual Cobol 5.x following Errors:

json generate json-doc from Person Count in c1             *> (line 68)

Name of salary is 'income'                              

suppress NS-num *> for security                                     *> (line 70) 

Typ  *> for brevity

COBCH0012 Operand json is not declared                    --> Line 68
COBCH0058 Not a Report Name or a Report Group    --> Line 68 
COBCH0301 Unrecognized verb                                  --> line 70

 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Json compile error!

Jump to solution

Remove the mflevel"15" directive and it will compile ok.

The current mflevel in Visual COBOL is "20".

mflevel"15" sets the compiler to behave like the following product

  • Net Express 6.0 SP1; Net Express 5.1 WS5
  • Visual COBOL R1

These products did not include support for the JSON statements.

View solution in original post

0 Likes
10 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Json compile error!

Jump to solution

I believe you might mean that the JSON GENERATE statement fails in Net Express whereas it works in Visual COBOL?

The JSON Generate statement is new in Visual COBOL and was not supported in the Net Express product.

The program that you attached compiles fine for me in Visual COBOL 5.0.

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: Json compile error!

Jump to solution

Sorry Chris, but in this example the are many Errors, they must be corrected before running!

- json-Status is not declared

- any fields are duplicate and have not the term "of" (Age, Name, Country and other)

And i have the newest VS2019 Update 5 and the newest VC 5.0 Update 6 and i become the same Errors!

Do you use a other directive for json?

 

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Json compile error!

Jump to solution

I can compile this in either a native code console or a .NET console project with default settings or from the command line with default settings with no errors.

Perhaps you are setting the DIALECT directive to change this to an older dialect that doesn't support this?

What are your directives and how are you compiling?

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: Json compile error!

Jump to solution
Chris, in release mode successfull with my changes, but in debug mode the Errors are the same as indicated in my first message!
0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Json compile error!

Jump to solution

It sounds like you may have changed the directives being used in your DEBUG build.

Look at the COBOL tab on the Properties page. What is the current setting of Dialect? 

You can also compile with the SETTINGS directive on and create a list file that contains at the top all of the directives being picked up.

 

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: Json compile error!

Jump to solution

here the corrected example with error in debug compile mode

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: Json compile error!

Jump to solution

i use this directive converted from netexpress 5.x

IDXFORMAT"4" FILETYPE"4" CALLFH"EXTFH"  OPT(1) sourcetabstop(8) mflevel"15" REMOVE"OBJECT-REFERENCE"

and this in the source program.

i have send a json0000.zip

 

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: Json compile error!

Jump to solution

the dialect is "Micro Focus"

 

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Json compile error!

Jump to solution

Remove the mflevel"15" directive and it will compile ok.

The current mflevel in Visual COBOL is "20".

mflevel"15" sets the compiler to behave like the following product

  • Net Express 6.0 SP1; Net Express 5.1 WS5
  • Visual COBOL R1

These products did not include support for the JSON statements.

View solution in original post

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: Json compile error!

Jump to solution
Thanks, Chris!
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.