Sunteți pe pagina 1din 6

Adding 'Value' to Your Prototypes | IBM i | IBM Systems Magazine

1 of 6

http://www.ibmsystemsmag.com/ibmi/december04/spotlight/8303p3.aspx

Administrator
Backup and Recovery
DB2
High Availability
LPAR
Networks
Performance
Security
Systems Management
Tivoli
Trends
AIX
Linux
Open Source
What's New
Tips & Techniques
Application Development
Systems Management
Miscellaneous
Case Studies
Automotive
Healthcare
Manufacturing
Miscellaneous
Non-profit
Retail
Storage
Disk
Servers
Software
Tape
Product News
Buyer's Guide
Administrator
Backup and Recovery
DB2
Domino
High Availability
LPAR
Networks
Performance
Printing
Security
Systems Management
WebSphere
Windows Integration
Developer
General
Java
Modernization
RPG
WebSphere
Trends
IBM Announcements
Linux
Open Source
SOA
What's New
Tips & Techniques
Application Development

9/27/2010 10:53 AM

Adding 'Value' to Your Prototypes | IBM i | IBM Systems Magazine

2 of 6

http://www.ibmsystemsmag.com/ibmi/december04/spotlight/8303p3.aspx

Systems Management
Case Studies
Automotive
Banking/Finance
Healthcare
Insurance
Manufacturing
Miscellaneous
Non-profit
Retail
Storage
Disk
Optical
Servers
Tape
Product News
Product Reviews
ENDPGM Main Page
Administrator
Backup and Recovery
CICS
DB2
High Availability
IMS
LPAR
Migration
Networks
Performance
Security
Systems Management
Tivoli
Trends
Linux
Open Source
Security
SOA
What's New
z/OS
z/VM
Tips & Techniques
Application Development
Systems Management
Case Studies
Automotive
Banking/Finance
Healthcare
Insurance
Manufacturing
Miscellaneous
Retail
Storage
Disk
Servers
Software
Tape
Product News
Stop Run
Buyer's Guide Main Page

9/27/2010 10:53 AM

Adding 'Value' to Your Prototypes | IBM i | IBM Systems Magazine

3 of 6

http://www.ibmsystemsmag.com/ibmi/december04/spotlight/8303p3.aspx

Business Strategy
Competitive Advantage
Consolidation
Executive Perspective
Green IT
Migration
Open Source
ROI
Infrastructure
Blades
Storage
Systems Management
Case Studies
Distribution
Healthcare
Manufacturing
Services
Web 2.0
Cloud
Social Media
Trends
Collaboration
IBM Announcements
IBM Research
Open Source
Social Media
What's New
Product News

AIX
MAINFRAME
POWER
Newsletters
About Us

Subscribe
Current Issue
Archive

IBM i
ALL EDITIONS
ADMINISTRATOR
DEVELOPER
TRENDS
TIPS & TECHNIQUES
CASE STUDIES

9/27/2010 10:53 AM

Adding 'Value' to Your Prototypes | IBM i | IBM Systems Magazine

4 of 6

http://www.ibmsystemsmag.com/ibmi/december04/spotlight/8303p3.aspx

STORAGE
PRODUCT NEWS
ENDPGM
BUYER'S GUIDE

Product News

Presented by:

ASG

Adding 'Value' to Your Prototypes


December 2004 | by Jon Paris and Susan Gantner
Print

Email

Note that the prototype specifies CmdString as being a pointer, passed by VALUE. By using Options(*String), we have allowed ourselves to pass the variable
Command, and the compiler does the work for us. The result is that we can pass a character field (not a pointer) to the function on the call. If you use a regular RPG
variable, rather than the variable-length field, remember to use %Trim when passing the parameter. If you're running V5R3 or later, you can avoid this by coding
Options(*Trim) on the parameter.
We've covered the basic prototyping information to make use of the C-function library, including the use of EXTPROC, VALUE and OPTIONS(*STRING). Some
more advanced C functions require the use of call-back procedures in your RPG program. Click here for an example of using this with the qsort function.
In the meantime, a few more details are necessary to make all of this work. First, you must specify the Binding Directory name QC2LE, preferably on your RPG
programs H spec. This is the binding directory that references all of the service programs in the C-function library. The system binder needs this to locate the
functions when creating your program.
If you prefer to use the Create Bound RPG (CRTBNDRPG) command (or option 14 in PDM) to compile your code, you must also specify DFTACTGRP(*NO) to
allow for bound calls. This can also be specified on the H spec. Here's how your H spec might appear:
H BndDir('QC2LE') DftActGrp(*No)
More Information
If you find a C function that you would like to use and need some help in translating the C data types into RPG data types, you can find that information as well as
some other examples on calling C functions from RPG in the IBM Redbook, "Who Knew You Could Do That with RPG IV?"
Try your hand at using C functions to open up your code to the C-function librarys power.

Page 1 2 3
Jon Paris is a technical editor with IBM Systems Magazine and co-owner of Partner400.
More Articles From Jon Paris
Susan Gantner is a technical editor with IBM Systems Magazine and co-owner of Partner400.
More Articles From Susan Gantner

Advertisement

9/27/2010 10:53 AM

Adding 'Value' to Your Prototypes | IBM i | IBM Systems Magazine

5 of 6

http://www.ibmsystemsmag.com/ibmi/december04/spotlight/8303p3.aspx

How Frontline Homeowners Insurance SOA - Enables their IBM i Policy and Claims Applications
Wednesday, October 13, 2010 - 2pm EST

Advertisement

Maximize your IT investment with monthly information from THE source...IBM Systems Magazine EXTRA & Marketplace eNewsletters.
SUBSCRIBE NOW.
View past IBM i EXTRAs here

9/27/2010 10:53 AM

Adding 'Value' to Your Prototypes | IBM i | IBM Systems Magazine

6 of 6

http://www.ibmsystemsmag.com/ibmi/december04/spotlight/8303p3.aspx

Related Articles
The Mystery of the Command Line Parameters
Developer
Data Orchestration
Administrator
iSeries EXTRA: Jon and Susan Answer Your Questions on Procedures
E-Newsletter Exclusive
Overcoming the Challenges of Embedding SQL into RPG Programs
Developer
Passing Parameters in Scheduled Jobs
Administrator
IBM i
AIX
MAINFRAME
POWER
Homepage
About Us
Contact Us
Subscriptions
Editorial Calendar
Advertise With Us
Reprints
Privacy Policy
Terms of Service
Sitemap
IBM Systems Magazine is a trademark of International Business Machines Corporation. The editorial content of IBM Systems Magazine is placed on
this website by MSP TechMedia under license from International Business Machines Corporation.
2010 MSP Communications, Inc. All rights reserved

9/27/2010 10:53 AM

S-ar putea să vă placă și