IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Db2 Row Insert Using IKJEFT01


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
socker_dad

Active User


Joined: 05 Dec 2006
Posts: 177
Location: Seattle, WA

PostPosted: Thu Feb 21, 2008 5:29 am
Reply with quote

I have been using IKJEFT01 to insert rows into a DB2 table via batch successfully. However, it's annoying to run the job 8 times (or with 8 steps), inserting one row at a time.

Is there a way to use IKJEFT01 to perform multiple row inserts in one pass?

Here's my job:

Code:

//MV603IN JOB (7350,SLZZ,MSLZZB,00),'MV603  ',                   
//            MSGCLASS=O,CLASS=T,REGION=0M,NOTIFY=MV603               
//*===================================================================*
//  SET  PROJECT=MVD                                                   
//  SET  ENVIR=ENVA                                                   
// JCLLIB ORDER=(MVD.&ENVIR..CTM.JCL)                                 
//        INCLUDE MEMBER=IJOBLIB                                       
//        INCLUDE MEMBER=IDSNPRMS                                     
//        INCLUDE MEMBER=IOUTPUT                                       
//        INCLUDE MEMBER=IMISCELL                                     
//*********************************************************************
//*   INSERT DATA INTO THE DB2 TABLE                                   
//*********************************************************************
//STEP1   EXEC PGM=IKJEFT01,DYNAMNBR=20,TIME=300                       
//SYSTSPRT DD SYSOUT=*                                                 
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SYSUDUMP DD SYSOUT=*                                                 
//SYSTSIN  DD DISP=SHR,DSN=MV603.INCLUDE.CNTL(SYSTSIN)                 
//SYSIN    DD DISP=SHR,DSN=MV603.INCLUDE.CNTL(INSERT06)               
/*                                                                     



The SYSTSIN is:

Code:

DSN SYSTEM(DSN )                                           
RUN PROGRAM(DSNTEP2) PLAN(DSNTEP2) PARMS('/ALIGN(LHS)') - 
     LIB('SYS2.SDSNLOAD.DSN')                             


and the INSERT command is:

Code:

INSERT INTO MENVA1.TDLVAR                                             
   VALUES('60','000058060','2008-02-19-08.05.01.462266',             
                       'N','2008-02-19-08.05.01.462266',             
  09,'10/17/2006','01/01/0001','01/01/0001','01/01/0001','01/01/0001',
  '01/01/0001',0,0,0,'5',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
  ' ',' ',' ',' ','01/01/0001','01/01/0001','01/01/0001','01/01/0001',
  '01/01/0001','01/01/0001',' ')                                     
  ;                                                                   



I've tried using additional VALUES clauses within the PDS, and repeating the data without the keyword VALUES, but neither works.

Suggestions?
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu Feb 21, 2008 2:58 pm
Reply with quote

I don't have mainframe access to test this but you can give it a try as I feel it should work.
Code:
INSERT INTO MENVA1.TDLVAR                                             
  SELECT (COL1,COL2,COL3,COL4,...) FROM
(SELECT '60','000058060','2008-02-19-08.05.01.462266',             
                       'N','2008-02-19-08.05.01.462266',             
  09,'10/17/2006','01/01/0001','01/01/0001','01/01/0001','01/01/0001',
  '01/01/0001',0,0,0,'5',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
  ' ',' ',' ',' ','01/01/0001','01/01/0001','01/01/0001','01/01/0001',
  '01/01/0001','01/01/0001',' '  FROM SYSIBM.SYSDUMMY1
UNION ALL
SELECT '60','000058060','2008-02-19-08.05.01.462266',             
                       'N','2008-02-19-08.05.01.462266',             
  09,'10/17/2006','01/01/0001','01/01/0001','01/01/0001','01/01/0001',
  '01/01/0001',0,0,0,'5',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
  ' ',' ',' ',' ','01/01/0001','01/01/0001','01/01/0001','01/01/0001',
  '01/01/0001','01/01/0001',' '  FROM SYSIBM.SYSDUMMY1
UNION ALL
SELECT '60','000058060','2008-02-19-08.05.01.462266',             
                       'N','2008-02-19-08.05.01.462266',             
  09,'10/17/2006','01/01/0001','01/01/0001','01/01/0001','01/01/0001',
  '01/01/0001',0,0,0,'5',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
  ' ',' ',' ',' ','01/01/0001','01/01/0001','01/01/0001','01/01/0001',
  '01/01/0001','01/01/0001',' '  FROM SYSIBM.SYSDUMMY1
   )    ;
Back to top
View user's profile Send private message
socker_dad

Active User


Joined: 05 Dec 2006
Posts: 177
Location: Seattle, WA

PostPosted: Fri Feb 22, 2008 6:06 am
Reply with quote

It didn't work......I got an error regarding an invalid comma. Which one of the hundred or so it wouldn't say.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Feb 22, 2008 6:25 am
Reply with quote

You should just be able to repeat the whole insert statement with different values. Each insert is a seperate SQL statement (and needs to be terminated with a ;).
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
No new posts Insert system time/date (timestamp) u... DFSORT/ICETOOL 5
No new posts Identify Program Insert DB2 7
No new posts Insert trailer for non empty file only DFSORT/ICETOOL 6
No new posts Merge files with a key and insert a b... DFSORT/ICETOOL 6
Search our Forums:

Back to Top