× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Mark,

>>Is this the absolute best way to prototype the create user space API?
I don't think that there will be a absolute best way to define a prototype,
there may be several solutions and it's you choice to decide which one you
prefer.

I'd remove all *OMITs, because you either pass the parameter or not, but
you'll never pass it with *OMIT.
I'm not sure, if passing *OMIT would be handled correctly.

I'd also create a template for the Error-Datastructure with a BASED keyword.
In the prototype I'd define the ErrorCode as  LikeDS() and add the template
to the copy member for the prototype.
We use nested copy members and compiler directives to include the template
whereever we need it.

DCREATEUSRSPC     PR                  EXTPGM(QUSCRTUS)
D USRSPCNAME                    20    CONST
D EXTENDEDATTR                  10    CONST
D INITIALSIZE                   10I 0 CONST
D INITIALVALUE                   1    CONST
D PUBLICAUTH                    10    CONST
D DESCRIPTION                   50    CONST
D REPLACEUSRSPC                 10    CONST OPTIONS(*NOPASS)
D ERRORCODE                           LikeDS(DSError1) Options(*NoPass)
D DOMAIN                        10    CONST OPTIONS(*NOPASS)
D TRANSSIZEREQ                  10I 0 CONST OPTIONS(*NOPASS)
D OPTIMIZEALIGN                  1    CONST OPTIONS(*NOPASS)
 ********************************************************************
 /Include QCPYLESRC,DSError1

D ErrorCode       DS                  likeDS(DSError1)

Copy member DSError1:
 /If not defined(DSError1)
 /Define DSError1
D DSError1        DS                  QUALIFIED
D  BYTESPROVID                  10I 0 INZ(%SIZE(DSError1))
D  BYTESAVAIL                   10I 0 INZ(0)
D  MSGID                         7A
D  RESERVED                      1A
D  MSGDATA                     240A
 /EndIf

>>Can you specify defaults in the prototype like with an INZ?
No, because the prototype is only used at compile time to check the
parameters passed to the called procedure.
At runtime the program don't knows anything about the prototype.

Mit freundlichen Gru?en / Best regards

Birgitta

"Shoot for the moon, even if you miss, you'll land among the stars."
(Les Brown)

-----Ursprungliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]Im Auftrag von Mark Adkins
Gesendet: Freitag, 6. Januar 2006 16:48
An: rpg400-l@xxxxxxxxxxxx
Betreff: Properly prototyping QUSCRTUS Create User Space



DCREATEUSRSPC     PR                  EXTPGM(QUSCRTUS)
D USRSPCNAME                    20    CONST
D EXTENDEDATTR                  10    CONST
D INITIALSIZE                   10I 0 CONST
D INITIALVALUE                   1    CONST
D PUBLICAUTH                    10    CONST
D DESCRIPTION                   50    CONST
D REPLACEUSRSPC                 10    CONST OPTIONS(*NOPASS:*OMIT)
D ERRORCODE                  32767 OPTIONS(*NOPASS:*OMIT:*VARSIZE)
D DOMAIN                        10    CONST OPTIONS(*NOPASS:*OMIT)
D TRANSSIZEREQ                  10I 0 CONST OPTIONS(*NOPASS:*OMIT)
D OPTIMIZEALIGN                  1    CONST OPTIONS(*NOPASS:*OMIT)
 ********************************************************************
D ERRORCODE       DS                  QUALIFIED
D  BYTESPROVID                  10I 0 INZ(%SIZE(ERRORCODE))
D  BYTESAVAIL                   10I 0 INZ(0)
D  MSGID                         7A
D  RESERVED                      1A
D  MSGDATA                     240A

Mark
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.