|
View previous topic :: View next topic
|
| Author |
Message |
socker_dad
Active User

Joined: 05 Dec 2006 Posts: 177 Location: Seattle, WA
|
|
|
|
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 |
|
 |
agkshirsagar
Active Member

Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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 |
|
 |
socker_dad
Active User

Joined: 05 Dec 2006 Posts: 177 Location: Seattle, WA
|
|
|
|
| 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 |
|
 |
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
| 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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|