Can we extracting DB2 table into a PS with delimiter?

RDBMS from IBM and IBM's Hierarchical DBMS and Transaction Manager (IMS DC).
Post Reply
Mandira
New Member
Posts: 7
Joined: Sat Jul 12, 2014 10:48 am

Can we extracting DB2 table into a PS with delimiter?

Post 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.
zprogrammer
Global Moderator
Global Moderator
Posts: 588
Joined: Wed Nov 20, 2013 11:53 am
Location: Mars

Re: Can we extracting DB2 table into a PS with delimiter?

Post 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.
zprogrammer
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Can we extracting DB2 table into a PS with delimiter?

Post 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.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM DB2 and IMS DB/DC”