CICS

CICS

CICS

The world's leading application server software for IBM Z

 View Only
  • 1.  GET NEXT CONTAINER

    Posted Tue May 14, 2024 04:07 PM
    Edited by anand mahadevan Tue May 14, 2024 04:16 PM

    Hi

    We have coded our web service programs for years using this template that I don't know where we got from. It has these lines right at the top

    EXEC CICS
         ASSIGN CHANNEL(CURRENT-CHANNEL)
    END-EXEC
    EXEC CICS STARTBROWSE CONTAINER
         CHANNEL(CURRENT-CHANNEL)
         BROWSETOKEN(MYBROWSETOKEN)
         RESP    (WS-RESP-CODE)
    END-EXEC

    EXEC CICS GETNEXT
         CONTAINER(WS-CONTAINER)
         BROWSETOKEN(MYBROWSETOKEN)
         RESP    (WS-RESP-CODE)
    END-EXEC

    EXEC CICS ENDBROWSE CONTAINER
         BROWSETOKEN(MYBROWSETOKEN)
         RESP    (WS-RESP-CODE)
    END-EXEC

    EXEC CICS GET
         CONTAINER(WS-CONTAINER)
         CHANNEL(CURRENT-CHANNEL)
         NODATA
         FLENGTH(WS-LENGTH-OF-CONTAINER)
         RESP    (WS-RESP-CODE)
    END-EXEC

    EXEC CICS GET
         CONTAINER(WS-CONTAINER)
         CHANNEL(CURRENT-CHANNEL)
         INTO(WS-CONTAINER-DATA)
         FLENGTH(WS-LENGTH-OF-CONTAINER)
         RESP    (WS-RESP-CODE)
    END-EXEC

    After we upgraded to CICS v6.1 we discovered that the first container retrieved from the channel is not necessarily the one that contains the payload from the client. 

    I was just wondering if there was any reason to have taken such an approach rather than just this

    MOVE 'my-container-name' to ws-container

    EXEC CICS GET
         CONTAINER(WS-CONTAINER)
         CHANNEL(CURRENT-CHANNEL)
         NODATA
         FLENGTH(WS-LENGTH-OF-CONTAINER)
         RESP    (WS-RESP-CODE)
    END-EXEC

    EXEC CICS GET
         CONTAINER(WS-CONTAINER)
         CHANNEL(CURRENT-CHANNEL)
         INTO(WS-CONTAINER-DATA)
         FLENGTH(WS-LENGTH-OF-CONTAINER)
         RESP    (WS-RESP-CODE)
    END-EXEC

    We provide the name of the container when we use IDZ to create the various artefacts like .wsbind .wsdl and the driver programs, so we do know it when we are writing this program.

    Thanks



    ------------------------------
    [Anand] [Mahadevan]
    [Contributor]
    [Laboratory Corporation of America]
    [Burlington] [NC]
    [336.436.8798]
    [USA]
    ------------------------------



  • 2.  RE: GET NEXT CONTAINER

    Posted Wed May 15, 2024 07:32 AM

    Greetings,

    Just for completeness and in case useful to anyone else: Will Yates, one of my colleagues, has made this reply on the CICSL forum:

    Hi

    The order of containers during a browse command was never guaranteed. In V6 the internal structure that is used to hold the list of containers was changed to give a performance increase when a program used a lot of containers within a channel. 

    If you know the name of the container (I.e it is specified in the wsbind) then you can (as you suggest) just get the container by name directly

    Will Yates



    ------------------------------
    Andy Clifton
    CICS Test and Consolidated Service Test
    IBM Hursley Park
    ------------------------------



  • 3.  RE: GET NEXT CONTAINER

    Posted Wed May 15, 2024 09:35 AM

    Anand,

    The code at the beginning you show is quite commonly used when you do not know how many containers you are going to have in a channel and / or what their names are I would assume the code you do not show is saving off the names.  However, you are correct if you know all the container names you plan to read then the code is not necessary.

    However, the code at the bottom can also be reduced.  The GET CONTAINER command that is issued twice at the end is first issued with NODATA to get the length then issued again to get the actual data.  Had you simply set WS-LENGTH-OF-CONTAINER to the maximum length you can receive you would only need the last GET CONTAINER command for each container you want to read.

    Hope that helps.



    ------------------------------
    Ezriel Gross
    Rocket Software
    Waltham NJ
    17816842672
    ------------------------------