PreviousNext
Help > Programming with LAUNCHER Office > CL Commands > CPYTOMDB - CL Command
CPYTOMDB - CL Command

The CPYTOMDB command is used to transfer data from a file or request from the AS/400 to a table in an ACCESS database.

 

Parameters

 

Access Database selection type

SELMDB

F

Target .mdb file

TOMDB

 

Target .mdb path

MDBPTH

*DFT

Datasource

CPYSRC

*FILE

Source filename

FROMFILE

 

Library

 

*LIBL

Source member

FROMMBR

*FIRST

SQL query

FROMSQL

'SELECT * FROM'

Query

FROMQRY

 

Library

 

*LIBL

Target table name

TOTBL

 

Add/Replace records

TBLOPT

*ADD

Show result

SHOWDOC

*YES

Unicode transfer

EXESRV

*DFT

Ending option

ENDOPT

*NONE

 

Details

 

  The CPYTOMDB command is used to launch the ACCESS application on a

  P.C. to make different copies in the tables of the active database.

  Data can be added to existing records

  in a table or replace the contents of the table.

  The *MAP *DROP copy technique of CPYF is used every time.

 

 

Automatic Access database choice (SELMDB)

Allows to select the Access database with a visual interface on Windows.

This parameter is mandatory.

Possible values are :

F

(FREE) to enter the database name, and path manually.

S

(SELECT) to open the standard Windows explorer, to parse your directories,
and select the database.

Notice : The value S is only usable in an interactive command line.
When writing a CL program with SEU, only value F can be used.

 

 

Target database (TOMDB)

Specifies the Access database name to create or use.

The database Access file will be create if the database
 specified in the TOMDB does not exist.

Notice : The .mdb must not be specified

Possible values are :

name-of-database

Specifies a database name to create or use.

*CURRENT

The database that was opened during last LAUNCHER Office session
will be used.
This option is useful when the program needs to make several
copies into different tables of the same database.

The *CURRENT value is only applicable if the LAUNCHER Office
connection was not closed since the last CPYTOMDB command.

 

 

Database access path (MDBPTH)

Specifies the database access path.

Possible values are :

*DFT

The special value *DFT means that the default LAUNCHER Office
value will be used for this parameter.
To display or change the default value, select the MDBPTH keyword
 by calling the WRKLNCDFT command.

*NONE

Means that the full path is given in the TOMDB parameter.

access-path

The full access path to find the database, with the following syntax :
C:\Program Files\Launcher400\My databases

Notice : The C:\My Documents\Launcher400 is correct, but
the C:\My Documents\Launcher400\ syntax is not correct.

 

 

Copy Datasource (CPYSRC)

Indicates the origin of the source to copy.

Possible values are:

*FILE

The data to transfer into the database are in database file (LF or PF).

*QRY

The data to transfer into the database are in a query (object type *QRYDFN).

*SQL

The data to transfer into the database are in selected by a SQL SELECT.

 

 

Database File (FROMFILE)

Specifies the name of the file and the library to use to get the data.
This parameter is used when parameter CPYSRC is set to *FILE.
The database file can be physical or logical.

Possible values for the library are :

  *LIBL

         The search is performed in all libraries

         user and system from the list of work libraries

         until the first occurrence is found.

  *CURLIB

         The database file is searched in the library

         during the work, if it is not specified. 

 

 

File member (FROMMBR)

Enter the name of the member that contains the data.
This parameter is used when parameter CPYSRC is set to *FILE.

Possible values are :

*FIRST

The first member of the database file contains the data.

Member-name

Enter the name of the member that contains the data.

 

 SQL request (FROMSQL)

Enter the SQL request to retrieve the records from the AS/400 database.
This parameter is used when parameter CPYSRC is set to *SQL.

 

Query (FROMQRY)

Specifies the name of the query to use to get the data.
This parameter is used when parameter CPYSRC is set to *QRY.

Query-name

Enter the name of the query.

Possible library values are :

*LIBL

The library list is searched to find the library where the query file is located.

Library-name

Enter the name of the library that contains the query file.

 

 

Destination access table (TOTBL)

Specifies the table name in the Access database file.

If the table does not exists, it will be created.

 

 

Add or replace records (TBLOPT)

Specifies how to add the records in the Access Table.

Possible values are :

*ADD

Simply add the records into the table.

*REPLACE

Replace all records with the new ones.

 

 

Show result (SHOWDOC)

Specifies if we must show the table result or not.

Possible values are :

*NO

Do not show the result table.

*YES

Show the result table.

 

Unicode Transfert

     *YES (by default) ou *NO.

 

 

LAUNCHER Office server to use (EXESRV)

Specifies the name or IP address of the PC to use to build the document.

Possible values are :

*DFT

The value from the keyword MDBSRV in file LNCDFTP is used.

*DEV

The data transfer is performed on the PC where the terminal for the current job is located.

*CURRENT

When *CURRENT is specified, the current job must be already connected
 to a LAUNCHER OfficeServer on a PC. That connection will be used.

IP address or name

The data transfer is performed on the specified PC.

Notice : The LAUNCHER Office server application must be running on the PC.

 

Ending Option (ENDOPT)

Specifies what object needs to be closed at the end of the process.

Possible values are :

*ALL

The following elements are closed: Access Database, Access application,
 LAUNCHER Office connection between the job and the PC.

The next CPYTOMDB command will not be able to use the value

         *CURRENT for any parameter.

*APP

The following elements are closed: Access Database, Access application.

The LAUNCHER Office connection between the job and the PC is still active.
The next CPYTOMDB command will be able to use the value

         *CURRENT for the parameter EXESRV.

*DOC

The following elements are closed: - Access Database.

The Access application, and the LAUNCHER Office connection are still active.
The next CPYTOMDB command will be able to use the value

         *CURRENT for the parameter EXESRV.

*CON

Only the LAUNCHER Office connection between the job and the PC is closed.
Word and the document remain in memory.

*NONE

The connection, Access, and the document are left active.
The next CPYTOMDB command will be able to use the value *CURRENT for
the parameters EXESRV and DOC.

 

Example


Description: COPYING A PF AS/400 FILE TO MS ACCESS

The table named "TABLE1" is used for copying.

Note that the path to the database is indicated at

TOMDB parameter and must not be specified in the MDBPATH parameter

If the database already exists, the data in the table is overwritten.

If the database does not exist, it is automatically created and the

TABLE1 table is added.

 

PGM

 

CPYTOMDB SELMDB(F) TOMDB('%LNCDIR%\SAMPLES\R_MDB') +

MDBPTH(*NONE) FROMFILE(SP_CUST) +

TOTBL('TABLE1') TBLOPT(*ADD) UNICOD(*YES) +

EXESRV(*DEV) ENDOPT(*APP)

 

LNCSHELL CMD('%LNCDIR%\Samples\S_LNCSQL.MDB') +

VISIBLE(*YES) ACTION(OPEN) EXESRV(*CURRENT)

 

ENDPGM