How to use Join while using DSNUTILB for unload

IBM's flagship relational database management system
User avatar
Prasanna G
Posts: 71
Joined: Tue Apr 12, 2011 9:49 pm
Skillset: JCL, Cobol, DB2
Referer: Internet

How to use Join while using DSNUTILB for unload

Postby Prasanna G » Thu Jul 04, 2024 10:14 am

Hi

Can anyone let me know the sample unload card that can be used to unload table A by joining Table B. I am getting error when I try to use the below control card

Code: Select all


UNLOAD TABLESPACE DBAPC001.TSAPCACT PART 5
NOPAD MAXERR 1
SHRLEVEL CHANGE ISOLATION UR
FROM APCWTBT.TBAPCACT A, DGSWTBT.TBDGSACT B
WHERE A.MLACNO =B.MLACNO
 


Error

Code: Select all


INVALID OPERAND 'A' FOR KEYWORD 'FROM'
 

User avatar
sergeyken
Posts: 458
Joined: Wed Jul 24, 2019 10:12 pm
Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
Referer: Internet search

Re: How to use Join while using DSNUTILB for unload

Postby sergeyken » Fri Jul 05, 2024 5:35 am

RTFM:
1) UNLOAD TABLESPACE syntax is not compatible with FROM TABLE syntax.
2) FROM TABLE syntax is not the same as SELECT FROM syntax

Read here carefully
Javas and Pythons come and go, but JCL and SORT stay forever.

User avatar
Prasanna G
Posts: 71
Joined: Tue Apr 12, 2011 9:49 pm
Skillset: JCL, Cobol, DB2
Referer: Internet

Re: How to use Join while using DSNUTILB for unload

Postby Prasanna G » Fri Jul 05, 2024 5:51 am

Hi Sergeyken

Is it possible to get the table A partition 5 data based on joining with table B. I know

Code: Select all


Select a.* From table1 a, table2 b
Where a.key=b.key
 


Works.. is there any other way

User avatar
sergeyken
Posts: 458
Joined: Wed Jul 24, 2019 10:12 pm
Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
Referer: Internet search

Re: How to use Join while using DSNUTILB for unload

Postby sergeyken » Fri Jul 05, 2024 5:06 pm

Prasanna G wrote:Hi Sergeyken

Is it possible to get the table A partition 5 data based on joining with table B. I know

Code: Select all


Select a.* From table1 a, table2 b
Where a.key=b.key
 


Works.. is there any other way

The SELECT statement, and UNLOAD utility - those are two completely different entities.
Is your problem with either SELECT, or UNLOAD?
Javas and Pythons come and go, but JCL and SORT stay forever.

User avatar
Prasanna G
Posts: 71
Joined: Tue Apr 12, 2011 9:49 pm
Skillset: JCL, Cobol, DB2
Referer: Internet

Re: How to use Join while using DSNUTILB for unload

Postby Prasanna G » Fri Jul 05, 2024 5:11 pm

I would like to unload the partition 5 of table A for the matching rows of Table B.

User avatar
sergeyken
Posts: 458
Joined: Wed Jul 24, 2019 10:12 pm
Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
Referer: Internet search

Re: How to use Join while using DSNUTILB for unload

Postby sergeyken » Fri Jul 05, 2024 6:05 pm

Prasanna G wrote:I would like to unload the partition 5 of table A for the matching rows of Table B.

Why not to read the manual on UNLOAD utility?

Plus: read #1 of my first reply.
Javas and Pythons come and go, but JCL and SORT stay forever.

engh
Posts: 17
Joined: Fri Jul 08, 2022 7:29 pm
Skillset: leblesmoutilabiskouti
Referer: leblesmoutilabiskouti

Re: How to use Join while using DSNUTILB for unload

Postby engh » Wed Sep 04, 2024 7:41 pm

since the SQL 1992 standard, joins are no longer coded in the WHERE restriction, but with the JOIN operator.
it would be time to get started.
In addition, SELECT * compromises the use of covering indexes if they exist and makes impact studies inoperative, moreover, with joins, the joined columns appear as many times as there are joined tables...
instruction to be replaced by the list of columns useful for processing!


  • Similar Topics
    Replies
    Views
    Last post