The Gen runtimes and generated applications make use of a global data area to maintain state information and other data that is essential to the execution of the applications. The Gen developer sometimes wishes to access some of this global data for their own purposes in their External Action Blocks (EABs) or their Inline Code. The purpose of this article is to describe how to access this global data area from Inline Code in Java generated code.
For generated Java applications, this global data area is accessed through a Gen Java runtime class named GlobData. The GlobData class does not contain any actual data, but contains only references to other Gen Java runtime classes. These other classes contain instance variables that are similar to what may have been seen in the ief_globdata (C) and GLOBDATA (COBOL) data structures.
Gen 8.6 Inline Code for Java
The structure of the GlobData class and these other classes is described below.
GlobData class
Class |
Getter Method |
Description |
StateData |
getStateData() |
State information |
ErrorData |
getErrorData() |
Error information |
TraceData |
getTraceData() |
Trace information |
DBMSData |
getDBMSData() |
DBMS state information |
StateData class
Variable |
Data Type |
Getter Method |
Description |
command |
String |
getCommand() |
Command |
trancode |
String |
getTranCode() |
Trancode |
exitState |
int |
getExitState() |
Exitstate number |
exitInfoMsg |
String |
getExitInfoMsg() |
Exitstate message text |
exitMsgType |
char |
getExitMsgType() |
Exitstate message type |
userId |
String |
getUserId() |
User ID |
terminalId |
String |
getTerminalId() |
Terminal ID |
printerId |
String |
getPrinterId() |
Printer ID |
runtimeType |
String |
getRuntimeType() |
Runtime Type |
dialect |
String |
getDialect() |
Dialect |
messageFile |
String |
getMessageFile() |
Dialect message table |
clientUserId |
String |
getClientUserId() |
Client user ID |
clientPassword |
String |
getClientPassword() |
Client password |
currentABId |
String |
getCurrentABId() |
Action block ID |
currentABName |
String |
getCurrentABName() |
Action block name |
lastABName |
String |
getLastABName() |
Last action block name |
currentEventType |
String |
getCurrentEventType() |
Current event type |
lastStatementNumber |
String |
getLastStatementNumber() |
Last statement number |
lastSubStatementNumber |
String |
getLastSubStatementNumber() |
Last substatement number |
currentDate |
int |
getCurrentDate() |
Current date |
currentTime |
int |
getCurrentTime() |
Current time |
nextLocation |
String |
getNextLocation() |
Next location |
nextTran |
String |
getNextTran() |
Next tran |
transactionRetryLimit |
int |
getTransactionRetryLimit() |
Transaction retry limit |
transactionRetryCount |
int |
getTransactionRetryCount() |
Transaction retry count |
ErrorData class
Variable |
Data Type |
Getter Method |
Description |
status |
String |
getStatus() |
Error status |
lastStatus |
String |
getLastStatus() |
Last status |
serverFailedAction |
int |
getServerFailedAction() |
Server failed action |
errorActionName |
String |
getErrorActionName() |
Error action block name |
errorMessageNumber |
short |
getErrorMessageNumber() |
Error message number |
errorMessage |
String |
getErrorMessage() |
Error message text |
errorEncounteredSW |
char |
getErrorEncounteredSW() |
Error encountered switch |
viewOverflowSW |
char |
getViewOverflowSW() |
View overflow switch |
functionName |
String |
getFunctionName() |
Function name |
rollbackRequested |
char |
getRollbackRequested() |
Rollback requested status |
TraceData class
Variable |
Data Type |
Getter Method |
Description |
isTracing |
boolean |
getIsTracing() |
Tracing flag |
traceHost |
String |
getTraceHost() |
Trace host |
tracePort |
int |
getTracePort() |
Trace port |
DBMSData class
Variable |
Data Type |
Getter Method |
Description |
actionId |
int |
getActionId() |
Action block ID |
attributeId |
int |
getAttributeId() |
Attribute ID |
dbmsManager |
IDBMSManager |
getDBMSManager() |
DBMS manager |
transactionManager |
ITransactionManager |
getTransactionManager() |
Transaction manager |
processQueue |
boolean |
getProcessQueue() |
Process DAQ flag |
v1Present |
boolean |
getV1Present() |
View 1 present flag |
v2Present |
boolean |
getV2Present() |
View 2 present flag |
cascade1 |
boolean |
getCascade1() |
Cascade 1 flag |
cascade2 |
boolean |
getCascade2() |
Cascade 2 flag |
disassociateQueue |
Vector<Object> |
getDisassociateQueue() |
Disassociate queue |
saveSQLException |
SQLException |
getSaveSQLException() |
SQL exception |
One of the first things to do is determine if GlobData is actually populated with the data of interest. The easiest way to do that would be to add an Inline Code statement in the PAD logic at the point where the data needs to be accessed. The Inline Code statement shown below will display the entire contents of GlobData. The output from this Inline Code statement will be written to the Application Server log file at runtime.
Once it is confirmed that GlobData contains the data of interest, the above Inline Code statement can be changed to retrieve only the desired data fields. The Inline Code statement shown below contains examples of retrieving one data field from each of the four runtime classes that are contained within the GlobData class.
While this article is written specifically about accessing GlobData from Inline Code for generated Java code, the Gen developer can also access the global data area using Inline Code for other generated languages.