VL Framwork Private Connection

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
DaveH
Posts: 10
Joined: Tue May 17, 2016 1:35 am

VL Framwork Private Connection

Post by DaveH » Sat Feb 04, 2017 8:44 am

I am looking to create a Private connection within the VL Framework to an iSeries. Does anybody have an example of how to it setup that I could follow.

MarkD
Posts: 606
Joined: Wed Dec 02, 2015 9:56 am

Re: VL Framwork Private Connection

Post by MarkD » Tue Feb 07, 2017 12:31 pm

I don’t have a code sample so all I can offer is some pointers to the things you might need to use.

avPrivateConnect is normally used to establish a super-server session with a remote server, so I am going to assume that is what you need to do. Let me know if it’s something else. You use your own custom/private connection in place of the standard automatic connections defined on the (Servers) -> (Administration) tab.

If you need to ask the user for profile, passwords, etc your avPrivateConnect method should show a modal VL form and then return control when the user is connected (or not).

The basic built-function required to make super-server connection are

DEFINE_ANY_SERVER - http://docs.lansa.com/14/en/lansa015/in ... server.htm

CONNECT_SERVER - http://docs.lansa.com/14/en/lansa015/in ... server.htm

CONNECT_FILE - http://docs.lansa.com/14/en/lansa015/in ... t_file.htm

There’s also a symmetric avPrivateDisconnect method that should DISCONNECT_FILE and DISCONNECT_SERVER to avoid warning messages when closing down the application.

BTW, you know if you code up a private connection you will lose use of the built in automatic connection capabilities like periodic connection testing, session recovery, password changing, etc?

DaveH
Posts: 10
Joined: Tue May 17, 2016 1:35 am

Re: VL Framwork Private Connection

Post by DaveH » Wed Feb 08, 2017 2:59 am

Thanks for the information. Just some clarification.
We currently required our users to enter a profile and password when accessing the frameworks. This establishes a connection to our iSeries, We now have a few user profiles where we want to skip the entry of a profile and password and have our imbedded interface point reusable part log them in. These profiles will be used by multiple people on the shop floor. That is why I was looking at the avPrivateConnect.

MarkD
Posts: 606
Joined: Wed Dec 02, 2015 9:56 am

Re: VL Framwork Private Connection

Post by MarkD » Thu Feb 09, 2017 5:31 pm

I was just looking at some code in the VLF connector.

I think you can reuse the VLF's standard connection logic - the same logic used for your other users.

I will try to find an example and post it to the forum tomorrow morning.

MarkD
Posts: 606
Joined: Wed Dec 02, 2015 9:56 am

Re: VL Framwork Private Connection

Post by MarkD » Fri Feb 10, 2017 9:53 am

Inside your private connection logic you can iterate through the servers defined to the VLF like this:

Code: Select all

* Use VL's F2 feature help to see all properties exposed by this server object 

Define_Com Class(#VF_FP007) Name(#Server) Reference(*dynamic)

* Get the first server

Invoke Method(#uSystem.uServerContainer.uFirstServer) Userverref(#Server) Ucursor(#vf_elnum) Ureturncode(#vf_elretc)
Dowhile Cond('#vf_elretc = ok')

* The VF_FP007 server object has a set of properties that define the server. 
* These properties are READ ONLY in this context and must never be updated. 
* For example ..

Use message_box_add ('Caption' #Server.uCaption)
Use message_box_add ('Type'    #Server.uServerType)
Use message_box_add ('LU Name' #Server.uServerLUName)
Use Message_box_show (ok ok info)

* Get the next server 

Invoke Method(#uSystem.uServerContainer.uNextServer) Userverref(#Server) Ucursor(#vf_elnum) Ureturncode(#vf_elretc)
Endwhile
If you need to declare #uSystem do this globally in your reusable part:

Define_Com Class(#VF_SY001) Name(#USYSTEM) Scope(*Application) Reference(*dynamic)

MarkD
Posts: 606
Joined: Wed Dec 02, 2015 9:56 am

Re: VL Framwork Private Connection

Post by MarkD » Fri Feb 10, 2017 9:57 am

One you have the VF_FP007 server object you want to connect to you should be able to say:

#Server.uConnect User(XXXXXXX) Password(XXXXXXX) returnCode(#ReturnCode)

where you are looking for #ReturnCode to come back as OK.

MarkD
Posts: 606
Joined: Wed Dec 02, 2015 9:56 am

Re: VL Framwork Private Connection

Post by MarkD » Fri Feb 10, 2017 10:01 am

There probably will be a hiccup or two - but on the face of this it seems like it will work

Post Reply