Outline of a basic statistics API program.
A basic statistics API program typically has an outline similar to the example later in this section.
This pseudo-code program connects to a CICS® Transaction Gateway daemon, obtains the statistics IDs related to the "GD" resource group, obtains the current values for the given "GD" related statistical IDs and finally iterates through the returned values, writing out the details.
/* Create a connection to a local Gateway daemon */ openGatewayConnection(&gwyToken,port,&gwyProtocolVersPtr) verify connected Gateway protocol level /* Set the resource group id of interest */ queryString1="GD" /* Obtain the list of associated statistical IDs */ getStatIdsByStatGroupId(gwyToken, queryString1, &resultSetToken) /* Extract the returned IDs as a query string */ getIdQuery(resultSetToken,&queryString2) /* Obtain the live statistical values for the given set IDs */ getStatsByStatId(gwyToken, queryString2, &resultSetToken) /* Iterate over the result set, outputting */ /* the details of each result set element */ /* Obtain the first statistical result set element */ getFirstStat(resultSetToken, &statDataItem) do if statDataItem.queryElementRC == CTGSTATS_SUCCESSFUL_QUERY /* output details of statDataItem */ endif /* Obtain the next statistical result set element */ getNextStat(resultSetToken, &statDataItem) until end-of-resultset