Hello Robert,
You can unload individual columns, but not in the form of a SELECT list. The syntax looks like this:
UNLOAD TABLESPACE DSN8D12A.DSN8S81E NOPAD
FROMCOPY <inage_copy_dsn>
FROM TABLE DSN8C10.EMP
(EMPNO, LASTNAME, SALARY DECIMAL EXTERNAL)
WHEN (WORKDEPT = 'D11' AND SALARY > 25000)
The field specification allows you to specify output options (as in SALARY DECIMAL EXTERNAL).
Kind regards,
------------------------------
Gareth Copplestone-Jones
------------------------------
Original Message:
Sent: Thu April 08, 2021 04:42 PM
From: Robert Goodell
Subject: Unload FROMCOPY using a select statement
I'm trying to figure out how to do an unload from a full image copy, while using a select statement. I know we can do this with a normal unload from the active table, and I have tried using the same syntax but my unload fails. The IBM documentation states that you can do a a select just like any other unload. I have not been able to as of yet. Has anyone else been successful with this. I can't seem to be able to find any examples of this syntax online anywhere either. I resorted to just doing a full unload of the image copy and loading that to the table. Then doing a selective unload of the data that I needed, and replacing the data in the table with that unload. It would save a lot of time and resources if I could get the data that we need in the first unload.
The IBM documentation states:
You can select specific rows and columns to unload just as you would for a table space. You can specify the selection criteria with either the PART keyword, the FROM TABLE clause, or both, to qualify tables and rows that are to be unloaded. However, do not include LOB columns in the field specification list. You can unload rows that contain LOB columns only when the LOB columns are excluded.
Syntax I have tried:
UNLOAD TABLESPACE <DB>.<TS>
SELECT CIT_POLICY_ID_NBR FROM <SCHEMA>.<TABLE>
FROMCOPY <IMAGE COPY DSN>
WHERE <SELECTION CRITERIA>
The error that I get:
DSNU049I 098 15:58:54.51 DSNUGPRS - INVALID OPERAND 'SELECT' FOR KEYWORD 'UNLOAD'
------------------------------
Robert Goodell
------------------------------
#Db2forz/OS