Skip to main content
Hello,
Do JSON statements work in Visual COBOL 4?
 I cannot get the programs to compile with JSON statements with Visual COBOL 4
Following is COBOL code example:
      01  MSG1.
            03  SND1   USAGE COMP-1.
            03  PID1   PIC 9999 USAGE DISPLAY.
            03  TXT1   PIC X(12).
 
       77  J           USAGE BINARY-LONG  VALUE 3.
       77  JSONO       PIC X(256) VALUE SPACES.
       77  MSGLENGTH   PIC 9(05).
       01  JSON-STR PIC X(2048).
       01  WS-J-TAXAUTH-REC.
           03 clientId  PIC X(39)
                 VALUE "test.test.test.api.clients.test.dev".
           03 clientSecret  PIC X(36)
                 VALUE "6e427b50-661a-decf-233e-8b90f207c66f".
 
       01  WS-JSON-TOKEN        PIC X(1000) VALUE SPACES.
 
             JSON GENERATE JSONO FROM WS-J-TAXAUTH-REC
                COUNT IN MSGLENGTH
                  NAME WS-J-TAXAUTH-REC OMITTED
                       clientIdX "clientId"
                 ON EXCEPTION
                    DISPLAY "JSON EXCEPTION"
             END-JSON
         
             JSON GENERATE JSONO FROM WS-J-TAXAUTH-REC
                 ON EXCEPTION
                    DISPLAY "JSON EXCEPTION"
             END-JSON
 
          MOVE TSTRESP TO JSON-STR.
             
           JSON PARSE JSON-STR INTO MSG1
          END-JSON.
 
     
Thank you for any input anyone may have on this!
Doug
Hello,
Do JSON statements work in Visual COBOL 4?
 I cannot get the programs to compile with JSON statements with Visual COBOL 4
Following is COBOL code example:
      01  MSG1.
            03  SND1   USAGE COMP-1.
            03  PID1   PIC 9999 USAGE DISPLAY.
            03  TXT1   PIC X(12).
 
       77  J           USAGE BINARY-LONG  VALUE 3.
       77  JSONO       PIC X(256) VALUE SPACES.
       77  MSGLENGTH   PIC 9(05).
       01  JSON-STR PIC X(2048).
       01  WS-J-TAXAUTH-REC.
           03 clientId  PIC X(39)
                 VALUE "test.test.test.api.clients.test.dev".
           03 clientSecret  PIC X(36)
                 VALUE "6e427b50-661a-decf-233e-8b90f207c66f".
 
       01  WS-JSON-TOKEN        PIC X(1000) VALUE SPACES.
 
             JSON GENERATE JSONO FROM WS-J-TAXAUTH-REC
                COUNT IN MSGLENGTH
                  NAME WS-J-TAXAUTH-REC OMITTED
                       clientIdX "clientId"
                 ON EXCEPTION
                    DISPLAY "JSON EXCEPTION"
             END-JSON
         
             JSON GENERATE JSONO FROM WS-J-TAXAUTH-REC
                 ON EXCEPTION
                    DISPLAY "JSON EXCEPTION"
             END-JSON
 
          MOVE TSTRESP TO JSON-STR.
             
           JSON PARSE JSON-STR INTO MSG1
          END-JSON.
 
     
Thank you for any input anyone may have on this!
Doug

Hello Doug Evans,

 

Support for the JSON PARSE syntax was first added in Visual COBOL 5.0, and expanded in subsequent versions. If you are going to upgrade, OpenText always recommends that you upgrade to the latest version of the product, which is currently Visual COBOL 8.0 Patch Update 5.