Calling multiple actions of the same type

Issue #35 new
Kevin Adler created an issue

Due to the format of the JSON that db2sock uses, it seems that there is no way to execute multiple actions of the same type in the same request. The problem is that it uses the key in the parent object to define the action to be performed, but JSON keys must be unique. If you can only have one pgm or cmd key, how would you be able to call mulitple programs or commands in the same invocation.

eg.

{
    "pgm": [{
            "name": "HELLO",
            "lib": "DB2JSON"
        },
        {
            "s": {
                "name": "char",
                "type": "128a",
                "value": "Hi there"
            }
        }
    ],
    "pgm": [{                                    <--- this is invalid JSON
            "name": "HELLO",
            "lib": "DB2JSON"
        },
        {
            "s": {
                "name": "char",
                "type": "128a",
                "value": "Hi there"
            }
        }
    ]
}

Comments (2)

  1. Kevin Adler reporter

    I propose changing the top level to an array of objects, each with an action key, with the previous key name as its value. eg.

    [{
            "action": "pgm"
            ...
        },
        {
            "action": "pgm"
            ...
        }
    

    ]

  2. Log in to comment