Class Helper
This helper is used for defining ordinal interface names in a different format than the one generated by the compiler.
JSON tag
classes
→ Each value defined by class name
Properties
camelCase: Compulsory property that is used to define the name of the ordinal
Example
PLI
define ordinal errorCode(
FCBA01
,FCBA02
);
Helper
"classes" : {
"errorCode": {"camelCase" : "ErrorCode"}
}
Generated Java
public interface ErrorCode { …
Method Helper
This helper is used to define how the method name should be written.
JSON tag
methods
→ Each value defined by method name
Properties
camelCase: Compulsory property, method name
strategy: Compulsory property which can have values; JavaClass, JavaMethod, JavaMainMethod, or JavaInstanceClass
replacement: Compulsory property that is used to override method call statements
Example
"methods": {
"p9dcfse": {"camelCase" : "p9dcfse", "strategy" : "JavaInstanceClass" , "replacement" : "" },
"ptrNotNullNotSysnull": {"camelCase" : "ptrnotnullnotsysnull", "strategy" : "JavaMethod" , "replacement" : "" },
}
Attribute Helper
This helper is used to override how an attribute should be declared in a class.
JSON tag
attributes
→ Each value defined by data declaration name (case sensitive)
Properties
camelCase: Not used in the compiler, but compulsory anyway
exclude: Not used in the compiler, but compulsory anyway
scope: Can only be JavaInstanceClass
replacement: Optional property that is used to change how the variable is actually declared. No modifier should be used and no semicolon should be added at the end of the statement, otherwise, the compiler gives an error. But there is a problem with changing the name of the variable here; if we change it here, it does not get updated anywhere in the class, so the call statements to it fail.
Example
PLI
DCL 1 BASE_VAR,
3 STR CHAR(08);
Helper
"attributes": {
"BASE_VAR": { "camelCase": "baseVar1", "exclude": false, "scope": "JavaInstanceClass", "replacement": "Base_var baseVar2 = new Base_var()"}
}
Generated Java
@Base() protected Base_var baseVar2 = new Base_var();
Param Helper
This helper is used to override how a function parameter is written.
JSON tag
params
→ Each value defined by param expression
Properties
replacement: Compulsory property that is used to override how a function parameter is supposed to be replaced.
Example
PLI
CALL P9NPFCL(ADDR(MQ_CLO_PARMS)) ;
Helper
"params": {
"Builtin.ADDR(mq_clo_parms)" : { "replacement" : "mq_clo_parms"}
}
Generated Java
P9npfcl.cicsEntry(mq_clo_parms, _transenv);
(Without helper this line is generated in the following way;
P9npfcl.cicsEntry(Builtin.ADDR(mq_clo_parms), _transenv);
Java Helper - Java
This helper is used to replace a java method for the given procedure name, replacement is found in the java class specified by the javaClass
property in the helper folder.
JSON tag
java
→ Each value defined by procedure name (case sensitive)
Properties
javaClass: Compulsory property specifying from which java file in the helper folder should the procedure replacement be found
javaMethod: Not used in the compiler, but compulsory anyway
Example
"java" : {
"IS_DRITTLAND" : { "javaClass": "P1npst.java", "javaMethod": "not important" },
"A20_LESEN_EINGANG_QUEUE" : { "javaClass": "P1npst.java", "javaMethod": "not important" },
}
Java Helper - Override
This helper is used to replace a java method for the given method name, replacement is found in the java class specified by the javaClass
property in the helper folder. The difference from Java Helper with java
tag is that with this helper we replace the “java method” which does not always have to be a procedure in the pli program like the invoke method our compiler adds to the java class.
JSON tag
java
→ Each value defined by java method name (case sensitive)
Properties
javaClass: Compulsory property specifying from which java file in the helper folder should the java method replacement be found
javaMethod: Not used in the compiler, but compulsory anyway
Example
"override" : {
"cicsInvoke" : { "javaClass": "P1npst.java", "javaMethod": “not important"},
"invoke" : { "javaClass": "P1npst.java", "javaMethod": “not important"}
}
Java Helper - Additional Methods
This helper is used to add a java method with the given method name which is found in the java class specified by the javaClass
property in the helper folder. The difference between Java Helper with java
and override
tags is that with this helper we add a method that does not have to be in the original java class.
JSON tag
java
→ Each value defined by java method name
Properties
javaClass: Compulsory property specifying from which java file in the helper folder the additional java method should be found
javaMethod: Not used in the compiler, but compulsory anyway
Example
"additionalmethods" : {
"test": { "javaClass": "P1npst.java", "javaMethod": "not important"}
}
Struct Helper
This helper is used to replace struct declarations. The important part is that all the variables in the struct should be specified in the helper, not only the ones that need replacing.
JSON tag
struct
→ Each value defined by class name of struct
Properties
name: Compulsory property, the field name in the struct, must include all the fields, not only the ones that need replacing
type: Compulsory property, the type of the field
instance: Compulsory property, initializer expression for the field
Example
"struct" : {
"RF_TAB" : [
{ "name" : "max_rf" , "type" : "Integer" , "instance" : "P5npnm.rf_tab_elems"},
{ "name" : "tab" , "type" : "Array" , "instance" : "new Array(P5npnm.rf_tab_elems , Tab.class, Object.class, new Tab(), \"TAB\")"}
]
}
Init Helper
This helper is used to patch for uninitialized arrays. It adds an extra array initialization for the given struct/variable name.
JSON tag
init
→ Each value defined by struct or a variable name that has/is an array
Properties
code: Compulsory property, array initialization code statement to be added
Example
"init" : {
"PIKSDAT4" : { "code" : "for(int i = 1; i <piksdat4.tab.size();i++) {\npiksdat4.tab="{\nPiksdat4.Tab" tab="new" piksdat4.tab();\ntab.frombytes(\="Piksdat4.Tab();\ntab.fromBytes(\" \="\" .getbytes());\npiksdat4.tab.set(tab,i);\n}=".getBytes());\npiksdat4.tab.set(tab,i);\n}" }="}"></piksdat4.tab.size();i++)>
Symbol Helper
This helper is used to change the type for the instance variable with the given symbol name instead of the one compiler generates. Type must be one of the types that is defined in the program.
JSON tag
symbols
→ Each value defined by symbol name
Properties
type: Compulsory property, type for the given symbol
Example
PLI
DCL 1 VAR_DEF DEF BASE_VAR,
3 STR CHAR(08);
DCL p pointer;
Helper
"symbols": {
"p" : { "type" : "VAR_DEF" }
}
Java
// declareField p class JavaClass
private Var_def p = new Var_def();
SQL Proc Helper
This helper is used to define directions for SQL call parameters.
JSON tag
sqlProc
→ Each value defined by SQL call name
Properties
param: Compulsory property, SQL parameter name.
io: Compulsory property, defines the direction for the parameter. Possible values are IN, OUT, or INOUT.
Example
sqlProc" : {
"HST.P7HS020" : [
{ "param" : ":HS020_HDL_NR" , "io" : "IN" },
{ "param" : ":HS020_VZWEIG" , "io" : "IN" },
{ "param" : ":HS020_F_TEXT" , "io" : "OUT" },
{ "param" : ":HS020_F_INFO" , "io" : "OUT" }
]
}
Refactor Helper
This helper is used to refactor the defined class; it can be moved into another class as an inner class.
JSON tag
refactor
→ Each value defined by class name to be refactored
Properties
action: Compulsory property, can only have the value ‘moveToInner’
toClass: Compulsory property, in which class the defined class should be moved to
static: Optional property, whether to add a static modifier to the moved inner class, the default value is true.
Example
"refactor" : {
"S_tinf" : [ { "action" : "moveToInner" , "toClass" : "P8cb049", "static" : false } ],
"C049" : [ { "action" : "moveToInner" , "toClass" : "P8cb049" } ],
"K049" : [ { "action" : "moveToInner" , "toClass" : "P8cb049" } ]
}
Shared Param Helper
This helper is used to move a parameter to class level and make it an instance variable.
JSON tag
sharedParam
→ Each value defined by name of the parameter, case-sensitive.
Properties
name: Compulsory property, name of the parameter
Example
"sharedParam": {
"A_TRAN" : { "name" : "a_tran" },
"A_TDVA" : { "name" : "a_tdva" }
}
CallByRef Helper
This helper is used to wrap the given function’s argument list to an array and change the calling statements to use an array so that the arguments will be passed by reference.
JSON tag
callByRef
→ Each value defined by function name
Properties
name: Compulsory property, function name
Example
PLI
getConsignmentPflicht: proc(h_deloccat,
h_deloc,
h_delmarket,
consignmentPflicht);
call getConsignmentPflicht(dclvnppfg.ghdlcat
,dclvnppfg.ghdl
,h_delmarket
,consignmentPflicht);
Helper
"callByRef": {
"getconsignmentpflicht" : { "name" : "getconsignmentpflicht" }
}
Java
/*wrap params*/
ArrayList
Statement Helper
This helper is used to change statements in PLI with the given replacement instead of the one that is generated by the compiler. There is a problem with statements within other statements like if/switch statements; the compiler does not pick up single lines within long if-else clauses. You can use override helper instead.
JSON tag
statements
→ Each value defined by statement in PLI to be replaced
Properties
replacement: Compulsory property, statement that will replace the given one. It should have the exact line in PLI with the whitespaces included.
extra_lines: Optional property, extra lines to be added after the statement
Example
{
"statements": {
"DATUM = SUBSTR(H_DATUM,1,8) ;": {"replacement":"datum = Builtin.SUBSTR(h_datum, 1, 8);" },
"AKT_DATUM = TRANSLATE('AB.CD.EFGH',DATUM,'EFGHCDAB');": {"replacement":"akt_datum = Builtin.TRANSLATE(\"AB.CD.EFGH\", datum, \"EFGHCDAB\");" },
"P01.DATUM = TRANSLATE('AB.CD.EFGH',DATUM,'EFGHCDAB');": {"replacement":"p01.datum = Builtin.TRANSLATE(\"AB.CD.EFGH\", datum, \"EFGHCDAB\");" },
"X=ANLSTAT((L+R)/2).KEY;": {"replacement":"x = anlstat[(l + r) / 2].key;" }
}
}
0 Comments