Page 1 of 1
Can we extracting DB2 table into a PS with delimiter?
Posted: Tue Jan 06, 2015 2:43 pm
by Mandira
Hi
I wanted to know that, can we extract DB2 table to a PS. The data should be separated by delimiter? I want to do it in batch. How can I do that, is there any utility available for this?
Please help me out.
Re: Can we extracting DB2 table into a PS with delimiter?
Posted: Tue Jan 06, 2015 4:16 pm
by zprogrammer
Hi Mandira,
Yes, It is possible to extract DB2 table into a PS with delimiter using UNLOAD utility
Check the
link for Example 9: Unloading data into a delimited file.
Re: Can we extracting DB2 table into a PS with delimiter?
Posted: Tue Jan 06, 2015 4:25 pm
by Anuj Dhawan
One does not extract anything from DB2 - "unload" is a better word here, I believe. Said that, along with what Pandora-Box has suggested, you might also use a JCL like this:
Code: Select all
//UL001 EXEC PGM=IKJEFT01,
// DYNAMNBR=20
//*
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSPUNCH DD SYSOUT=*
//*
//SYSTSIN DD *
DSN SYSTEM(XXXX)
RUN PROGRAM(DSNTIAUL) PLAN(DSNTIAUL) PARM('SQL')
//*
//SYSREC00 DD DSN=...TBL.UNLOAD.FILE,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,LRECL=80
//SYSIN DD *
SELECT COLUMN1
,CHAR('|'),COLUMN2
,CHAR('|'),COLUMN3
,CHAR('|'),COLUMN4
,CHAR('|'),COLUMN5
FROM TABLE_NAME
WITH UR;
/*
//*
Hope this helps.