CRTPGM VS CRTSRCPGM

120 pts.
Tags:
CRTPGM
CRTSRVPGM
Hi I just wanted to know the differences betweent the below 2 scenarios: Scenario1: ------------ Create modules of rpgle codes mycode1 and mycode2 and then combine them using CRTPGM command. Scenario 2: ------------- Create modules of rpgle codes mycode1 and mycode2 and then create service program for them. Is there any difference between the abvoe mentioned situations apart from the difference that Scenario 2 will can not by called by itself. Thanks Vivek

Software/Hardware used:
AS400

Answer Wiki

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

A service program cannot be called from the command line, nor called directly from within a program using CALLB or the like. You can define only sub procedures and their interfaces in a service program then at the point of compilation create the exports. A service program ‘call’ from an ILE program is achieved by referring to a procedure exported from the service program example as follows:

D RetreiveIPAddr PR 20a extproc(‘RETREIVEIPADDR’)
D Device 10a const

* Retrieve IP Address
C eval ipaddress = RetreiveIPAddr(Device)

ensuring of course that the service program is bound in at the CRTPGM stage using the BNDSRVPGM option.

Discuss This Question: 2  Replies

 
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
  • TomLiotta
    Is there any difference between the abvoe mentioned situations apart from the difference that Scenario 2 will can not by called by itself. Yes, a very significant difference. When you create a service program, you should do it along with a "binder language" member. This can help greatly in the future when you add new procedures to your service program.l Binder language can allow you to add functions (procedures) to your service programs without needing to recreate the programs that bind to your service programs. You can recompile/recreate your service programs, and your programs that use them can keep working automatically. The ILE Concepts manual has lots of good info on service programs and binder language. It includes a handy appendix of many common binder language errors along with 'suggested changes'. Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    The scenarios seem to be (1) create a program so that other programs can CALL the new program, and (2) create a service program so that programs can call into it. Are those the two scenarios you intended? If so, there isn't a lot of difference between the two for many developers. A dynamic CALL can give results very comparable to calling procedures out of service programs. The big differences can come later, for example when new functions need to be added to the service program and the interface changes. If you call a program and the parameter list has to change, you often need to change every program that calls it. That's not necessary with a service program. Scenario 2 will can not by called by itself. But where did you get the idea that a service program couldn't call itself? And where did you get the idea that an RPGLE program can call itself? Tom
    125,585 pointsBadges:
    report

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