Skip to content

Commit e9fe0af

Browse files
committed
Optimize build of time stamp
1 parent 8dd1985 commit e9fe0af

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

projects/com.ibm.cicsdev.link/src/com/ibm/cicsdev/link/LinkServEC01.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ public class LinkServEC01
3636
/**
3737
* CCSID of the CICS region.
3838
*/
39-
private static final String CCSID = System.getProperty("com.ibm.cics.jvmserver.local.ccsid");
39+
private static final String LOCALCCSID = System.getProperty("com.ibm.cics.jvmserver.local.ccsid");
40+
41+
/**
42+
* Time formatter.
43+
*/
44+
private static final SimpleDateFormat dfTime = new SimpleDateFormat("dd/MM/yy HH:mm:ss");
4045

4146
/**
4247
* Main entry point to a CICS OSGi program.
@@ -58,17 +63,16 @@ public static void main(CommAreaHolder cah) {
5863
}
5964

6065
// Get time for return to caller
61-
Date timestamp = new Date();
62-
SimpleDateFormat dfTime = new SimpleDateFormat("dd/MM/yy HH:mm:ss");
66+
Date timestamp = new Date();
6367

6468
try {
6569
// Create byte array in local encoding
66-
byte ba[] = dfTime.format(timestamp).getBytes(CCSID);
70+
byte ba[] = dfTime.format(timestamp).getBytes(LOCALCCSID);
6771

6872
// Copy into the byte array provided by the CommAreaHolder object
6973
System.arraycopy(ba, 0, cah.getValue(), 0, ba.length);
7074
} catch (UnsupportedEncodingException uee) {
71-
// Crude error handling for simple example
75+
// Simple error handling for example
7276
throw new RuntimeException(uee);
7377
}
7478
}

0 commit comments

Comments
 (0)