ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / AS400
  • Overview
  • Project and analysis
  • Importing the DDS (Reverse engineering)
  • Exporting the DDS
  • Creating the application
  • Programming the access to the data
  • Specific programming
  • Creating the executable and deploying
  • Creating the executable
  • Deploying the application
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
AS/400: Development method
Overview
The Native AS/400 Connector simplifies access to AS/400 data from your WINDEV and WEBDEV applications.
In development, the same method is used regardless of the product used.
In deployment, only the runtime platform changes: Windows with WINDEV or a browser with WEBDEV.
This page presents the development method in several steps:
  1. Creating the project and the analysis: importing the structure of data files.
  2. Creating the application (RAD) and programming.
  3. Creating the executable file (WINDEV).
  4. Deploying the application.
Project and analysis

Importing the DDS (Reverse engineering)

If an existing database exists on your AS/400 (or on the one of your client), all you have to do is import the DDS defined on the AS/400 into your product to exploit this data. The data remains on the AS/400. You have the ability to access the physical files, the logical files, like any application written in RPG (GAP) or in Cobol.
WINDEV automatically retrieves the structure of the data files and creates a data repository useful for development. The AS/400 controls are converted into the Windows format. The data remains in AS/400 format.
Each one of the logical files becomes a key for WINDEV (unique key or multiple key). WINDEV deduces the relationships between data files according to the definition of the keys. The integrity constraints defined for the AS/400 are retrieved.
To import the DDS:
  1. On the "Analysis" tab, in the "Creation" group, expand "Import" and select "Import file/table descriptions...". The wizard starts. An AS/400 connection is automatically created and associated with the files imported into the analysis. This connection will have to be used to handle the AS/400 data file through programming.
  2. In the different wizard screens, select:
    • Data source: external database.
    • The data in current format will be used by the application.
    • When selecting the source database, specify the "Native Connector for AS/400" mode, the IP address or name of the AS/400 database, the profile name and the associated password.
  3. Select the AS/400 objects to import and validate.
For more details, see the help file provided with the Native AS/400 Connector.
Remark: Extended information is automatically retrieved when the AS/400 files are imported into the analysis.

Exporting the DDS

If you want to create new data files on the AS/400:
  1. Define the new data files in the data model editor.
  2. Export the DDS to the AS/400: on the "Analysis" tab, in the "Analysis" group, expand "Synchronization" and select "Synchronize an AS400 - iSeries (DDS and data)".
  3. In the wizard, select the structures of the data files to export. For each selected data file, the DDS are created and compiled on the AS/400 in the library of your choice (*LIBL). The PC controls are converted into the AS/400 format.
For more details, see the help file provided with the Native AS/400 Connector.
Creating the application
Once the data files have been imported into the analysis, the WINDEV or WEBDEV application can be created. The RAD (Rapid Application Development) can also be used to create a full application in a few minutes.
The test of this application can be run immediately.
What happens on the AS/400 server when a WINDEV or WEBDEV program is run?
A physical connection to a job on the AS/400 corresponds to each current WINDEV application. This job depends on the profile defined.
Remark: The RAD is used to quickly create an application but you also have the ability to create full applications in the editor directly. All the elements generated by RAD can be modified. All the WLanguage functions can be used in an application for the AS/400.

Programming the access to the data

1. Establishing the connection
  • To establish the connection to the AS/400 database, use HOpenConnection and specify the name of the connection to open. This name was defined when the structure of the data files was imported into the analysis.
  • To change the parameters of this connection (username or password, for example), use a variable of type Connection.
Remark: If you try to read the data file directly (HReadFirst, ...), the connection associated with the file description in the analysis will be automatically opened.
2. Running queries
HExecuteQuery and HExecuteSQLQuery are used to run queries on the current database.
  • HExecuteQuery: is used to run a preset query with the query editor.
  • HExecuteSQLQuery: is used to execute a query by specifying the SQL code of the query and the name that will be assigned to this SQL code.
3. Retrieving the result
The result is browsed by the standard read functions: HReadFirst, HReadNext, HReadSeek, ...
4. Closing the connection
HCloseConnection is used to close the connection to the database once all the necessary queries have been run.

Specific programming

The Native AS/400 Connector enables you to develop applications in Client/Server mode of data and in Client/Server mode of processes. You have the ability to:
  • perform calls to batch or CL while passing parameters,
  • manage the DataQueues or DataAreas,
  • run AS/400 commands, ...
Some examples of specific functions (starting with AS):
ASRunRPCStarts the execution of an AS/400 program and returns parameters (values returned by the program, OutPut variables, like on the AS/400).
ASCallRtvRuns an AS/400 command that returns variables (RTVJOBA type).
ASRtvResultRetrieves the result of last ASCallRtv command.
ASExecCalls all the AS/400 commands in command line, in the context of current session, with the authenticated AS/400 user profile, as on a terminal in 5250 mode.
ASUserChanges the AS/400 user profile under which you are connected in order to start a session with different privileges.

For more details, see the help file provided with the Native AS/400 Connector.
Creating the executable and deploying
WINDEV

Creating the executable

An executable file is created as any WINDEV application via the executable creation wizard: on the "Project" tab, in the "Generation" group, click "Generate".

Deploying the application

The application or the site is deployed via the setup generator of the product used.
Minimum version required
  • Version 14
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help