PreviousNext
Help > Programming with LAUNCHER Office > LNCCMD commands > Commands list > DBFXFER command
DBFXFER command

Transfer a database file, SQL result set, or IFS document, from the iSeries to the PC.

The PC file resulting from a database file or SQL result set transfer will be in text format.

 

Syntax

 

CHGVAR

VAR(&CMD) VALUE('DBFXFER')

CHGVAR

VAR(&PARM1) VALUE('
File="
Destination file on PC"
[;UNICODE
=True/False]
[;Fixed
=True/False]
[;FixedNL
=True/False]
[;ColHdg
=True/False]
[;Delimiter
="Delimiter"]
[;DecimalPt
="Decimal point"]
[;QuoteText
=True/False]
[;DescFile
=True/False]
')

CHGVAR

VAR(&PARM2) VALUE('
MAXREC
=Maximum number of records ;
COLHDG
=LNAME / COLHDG / SNAME ;
<
Database file name / IFS document / SQL statement>
')

CALL

PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 &PARM2+ &RESULT)

 

 

 

 

 

 

 

Parameters

 

Parameters

 

Parm1

Parm1 contains options that will be interpreted by LAUNCHER Office on the PC.

File=Full path to the resulting file to create on the PC.
If the keyword "FILE=" is missing, then, the whole parameter Parm1 contains the path to the file.

UNICODE=True / False (Default=False).
By default, the data are stored in 8-bit characters set in the destination file.
With UNICODE format a 16-bit characters set is used.

Fixed=True / False (Default =False).
By default, the file will be in CSV format. Columns are separated by a semicolon (;).
If Fixed is true, the columns will have a fixed size, with no column or line separator.

FixedNL
Like for Fixed, columns will have a fixed size, but the lines will be separated by a "new line" character.

ColHdg=True / False (Default =True). By default, the first line in the destination file will contain the columns headings or names.
If ColHdg is false, the data will start from the first line.

Delimiter : The default column delimiter is the semicolon (;). This delimiter can be changed here.
Example: Delimiter=","
The delimiter can be totally deleted by:
Delimiter=""
If the file has only one field, for compatibility with MS Office, a delimiter is added at the end of each line.

DecimalPt : The default decimal point will be the one defined in the Windows environment. It can be changed here.
Example: DecimalPt=","

QuoteText=True / False (Default =True). The column values are between two double quote characters. Set QuoteText to false to remove those double quotes.

DescFile=True / False (Default =True). A description file (*.LFD) is generated during the file transfer. This decription file is used by LAUNCHER Office when exporting te data to Excel.
To spare resources, set DescFile To False.

 

Parm2

Parm2 contains options interpreted by LAUNCHER Office on the AS/400.

These options must be at the beginning of Parm2, separated by semicolons ( ;). The name of the AS/400 data source is at the end of Parm2.

MAXREC=Number; With this option, you can set the maximum number of record to transfer. By default, there is no limit.

COLHDG= LNAME / COLHDG / SNAME
The column heading on the PC file will consist of :
If COLHDG=LNAME : the long field names or Alias.
If COLHDG=COLHDG : the column headings.
If COLHDG=SNAME : the short field names (Default).

 

Database file name : Give here a database file name, with eventually its library and member name.
The syntax for a qualified name is : LIBRARY/FILE(MEMBER)

IFS Document : Enter here the full path to the file in the IFS, starting with keyword « DOCUMENT:»
Example : ‘DOCUMENT:/qdls/docfolder/info.pdf’

SQL Result set : The keyword « SQL:» is followed by the SQL statement.
Example : ‘SQL:select * from customer where dept=”75’’’.
To qualify a file path, separate the library name from the file name with a point character, as defined by SQL syntax.
Example : ‘SQL:select * from mylib.myfile’

 

RESULT

On return, variable &RESULT contains the number of transferred records (9 digits).

 

 

This transfer function doesn’t require any other software than LAUNCHER installed on the PC.

To transfer a document from the IFS to the PC, you don’t need to connect a virtual drive to the IFS.

 

Note : .lfd file is also created.

 

Example

 

CHGVAR

VAR(&CMD) VALUE('DBFXFER')

CHGVAR

VAR(&PARM1) VALUE('file="%LNCDIR%\fusion.txt ')

CHGVAR

VAR(&PARM2) VALUE('COLHDG=LNAME;LAUNCHER/SP_CUST')

CHGVAR

VAR(&CMD) VALUE('DBFXFER')

CHGVAR

VAR(&PARM1) VALUE('%TEMP%\readme.txt')

CHGVAR

VAR(&PARM2) VALUE('DOCUMENT:/home/qsecofr/vim-6.3/readme.txt')

CHGVAR

VAR(&CMD) VALUE('DBFXFER')

CHGVAR

VAR(&PARM1) VALUE('%TEMP%\trf.txt ')

CHGVAR

VAR(&PARM2) VALUE('MAXREC=100;SQL:select * from customer')