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



Usually for the error DS and varying length fields i use

ErrorText         s      32766a         Varying

Thanks,
Tommy Holden




-----Original Message-----
From: James H H Lampert [mailto:jamesl@xxxxxxxxxxx]
Sent: Wednesday, September 22, 2004 11:42 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: API problem


> I have retrieved the definition from
> QSYSINC for the format , but it does not include the definition of the
> variable length fields at the end of the formats fixed length fields ,
> so I have had to 'guess' at what they should be.
. . .
> The required parameter group has its 1st parameter as the message
> information output (*) , as I see it (and I may be wrong) the format
> fields are placed in here , but you have to implicitly define the length
> of this variable length field via the next parameter!
>
> I have created the below code and hardcoded in a message ID and message
> file and library (for test purposes only) and when running I get the
> error code CPF24B4 in QUSBND.This informs me that a serious error
> occurred whilst addressing the parameter list.
> But it does not tell me which parameter is in error.

Well, first off, just because the API returns data of indeterminate length
doesn't mean it's returning a variable-length field in the sense of a
VARLEN field in a file. You do indeed have to make an educated guess, and
give it a return buffer at least as big as you're ever likely to need. In
any event, as long as you give it an accurate length on your buffer, it
won't return any more data than you give it room for.

Secondly, remember that, except when you're defining fields within a data
structure or a file record, type B fields take a number of digits, rather
than a number of bytes. So "4B0" is a two-byte binary, since 2 bytes will
hold 4 digits, and you would have to define the field as at least 5B0 to
get a 4-byte binary. Worse, type B fields clamp to artificial floors and
ceilings based on number of digits, rather than what that number of bytes
can represent, so that 2-byte 4B0 field runs a gamut from -9999 to +9999,
not -32768 to +32767. For true binary math, there is an "I" format for
signed integers, and a "U" format for unsigned ones, but according to the
ILE RPG reference (I only recently heard about this myself, and haven't
had an opportunity to put it to practical use), they still, at least when
defined as standalone fields, expect a number of digits (either 5 or 10),
rather than the corresponding number of bytes (2 or 4).

--
JHHL


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


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.