Page 1 of 1

VL Framwork Private Connection

Posted: Sat Feb 04, 2017 8:44 am
by DaveH
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.

Re: VL Framwork Private Connection

Posted: Tue Feb 07, 2017 12:31 pm
by MarkD
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 - ... server.htm

CONNECT_SERVER - ... server.htm

CONNECT_FILE - ... 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?

Re: VL Framwork Private Connection

Posted: Wed Feb 08, 2017 2:59 am
by DaveH
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.

Re: VL Framwork Private Connection

Posted: Thu Feb 09, 2017 5:31 pm
by MarkD
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.

Re: VL Framwork Private Connection

Posted: Fri Feb 10, 2017 9:53 am
by MarkD
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)
If you need to declare #uSystem do this globally in your reusable part:

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

Re: VL Framwork Private Connection

Posted: Fri Feb 10, 2017 9:57 am
by MarkD
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.

Re: VL Framwork Private Connection

Posted: Fri Feb 10, 2017 10:01 am
by MarkD
There probably will be a hiccup or two - but on the face of this it seems like it will work