Before migrating to PowerBuilder 2022, it's essential to identify existing features that are not compatible with this new version, and the consequences for the rest of the application.
Open a PowerBuilder project → In the main view, select Code Inspection Issues (1) → Click on [All Issues by Group] in the navigation Bar (2) → Review the [Migration PB 2022] section in the main view (3).
For more information on each rule, see the Visual Expert code inspection rules documentation.
Rule 1: Calling the Java class in PowerBuilder is no longer supported
Non-compliant code example:
global function void ejbconnectionSample3 (); JavaVM l_jvm //Non compliant code EJBConnection l_ejbconn //Non compliant code EJBTransaction trans //Non compliant code java_integer val l_jvm = CREATE JavaVM //Non compliant code l_EJBConn = CREATE EJBConnection //Non compliant code TRY IF l_jvm.createJavaVM("", false) >= 0 THEN //Non compliant code string ls_props[] ls_props[1] = "javax.naming.Context.INITIAL_CONTEXT_FACTORY= weblogic.jndi.WLInitialContextFactory" ls_props[2] ="javax.naming.Context.PROVIDER_URL=t3://svr1:7001" ls_props[3] = "javax.naming.Context.SECURITY_PRINCIPAL=myid" ls_props[4] = "javax.naming.Context.SECURITY_CREDENTIALS=mypass" l_EJBConn.connectToServer(ls_props) //Non compliant code l_EJBConn.createJavaInstance(val, "java_integer") //Non compliant code val.java_integer(17) trans = conn.GetEjbTransaction //Non compliant code trans.begin() //Non compliant code MessageBox("The value is", val.IntValue()) ELSE MessageBox("createJavaVM", "Failed", StopSign!) END IF CATCH (Throwable g) MessageBox("Exception in createJavaInstance", g.getMessage()) END TRY end function
Rule 2: DDE Functions and events are obsolete
Non-compliant code example:
global function void loadDDEMethodsAndEvents (); long handle string s_regiondata[3] handle = OpenChannel("Excel", "REGION.XLS", & //Non compliant code Handle(w_ddewin)) GetRemote("R1C2", s_regiondata[1], handle, & //Non compliant code Handle(w_ddewin)) GetRemote("R1C3", s_regiondata[2], handle, & //Non compliant code Handle(w_ddewin)) GetRemote("R1C4", s_regiondata[3], handle, & //Non compliant code Handle(w_ddewin)) CloseChannel(handle, Handle(w_ddewin)) //Non compliant code end function
Rule 3: SOAP and INET objects should not be used
Non-compliant code example:
global function string hyperlinktourl (integer id) integer li_rc inet iinet_base veinet veiinet_base iinet_base = CREATE inet veiinet_base = CREATE veinet SetPointer(HourGlass!) li_rc = &iinet_base.HyperlinkToURL("https://www.visual-expert.com") li_rc = veiinet_base.HyperlinkToURL("https://www.visual-expert.com") DESTROY iinet_base Return "" end function
Rule 4: The JDBC database interface is removed from the database painter
Non-compliant code example:
SQLCA.DBMS = "JDBC" //Non compliant code SQLCA.AutoCommit = False SQLCA.DBParm = "Driver='cdata.jdbc.sybase.SybaseDriver',URL='jdbc:sybase:User=myuser;Password=mypassword;Server=localhost;Database=mydatabase;Charset=iso_1;"; //Non compliant code CONNECT USING SQLCA; dw_master.SetTransObject(SQLCA); dw_master.Retrieve();
Rule 5: The OData database interface is removed from the database painter
Non-compliant code example:
SQLCA.DBMS = "JDBC" SQLCA.AutoCommit = False SQLCA.DBParm = "Driver='cdata.jdbc.odata.ODataDriver',URL='jdbc:odata:URL=http://services.odata.org/V4/Northwind/Northwind.svc;UseIdUrl=True;OData Version=4.0;Data Format=ATOM;"; //Non compliant code CONNECT USING SQLCA; dw_master.SetTransObject(SQLCA); dw_master.Retrieve(); SQLCA.DBMS = "ODT" //Non compliant code SQLCA.DBParm = "ConnectString='URI=http://esx2-appserver/TestDataService/Employee.svc'" //connect to the service connect using SQLCA; dw_master.SetTransObject(SQLCA); dw_master.Retrieve();
Rule 6: The XSLFOP! PDF method is removed from Power Script
Non-compliant code example:
int li_ret dw_master.Object.DataWindow.Export.PDF.Method = XSLFOP! //Non compliant code dw_master.Object.DataWindow.Export.PDF.xslfop.print='Yes' //Non compliant code li_ret = dw_master.saveas("printed.pdf", PDF!, true) int li_ret dw_master.Modify("DataWindow.Export.PDF.Method = XSLFOP! ") //Non compliant code dw_master.Modify("DataWindow.Export.PDF.xslfop.print='1'") //Non compliant code li_ret = dw_master.saveas("printed.pdf", PDF!, true)
Rule 7: Use the LoadWithDotNet function instead of LoadWithDotNetFramework and LoadWithDotNetCore functions
Non-compliant code example:
global function void loadDotNetDLLSample ();
Long ll_return
String ls_dll
DotNetAssembly lcs_ass
//Specifies a DLL in the relative path
Ls_dll = "Appeon.Simple.dll"
//Instantiates the DotNetAssembly object
Lcs_ass = create DotNetAssembly
//Loads the DLL
Ll_return = lcs_ass.LoadWithDotNetFramework(ls_dll) //Non compliant code
//Checks the result
If ll_return < 0 then
Messagebox("Load "+ls_dll+" Failed", lcs_ass.ErrorText)
Return ll_return
End if
end function