Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Stored Procedure perform code multiple times - HOW????

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

New User


Joined: 13 Jul 2007
Posts: 18
Location: Pennsylvania

PostPosted: Fri Apr 23, 2010 5:16 pm    Post subject: Stored Procedure perform code multiple times - HOW????
Reply with quote

Hi there
We doing an audit trail and for each field I need to call a Stored procedure (SP2) which insert a record to the audit table. I want to do a sort of perform in my current Stored Procedure (SP1) but is not sure how..

Set field1 to abc...
Set field2 to abc...

Call SP2

Set field1 to cde...
Set field2 to cde...

Call SP2
.
Set......
I need to call SP2 multiple times and was wondering if I could create a LOOP or something that will iterate the same call... Is it possible? where do I find information on that...
Thanks in Advance
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Apr 23, 2010 7:06 pm    Post subject:
Reply with quote

you can multi-post all you want,
but maybe you could just bother to read the manual?

DB2 for z/OS Stored Procedures - IBM Redbook

DB2 vsn 9 for z/OS Stored Procedures - IBM Redbook

Stored Procedures, Triggers, UDF for ISeries - IBM Redbook
Back to top
View user's profile Send private message
prgaj1

New User


Joined: 13 Jul 2007
Posts: 18
Location: Pennsylvania

PostPosted: Fri Apr 23, 2010 8:33 pm    Post subject:
Reply with quote

If I could find it in a manual I would not have asked.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Fri Apr 23, 2010 9:12 pm    Post subject:
Reply with quote

Prgaj1,

Quote:
I need to call SP2 multiple times and was wondering if I could create a LOOP or something that will iterate the same call... Is it possible?


Did you try ? Did you get any errors ?

Sushanth
Back to top
View user's profile Send private message
prgaj1

New User


Joined: 13 Jul 2007
Posts: 18
Location: Pennsylvania

PostPosted: Mon Sep 27, 2010 2:10 pm    Post subject:
Reply with quote

Sushanth I got a work around could not find anything in the manual like I assume Dick Brenholtz could not either that is why he was so unhelpful and rude..
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Sep 27, 2010 2:17 pm    Post subject:
Reply with quote

prgaj1 wrote:
why he was so unhelpful and rude.


is just another way of crying like a little baby, because I did not give you code to accomplish your task.

Since you did not bother to explain
from which programming language you were invoking the SP,
how do you expect anyone to provide you code
or actually do your work for you.

besides, it is sort of a non-question.
what do you mean invoke multiple times.
you want to loop the following:
populate parms
call

the population of the parms is the key to the loop.
you explained nothing about the source of the data/values for the parms.
your problem lies more in the area not being able to explain your requirement,
and less about a members 'social graces'.
Back to top
View user's profile Send private message
prgaj1

New User


Joined: 13 Jul 2007
Posts: 18
Location: Pennsylvania

PostPosted: Mon Sep 27, 2010 2:57 pm    Post subject:
Reply with quote

If you were helpful you would have ask if you did not understand what was asked...
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Mon Sep 27, 2010 3:02 pm    Post subject: Reply to: Stored Procedure perform code multiple times - HOW
Reply with quote

if instead of fussing You had posted some meaningful info
You would have got better replies

read and meditate on
How To Ask Questions The Smart Way
http://catb.org/~esr/faqs/smart-questions.html
to make the most out of the questions You ask
Back to top
View user's profile Send private message
prgaj1

New User


Joined: 13 Jul 2007
Posts: 18
Location: Pennsylvania

PostPosted: Mon Sep 27, 2010 3:10 pm    Post subject:
Reply with quote

Thanks Enrico I will bookmark and next time refer to it to make sure I ask the question correct. I still feel it was not necessary for the Eric to be rude about it... Surely one do not ask a question before checking in manuals and with collegues... next time I will follow your advise on how to ask...
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Mon Sep 27, 2010 3:15 pm    Post subject: Reply to: Stored Procedure perform code multiple times - HOW
Reply with quote

Quote:
Surely one do not ask a question before checking in manuals and with collegues...


if You look carefully at the forums the vast majority of the questions asked
would not have been asked if the TS had looked at the manuals

so statistics and forum experience hint that the first suggestion to give is RTFM icon_biggrin.gif
Back to top
View user's profile Send private message
mallik4u

New User


Joined: 17 Sep 2008
Posts: 75
Location: bangalore

PostPosted: Mon Sep 27, 2010 3:19 pm    Post subject:
Reply with quote

Hi Prga1,

I am assuming that you have coded your stored procedures using DB2-SQL.
SQL has WHILE keyword for doing looping in DB2.

WHILE <condition> DO
<your SQL statements...>
END-WHILE
Back to top
View user's profile Send private message
prgaj1

New User


Joined: 13 Jul 2007
Posts: 18
Location: Pennsylvania

PostPosted: Mon Sep 27, 2010 3:24 pm    Post subject:
Reply with quote

Thank you I see where you come from. I do not post a lot as most of the time I find what I need in previous posts, so that should indicate to me that the vast majority just ask before check for themselves. I have learned a lot about syncsort by just reading previous post without any before hand knowledge, so your statement is true. icon_redface.gif
Back to top
View user's profile Send private message
prgaj1

New User


Joined: 13 Jul 2007
Posts: 18
Location: Pennsylvania

PostPosted: Mon Sep 27, 2010 4:21 pm    Post subject:
Reply with quote

Hi Mallik; that you very much I it was exactly what I used. We converting some COBOL programs to SQL SP's and I just did not know how on earth to do the perform. The SQL WHILE statement is actually convertion for a COBOL PERFORM UNTIL statement but I got it work for the normally COBOL PERFORM statement with a bit of IF logic inside the DO WHILE loop... I tried the "LOOP" statement but not sure I quite understand it because I needed to perform my routine for different senarios at different times, it was quite fun testing it but it work and is implemented already.
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 What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am
No new posts IDEAL - Code Retrieval yugendran CA Products 0 Fri Nov 25, 2016 3:27 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
This topic is locked: you cannot edit posts or make replies. Need to code a Rexx PGM sundaram.naveen CLIST & REXX 18 Thu Oct 06, 2016 6:45 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us