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



Charles,

That compiled! Thanks. Now on to test it...

Since I didn't explain my issue well enough here is the stripped down subprocedure:

// =====================================================================
Dcl-Proc PutWebAPIAcct#;
// ---------------------------------------------------------------------
//? Update Web Enrl (via API Call) with Participant# (b1Part#)
// ---------------------------------------------------------------------
Dcl-pi *N Like(wtSts);
Sts Like(wtSts) Const;
AppID Like(pData0.AppID) Const;
Part# Like(wrkPart#) Const;
APIURL Like(URL) Const;
End-Pi;

// ---------------------------------------------------------------------

Dcl-s wrkSts Like(wtSts);

// HTTP Variables
Dcl-s rc Int(10);

Dcl-s wrkURL VarChar(300);
Dcl-s HTTPResponse Varchar(1600:4); <== These were 16000000 as per the prototype
Dcl-s JSONResponse Varchar(1600:4);

// API Call & Response
Dcl-c JSONResponseTemplate
'{"isAccountCreated": TFTFTF, +
"accountNumber": 999999999 +
}';

// ---------------------------------------------------------------------

// REST call to Savings Web Server
//http_debug(*ON); // debugging only - s/b normally commented out
// look for /tmp/httpapi_debug.txt

// URL stored in CVASNTRL2. Append AppID to end as part of URL
wrkURL = %Trim(APIURL) + %Char(AppID);

// Create API JSON Payload
// {"isAccountCreated":true,"accountNumber":"123456789"]
// Overlay defaults with values
If Sts = 100; // Enrollments written ok to iSeries files
Stripped out code here
Else; // Not ok
EndIf;

// Return Status, and if good, account# of new enrollment
rc = http_req( 'PUT'
: wrkURL
: *Omit
: HTTPResponse
: *Omit
: JSONResponse
: 'application/json' );

// Good
If rc >= 1
And rc <= 399;
wrkSts = 100; // Good return
Leave;
Else;
// Bad
Lot of stripped out code
EndDo;

Return wrkSts;

End-Proc;



-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Charles Wilt
Sent: Monday, August 17, 2020 4:28 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Fields too large for a Subprocedure - CWX9001

which procedures are you trying to use?

oh, wait, I bet I know what the problem is...

declare it this way...
Dcl-s HTTPResponse VarChar(1600:4);
Dcl-s JSONResponse VarChar(1600:4);

This will use a 4 byte header for size, even though the default would be a
2 byte header for that size varchar.

Now the compiler will let you use it in place of a varchar(16000000) (which has a 4 byte header size)

Charles



[CFNC]

This email, including any documents, files, or previous email messages attached to it, has been sent from an email account of College Foundation Inc., (CFI) and may contain confidential, proprietary, or legally privileged information belonging to CFI. If you are not the intended recipient, any dissemination, distribution, or copying of this email or its attachments is strictly prohibited. If you have received this email in error, please immediately notify the sender by email and destroy the original email and any attachments.

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.