× 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.



Alan, when you say "Before I would have had to do something like ..."

When is "before" because I can't see anything in the technique that could not have been done many moons ago. Ugly as sin but it could be done in the original RPG IV if not RPG/400 - just not as easily.

Booth - you'll find the answers to why/how it works in this piece which dates back to 2003. http://ibmsystemsmag.com/ibmi/developer/general/d-spec-discoveries <http://ibmsystemsmag.com/ibmi/developer/general/d-spec-discoveries>



Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Jul 28, 2017, at 6:31 PM, Alan Campin <alan0307d@xxxxxxxxx> wrote:

1. ErrorReturn is a qualified data structure that has a field named
MessageId. When you call a system API it is filled.

dcl-ds ErrorReturn LikeDs(TD_StdErrorModel) Inz(*LikeDs);

dcl-ds TD_StdErrorModel Qualified Template;
Size Int(10) Inz(%Size(TD_StdErrorModel));
BytesAvailable Int(10) Inz(0);
MessageId Char(7);
*N Char(1); <<--- Reserved piece of memory but
you don't need to name.
MessageData Char(1024);
end-ds;

What I am showing is a lookup array but I am only naming the array. *N
means no name.

Before I would have had to do something like

dcl-ds dsOkList;
MsgId1 Char(7) Inz('CPF3C51');
Msgid2 Char(7) Inz('CPF3C52');
MsgId3 Char(7) Inz('CPF3C53');
MsgId4 Char(7) Inz('CPF3C54');
MsgId5 Char(7) Inz('CPF3C55');
OkList Char(7) Dim(5) Overlay(dsOkList) Ascend;
end-ds;

The same thing but a lot more work and I don't need to worry about name
conflicts. MsgId1 is global in the procedure. If you name another variable
MsgId1 it would conflict. With *N, no name. Just storage allocated.

On Fri, Jul 28, 2017 at 3:06 PM, Booth Martin <booth@xxxxxxxxxxxx> wrote:

It takes me a while to catch on. Its not clear to me exactly what is
happening here. I do not understand ErrorReturn.MessageID and I'd also bet
I do not understand *N

I say this because it looks to me like it doesn't do anything we couldn't
already do with the same basic code. Therefore I am assuming I am missing
something?

On 7/28/2017 1:18 PM, JRusling@xxxxxxxxxxx wrote:

It is...!

<snip>
dcl-ds *N;
*N Char(7) Inz('CPF3C51');
*N Char(7) Inz('CPF3C52');
*N Char(7) Inz('CPF3C53');
*N Char(7) Inz('CPF3C54');
*N Char(7) Inz('CPF3C55');
OkList Char(7) Dim(5) Pos(1) Ascend;
end-ds;


If %Lookup(ErrorReturn.MessageId:OkList) > 0;
</snip>


--
This is the RPG programming on the IBM i (AS/400 and 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.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD

--
This is the RPG programming on the IBM i (AS/400 and 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.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.