2525@ RestController
2626public class BrowseTSQController {
2727
28- // EBCDIC encoding of the CICS system used to create byte array for the holder object
29- private static String LOCAL_CCSID = System .getProperty ("com.ibm.cics.jvmserver.local.ccsid" );
30-
3128 /**
3229 * The @GetMapping annotation ensures that HTTP GET requests to the /browseTSQs URL path are
3330 * mapped to the annotated method.
@@ -65,14 +62,14 @@ public String browseTSQs(@RequestParam(value = "tsqName", defaultValue = "ANNE")
6562 * @throws UnsupportedEncodingException
6663 */
6764 private ArrayList <String > browseTSQ (String tsqName ) throws CicsConditionException , UnsupportedEncodingException {
68- // An ArrayList to hold all of the items read from TSQ to be returned to the Servlet .
65+ // An ArrayList to hold all of the items read from TSQ to be returned to the servlet .
6966 ArrayList <String > records = new ArrayList <String >();
7067
7168 // construct a JCICS representation of the TSQ object
7269 TSQ tsqQ = new TSQ ();
7370 tsqQ .setName (tsqName );
7471
75- // The holder object will hold the byte array that is read from the TSQ.
72+ // the holder object will hold the byte array that is read from the TSQ
7673 ItemHolder holder = new ItemHolder ();
7774
7875 // initialize loop variables
@@ -83,18 +80,16 @@ private ArrayList<String> browseTSQ(String tsqName) throws CicsConditionExceptio
8380 // read an item and store the total number of items on the queue
8481 totalItems = tsqQ .readItem (itemPos , holder );
8582
86- // Add the record to the ArrayList to be returned
87- recordStr = new String (holder .getValue (), LOCAL_CCSID );
83+ // get string from the holder byte[] - defaults to using EBCDIC encoding of CICS region
84+ // then add the record to the ArrayList to be returned
85+ recordStr = holder .getStringValue ();
8886 records .add (recordStr );
8987
90- // iterate over the remaining items and add them to the ArrayList
88+ // iterate over the remaining items and add to the ArrayList
9189 while (itemPos < totalItems ) {
9290 tsqQ .readNextItem (holder );
93-
94- // Add the record
95- recordStr = new String (holder .getValue (), LOCAL_CCSID );
91+ recordStr = holder .getStringValue ();
9692 records .add (recordStr );
97-
9893 itemPos ++;
9994 }
10095
0 commit comments