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

Write an INSERT to a table using a control card in JCL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
tushar_study

New User


Joined: 01 Feb 2007
Posts: 30
Location: Mumbai

PostPosted: Thu Feb 14, 2008 9:20 am
Reply with quote

I have a scenario wherein I need to write an INSERT to a table using a control card in JCL.The values to be inserted into the table columns may vary so i want to pass them through the job card.How do i do it.

Please help.


Thanks in advance
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Feb 14, 2008 9:25 am
Reply with quote

Hello,

You cannot directly issue SQL commands in JCL.

Values cannot be passed on the JOB statement. . .

I'd suggest you talk with someone in your project and see which utility/method is used for this kind of requirement on your system.
Back to top
View user's profile Send private message
tushar_study

New User


Joined: 01 Feb 2007
Posts: 30
Location: Mumbai

PostPosted: Thu Feb 14, 2008 9:34 am
Reply with quote

I am sorry that I goofed up my xplaination.I meant that the SQL will receive the value to inserted throug the PROC.The SQL will be written in the SYSIN DD *(Equivalent to a control card).Please help me with a short example.



Regards
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Thu Feb 14, 2008 12:52 pm
Reply with quote

search for SPUFI in batch.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Feb 14, 2008 8:39 pm
Reply with quote

Hello,

Did you find some batch SPUFI example(s)?

Quote:
The SQL will be written in the SYSIN DD *(Equivalent to a control card).Please help me with a short example.
I suspect that your batch SPUFI execution will use a SYSIN DD DSN= rather than a DD * (if you have a PROCedure for your process.

Once you have your jcl and control statements, post them here if there are questions.
Back to top
View user's profile Send private message
tushar_study

New User


Joined: 01 Feb 2007
Posts: 30
Location: Mumbai

PostPosted: Thu Feb 14, 2008 11:39 pm
Reply with quote

Hi ,

I tried a SELECT in my control card

Select * from MYTABLE
where SOME_DATE=&PARM1;

I was passing the PARM1 from my Job.It shows an error msg that PARM1
not used in PROC.Please suggest an alternative.


Regards
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Thu Feb 14, 2008 11:47 pm
Reply with quote

tushar_study wrote:
Hi ,

I tried a SELECT in my control card

Select * from MYTABLE
where SOME_DATE=&PARM1;

I was passing the PARM1 from my Job.It shows an error msg that PARM1
not used in PROC.Please suggest an alternative.


Regards


Control cards and other such cards are not JCL and there is no symbolic substitution for them.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Fri Feb 15, 2008 12:00 am
Reply with quote

Try this, but it's a bit involved:

1. set up a file with your SQL as a template, with place-holding names like YYYY-MM-DD
2. write a program (SAS, COBOL, etc.) to take a PARM populated in JCL with your symbolic and copy the template to another file (e.g., &&SQL), replacing YYYY-MM-DD with the parm
3. pass &&SQL to the SPUFI's SYSIN
Back to top
View user's profile Send private message
tushar_study

New User


Joined: 01 Feb 2007
Posts: 30
Location: Mumbai

PostPosted: Fri Feb 15, 2008 1:25 am
Reply with quote

Hi Folks,

Thats great .I will write a Cobol program
Back to top
View user's profile Send private message
lenin

New User


Joined: 12 Oct 2007
Posts: 11
Location: Chennai

PostPosted: Mon Feb 18, 2008 6:21 pm
Reply with quote

HI tushar,

I could partly help for your requirement.

1. I agree we can not pass a parm value inside a JCL control card. We have search for some thing else.

2.But we can execute SQL as Control card though a JCL. The pgm is IKJEFT01

pls find the below piece of JCL.

//STEP01 EXEC PGM=IKJEFT01
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//LISTING DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSPUNCH DD DUMMY
//SYSREC00 DD DSN=<Output PS>,DISP=SHR
//SYSTSIN DD *
DSN SYSTEM(DBBG)
RUN PROGRAM(DSNTIAUL) PLAN(DSNTIBSP) -
LIB('SYSD.DBBG.RUNLIB.LOAD')
END
/*

//SYSIN DD DSN=<Query stored in PS or PDS>,DISP=SHR


Thanks,
Lenin
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Multiple table unload using INZUTILB DB2 2
Search our Forums:

Back to Top