service progarm

5 pts.
Tags:
RPGLE
how serivce programs are created .pls tell me steps of creataing a service program.

Answer Wiki

Thanks. We'll let you know when a new response is added.

The <a href=”http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/books/c092507602.htm”>ILE RPG Programmers Guide</a>does a pretty good job of describing how to build a *SRVPGM.

The essentials are that you build one or more modules such as:

<pre>
h NoMain

dDisplay pr extproc(‘Display’)
d InputNbr 10i 0

pDisplay b export

dDisplay pi
d InputNbr 10i 0

/free

dsply InputNbr;
return;

/end-free

pDisplay e
</pre>

and

<pre>
h NoMain

dAlter pr extproc(‘Alter’)
d InputNbr 10i 0

pAlter b export

dAlter pi
d InputNbr 10i 0

/free

dsply InputNbr ‘ ‘ InputNbr;
return;

/end-free

pAlter e
</pre>

compiled with

<pre>
crtrpgmod display
crtrpgmod alter
</pre>

create your *SRVPGM with

<pre>
CRTSRVPGM SRVPGM(SAMPLE) MODULE(ALTER DISPLAY) EXPORT(*ALL)
</pre>

assuming you want to export both function Display and Alter. You don’t have to.

You now have a *SRVPGM.

One way to use the *SRVPGM is to now:

<pre>
CRTBNDDIR BNDDIR(SAMPLE)
ADDBNDDIRE BNDDIR(SAMPLE) OBJ((SAMPLE))
</pre>

Write a *PGM such as:

<pre>
h dftactgrp(*no) bnddir(‘SAMPLE’)

dAlter pr extproc(‘Alter’)
d InputNbr 10i 0

dDisplay pr extproc(‘Display’)
d InputNbr 10i 0

dNumber s 10i 0 inz(13)

/free

Display(Number);
Alter(Number);
Display(Number);
*inlr = *on;
return;

/end-free
</pre>

compile with CRTBNDRPG USESAMPLE
and then CALL USESAMPLE

You should see a prompt of ‘DSPLY 13′ from function Display
followed by a prompt ‘DSPLY 13 13′ from function Alter
type in 14, hit Enter, and you should see a prompt of ‘DSPLY 14′ from the second call to Display.

Bruce Vining
<a href=”http://www.brucevining.com/”>http://www.brucevining.com/</a>

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following