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



As you say a lot of people are uncomfortable with pointers. My bigger concern is that there is no direct evidence in the data definitions that these are indeed redefinitions of the name data.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Oct 12, 2018, at 1:34 PM, Mark Murphy <jmarkmurphy@xxxxxxxxx> wrote:

Sure, with multilevel DS at v7.3 you can do that now. I personally would
create multiple Based datastructures, but not everyone is comfortable with
pointers. I like the based datastructures because

dcl-ds errorcode Qualified;
bytes_avail Int(10);
bytes_returned Int(10);
message_id Char(7);
*n Char(1);
message_data Char(128);
end-ds;

dcl-s pMessageData Pointer Inz(%addr(errorcode.message_data));

dcl-ds cfp1234 Qualified Based(pMessageData);
resultcd Int(10);
reason Char(15);
end-ds;

dcl-ds cpf2234 Qualified Based(pMessageData);
file Char(10);
library Char(10);
end-ds;

is prettier to me than:

dcl-ds errorcode Qualified;
bytes_avail Int(10);
bytes_returned Int(10);
message_id Char(7);
*n Char(1);
message_data Char(20);
cfp1234 Char(19) Overlay(message_data: 1);
resultcd Int(10) Overlay(message_data: 1);
reason Char(15) Overlay(message_data: 5);
cpf2234 Char(20) Overlay(message_data: 1);
file Char(10) Overlay(message_data: 1);
library Char(10) Overlay(message_data: 11);
end-ds;

And avoids the problems with multiple messages with filename or library.
and you can access the data fields with something like

resultcd = cpf1234.resultcd;


On Fri, Oct 12, 2018 at 11:02 AM Jon Paris <jon.paris@xxxxxxxxxxxxxx> wrote:

Why bother moving it? Just overlay in the DS.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Oct 12, 2018, at 9:53 AM, Mark Murphy <jmarkmurphy@xxxxxxxxx> wrote:

Have several data structures set up, one for each message you will be
seeing. Then you can move the ErrorInfo field to the appropriate data
structure to extract the data.

On Fri, Oct 12, 2018 at 9:47 AM Mohan Eashver <mohankva@xxxxxxxxx>
wrote:

Thank you. But what if API returns a different error message whose data
value is not Binary ?

----
Regards,
Mohan Eashver



On Fri, Oct 12, 2018 at 9:33 AM David Gibbs <david@xxxxxxxxxxxx> wrote:

On 10/12/2018 8:09 AM, Mohan Eashver wrote:
How can the first 4 bytes of the Data structure that are a binary
value
be
converted to a number ?
I am getting this error when i do the following :
A character representation of a numeric value is in error (C G D F).
RPG statement performed a conversion from character to numeric using
data
that was in error.

d ErrorInfo 240A
d Bin4 S 10I 0 INZ

I would suggest you use a data structure for ErrorInfo instead of a
character field.

Something like this:

dcl-ds ErrorInfo qualified;
reason int (4);
rule char (15);
end-ds;

reasonCode = ErrorInfo.reason;
rule = ErrorInfo.rule;

david

--
David Gibbs
midrange.com

IBM i on Power Systems: For when you can't afford to be out of
business!

I'm riding 615 miles (Yes, you read that right) in the American
Diabetes
Association's Tour de Cure to raise money for diabetes research,
education,
advocacy, and awareness. You can make a tax deductible donation to my
ride
by visiting https://lsteml.diabetessucks.net.

See where I get my donations from ... visit
https://lsteml.diabetessucks.net/map for an interactive map (it's a
geeky
thing).

I may have diabetes, but diabetes doesn't have me!
--
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: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://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: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://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: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://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: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://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: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://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.