Previous Topic: pdm_edit--Configure Server Processes

Next Topic: pdm_halt--Terminate Daemons or Stop Services

pdm_extract--Extract Data from Database

The pdm_extract command extracts data from specified CA SDM database tables or the entire CA SDM database, and outputs it as ASCII-formatted text.

Syntax

This command has the following format:

pdm_extract [-c|-e|-r] [-d] [-h] [-u] [-v] [-C] --B] [-f formatstring| ALL | table1 . . . TableN]

-c

Produces comma-separated value (CSV) output, such as:

"field1","field2","field3"

The -c, -e, and -r output format options are mutually exclusive.

-e

Produces comma-separated value (CSV) output with embedded double quotes escaped by another double quote. For example:

"Text with a "quoted string" in it"

The -c, -e, and -r output format options are mutually exclusive.

-r

Produces left-justified output in the formats if the column labels are not supplied in the input file:

"label":"value"

or

"value"

This option is intended for use with line printers, for example:

Field_Name: Field Value

The -c, -e, and -r output format options are mutually exclusive.

-d

Uses the date format found in the file $NX_ROOT/fig/english/cfg/dataent.fmt (UNIX) or installation-directory\fig\english\cfg\dataent.fmt (Windows), which you can edit to suit your requirements.

-h

Displays help and usage information.

-u

Produces output without headers.

-v

Specifies verbose mode, which writes comments about command progress to stdout.

-C

Changes encoding from UTF-8 to another charset. The default output is UTF-8.

Example: To convert the output to JIS, you would run "-C iso-2022-jp"

Example: To encode to the operating system's native charset, use "DEFAULT" or "NATIVE".

-B

Suppresses the Byte Order Mark if the variable NX_ADD_UTF8_BYTE_ORDER_MARK is set.

The NX_ADD_UTF8_BYTE_ORDER_MARK option is a signature into a file. It allows editors that support UTF-8 to maintain the UTF-8 integrity of the file.

Note: This is only needed for non-ASCII data. If this is not installed, the default behavior omits the Byte Order Mark (BOM). If installed, set it to "1" or "Yes".

-f formatstring

Extracts specific records and fields according to formatstring, which is an SQL subset statement.

For a date after a period, use the following syntax:

pdm_extract -v -f "select id, ref_num from Call_Req where open_date >= DATE '2005-02-24'" > daterange1.txt

For a date range, use the following syntax:

pdm_extract -v -f "select id, ref_num from Call_Req where open_date >= DATE '2004-01-20' and open_date < DATE '2004-02-25'" > daterange2.txt

Note: Use single quotes around the date in the YYYY-MM-DD format.

The syntax for DATE is as follows:

DATE 'yyyy-mm-dd' 

yyyy = integer representing year (between 1970 and 2038)

mm = integer representing month

dd = integer representing day

Examples:

DATE '2005-01-18'
DATE '1999-12-25'

The syntax for TIMESTAMP is:

TIMESTAMP 'yyyy-mm-dd hh.mm.ss[.nnnnnn][[+|-][hh.mm]]

yyyy = integer representing year (between 1970 and 2038)

mm = integer representing month

dd = integer representing day

hh = integer representing hour

mm = integer representing minutes

ss = integer representing seconds

nnnn = optional integer representing fractions of sec.

[+|-][hh.mm] = optional time zone interval.

Examples:

TIMESTAMP '1998-04-28 12:00:00.000000'
TIMESTAMP '2004-10-17 18:30:45'
TIMESTAMP '2005-03-21 12:00:12+08:00'
TIMESTAMP '1999-05-10 09:12:23.005-03:30' 

Note: The -d option is not needed, as it only affects the format of the output.

A command usage example follows:

pdm_extract -f "select * from Call_Req where open_date > TIMESTAMP '2004-01-12 12:00:00'"

In this example, all columns are being extracted from the Call_Req table where the open_date is after midnight 1/12/2004.

ALL

Extracts output from all tables in the database.

table1. . . tableN

Extracts output from the specified tables. Table names must be separated by spaces.

The default format, if none is specified, is an ASCII file compatible with pdm_userload.

More information:

pdm_deref--Dereference ASCII Data

pdm_replace--Replace a Database Table

pdm_userload--Add, Update, and Delete Database Records

rpt_srv--Generate Reports