Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Db2 Row Insert Using IKJEFT01

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
socker_dad

Active User


Joined: 05 Dec 2006
Posts: 147
Location: Columbia, MO

PostPosted: Thu Feb 21, 2008 5:29 am    Post subject: Db2 Row Insert Using IKJEFT01
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: 686
Location: Earth

PostPosted: Thu Feb 21, 2008 2:58 pm    Post subject:
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: 147
Location: Columbia, MO

PostPosted: Fri Feb 22, 2008 6:06 am    Post subject: Reply to: Db2 Row Insert Using IKJEFT01
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Calling IKJEFT01 program from Rexx upendrasri CLIST & REXX 8 Wed Nov 15, 2017 4:27 pm
No new posts How to insert a value on specific pos... Poha Eater DFSORT/ICETOOL 9 Sun Oct 01, 2017 3:04 am
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts Insert Lines in JCL with Rexx after a... Willy Jensen CLIST & REXX 3 Tue Aug 30, 2016 4:18 pm
No new posts How to insert a lengthy string havin... vidyaa DB2 7 Thu Aug 25, 2016 5:20 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us