
##### isCOBOL release 2026 R1 build#1173.10-20260804-42462 ######
##### Copyright (c) 2005 - 2026 Veryant. ######

----------
**This sample shows how to share a JISAM file thru NoSQL Bridge**

**This document assumes the $ISCOBOL environment variable exists and points**
**to the isCOBOL SDK installation folder.**

**When talking about a "command prompt window" it means an isCOBOL Shell**
**on the Windows OS and a standard shell on Linux/Unix**

----------

 **Execution and configuration of NoSQL Bridge**
 
 - 1 Open a new command prompt window for NoSQL

 - 2 If the NoSQL Bridge server is not already running, start it with the following command:

        nosqlc

 - 3 From your browser open the following url to access the NoSQL Bridge Administrator panel, changing the address and port to reflect your deployment configuration:

        http://localhost:8080/

 - 4 use the default login credentials

        User: admin 
        Password: admin 

 - 5 Click on **"New"** to create a new catalog

 - 6 Type **"SONGS"** and select click on **"Add"**

 - 7 Click on the **New Mapping** button on the bottom-right side of the window.

 - 7 Fill the configuration fields as follows
     - Name: SONGS
     - Path: Specify the full path of the Jisam songs file songs.dat (found in the $ISCOBOL/sample folder), omitting the .dat extension.  
     - EFD: Specify the full path of the efd xml file songs.xml (found in the $ISCOBOL/sample folder)

 - 8 Click on  **"Add new"** in the bottom right side of the add mapping pop-up screen.

 - 9 Click on **"Save"** at the top of the screen to save the SONGS setup.

 **Test using Post request**
 
 - 1 Open your http client, for example Postman
 
 - 2 Exceute your request. 
     The address of the request is the http adress of NoSQL bridge followed by the 
     type of the request.
     Also you need to specify the basci autorization header and a body with a specific json with the parameter
     of the request.
     Below a list of the possible request

 **NOTE:**

  In this document we assume the NoSQL Bridge is started on localhost with port 8080 (127.0.0.1:8080)

 **DescribeTable**
 This request returns the structure of the table.
 
  address: 127.0.0.1:8080/DescribeTable
  
  Body

        {
           "tableName": "SONGS.SONGS"
        }
  

 **GetItem**
 This request returns the content of a specific record (identified by SR_ID).
 
  address: 127.0.0.1:8080/GetItem

        {
           "tableName": "SONGS.SONGS",
           "key": {
              "name": "SONGS_RECORD_key0",
                 "fieldValues": {
                    "SONGS_RECORD": {
                       "SR_KEY": {
                          "SR_ID": 1
                       }
                    }
               }
           }
        }

 **PutItem**
 This request updates or inserts a record.

  address: 127.0.0.1:8080/PutItem

        {
            "tableName": "SONGS.SONGS",
            "item": {
                "SONGS_RECORD": {
                    "SR_DATA": {
                        "SR_ALBUM": "Let It Be",
                        "SR_ARTIST": "Beatles",
                        "SR_AUTHORS": [
                            {
                                "SR_AUTHOR": "Paul McCartney"
                            },
                            {
                                "SR_AUTHOR": ""
                            },
                            {
                                "SR_AUTHOR": ""
                            },
                            {
                                "SR_AUTHOR": ""
                            },
                            {
                                "SR_AUTHOR": ""
                            }
                        ],
                        "SR_GENRE": "leggendary Pop",
                        "SR_LABEL": "Apple Records",
                        "SR_LENGTH": "4:03",
                        "SR_TITLE": "Let It Be",
                        "SR_YEAR": 1970
                    },
                    "SR_KEY": {
                        "SR_ID": 200
                    }
                }
            }
        }


 **UpdateItem**
 This request updates a single field of a record identified by SR-ID only if a specific condition is true.

  address: 127.0.0.1:8080/UpdateItem

        {
          "tableName": "SONGS.SONGS",
            "key": {
                "name": "SONGS_RECORD_key0",
                "fieldValues": {
                    "SONGS_RECORD": {
                        "SR_KEY": {
                             "SR_ID": 150
                          }
                    }
                }
            },
          
           "expression": "set SONGS_RECORD.SR_DATA.SR_TITLE = 'LET IT BE'",
           "condition" : "SONGS_RECORD.SR_DATA.SR_LABEL = 'Apple Records'"
        }

 **DeleteItem**
 This request deletes a record.

  address: 127.0.0.1:8080/DeleteItem

        {
            "tableName": "SONGS.SONGS",
            "key": {
                "name": "SONGS_RECORD_key0",
                "fieldValues": {
                    "SONGS_RECORD": {
                        "SR_KEY": {
                             "SR_ID": 200
                          }
                    }
                }
            }
        }

 **Query**
 This request returns a list of records

  address: 127.0.0.1:8080/Query

        {
            "tableName": "SONGS.SONGS",
            "key": {
                "name": "SONGS_RECORD_key0"
            },
            "keyCondition": "SONGS_RECORD.SR_KEY.SR_ID > 2",
            "limit": 100,
            "descending": false,
            "lastEvaluatedKey": "lEo"
        }

 **NOTE:**

        To enter and run all these requests, you can import the "noSQL-sample.postman_collection.json"
        into your Postman workspace.

 **Test using HTML**
 
 - 1 Change the content of rows 5, 6 and 7 of app.js in the sample\html\js folder 
     to reflect your NoSQL bridge configuration

 - 2 Create the "songs-nosql.war" by running the build.sh script in the sample folder
 
 - 3 Deploy the webapp using the $ISCOBOL/sample/songs-nosql/songs-nosql.war
     in your servlet container 
 
 - 4 Execute the songs-nosql webapp
 