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



Yes, %trim() - or use VARYING and be sure not to concatenate long fixed-length text.

VARYING makes this kind of thing go SO much faster if building with concatenation or += - %trim all the time really slows things down.

Vern

On 5/12/2016 3:55 PM, Paul Roy wrote:

I ´d try with %trim() ...

Sent from my iPhone

On 12 May 2016, at 22:38, rpg400-l-request@xxxxxxxxxxxx wrote:

Send RPG400-L mailing list submissions to
rpg400-l@xxxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.midrange.com/mailman/listinfo/rpg400-l
or, via email, send a message with subject or body 'help' to
rpg400-l-request@xxxxxxxxxxxx

You can reach the person managing the list at
rpg400-l-owner@xxxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of RPG400-L digest..."


*** NOTE: When replying to this digest message, PLEASE remove all text
unrelated to your reply and change the subject line so it is meaningful.
Today's Topics:

1. Re: Getting Bad Request from a HTTPAPI call (Shubhadeep Roy)
2. SQL Statement length (Graves, Chuck)
3. Re: SQL Statement length (JRusling@xxxxxxxxxxx)
4. RE: SQL Statement length (Tyler, Matt)
5. Re: SQL Statement length (Vernon Hamberg)
6. Re: SQL Statement length (Jose Perez)
7. RE: SQL Statement length (paultherrien@xxxxxxxxxxxxxxxxxx)


----------------------------------------------------------------------

message: 1
date: Thu, 12 May 2016 15:24:23 -0400
from: Shubhadeep Roy <shubhadeep.roy@xxxxxxxxx>
subject: Re: Getting Bad Request from a HTTPAPI call

Thank you Brad.

I tried changing the Content-Type to application/json but result is still
the same.

I'll post to Scott's forum again.

On Thu, May 12, 2016 at 3:11 PM, Bradley Stone <bvstone@xxxxxxxxx> wrote:

That is something you'll need to ask Scott.

Our GETURI (www.bvstools.com/geturi.html) software when in debug shows the
headers and body of the request (ie, the complete request) as well as a
complete log of communications in another log file.

Brad
www.bvstools.com

On Thu, May 12, 2016 at 12:35 PM, Shubhadeep Roy <shubhadeep.roy@xxxxxxxxx
wrote:

Thank you Brad and Vernon.

The debug log that I pasted was from the stream file with http_debug-
http_debug(*ON : '/tmp/ShubhDebugLog.txt');

But the log does not show the BODY of the request. Am I missing
something?
Is there any other way to start the debugger?

I had put up this question in Scott's mailing list about 2 weeks back and
also tried to follow up but no one has responded so far.


On Thu, May 12, 2016 at 1:14 PM, Bradley Stone <bvstone@xxxxxxxxx>
wrote:

It's not junk.. it's an ASCII (1208, UTF) representation. You're
viewing
it through your EBCDIC session which is why it looks like garbage.

Can you turn on debug with HTTPAPI and have it save the request to a
stream
file? Then look at that stream file instead to see what the JSON data
looks like.

I also think Scott has mailing lists dedicated to his offerings as well
that you may want to check out.

Brad
www.bvstools.com
--
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.


--

Warm regards,
Shubh
All is well. Everything will be OK!!! - Shubh


------------------------------

message: 2
date: Thu, 12 May 2016 20:02:33 +0000
from: "Graves, Chuck" <cgraves@xxxxxxxxxxxxxx>
subject: SQL Statement length

Is there a "trick" to programming a long complex (6000 character) SQL
statement in RPG?
We keep getting a "variable truncated" error message.



[Rodda Paint Company]
Chuck Graves
Director of Information Systems
Rodda Paint Co.<http://www.roddapaint.com>
6107 N. Marine Drive
Portland, Oregon 97203
(503) 737-6042



------------------------------

message: 3
date: Thu, 12 May 2016 15:16:39 -0500
from: JRusling@xxxxxxxxxxx
subject: Re: SQL Statement length

Seems like i remember you have to break it into nnn size chunks but don't
quite remember.
(embedded sql in rpg)

hth

John


From: "Graves, Chuck" <cgraves@xxxxxxxxxxxxxx>
To: "rpg400-l@xxxxxxxxxxxx" <rpg400-l@xxxxxxxxxxxx>
Date: 05/12/2016 03:03 PM
Subject: SQL Statement length
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx>



Is there a "trick" to programming a long complex (6000 character) SQL
statement in RPG?

We keep getting a "variable truncated" error message.



[Rodda Paint Company]
Chuck Graves
Director of Information Systems
Rodda Paint Co.<http://www.roddapaint.com>
6107 N. Marine Drive
Portland, Oregon 97203
(503) 737-6042

--
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.
<br />
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is
unauthorized. If you are not the intended recipient, any disclosure, copying,
distribution or any action taken or omitted to be taken in reliance on it, is
prohibited and may be unlawful.


------------------------------

message: 4
date: Thu, 12 May 2016 20:24:52 +0000
from: "Tyler, Matt" <matt.tyler@xxxxxxxxxxxxxx>
subject: RE: SQL Statement length

There is no trick for the length if you set up your program correctly. The
system allows for a 32740 length statement. I admit to coding a 10K size
statement but nothing that comes close to the max. It would be nice to know
more about the "variable truncated" error, I could not find a standard message
with that phrase.
DCL-S Stmtsql Varchar( 32740 );
DCL-S Wherestmt Varchar( 8000 );
DCL-S Filter Char(1) INZ('A');

Stmtsql = 'select * from MYTABLE';
If Filter > ' ';
If %LEN( Wherestmt) > 0;
Wherestmt += ' And ';
Endif;
Wherestmt += 'FILTER = ''?'';
Endif;

Stmtsql += ' ' +Wherestmt;

Exec sql prepare PREP_SQL from :Stmtsql;
If Sqlstate <> '00000';
// Do some error routine
Endif;

exec sql declare MYCURSOR for PREP_SQL;

exec sql open MYCURSOR using :Filter;
If Sqlstate <> '00000';
// Do some error routine
Endif;

etc...

Thanks, Matt


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Graves,
Chuck
Sent: Thursday, May 12, 2016 2:03 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: SQL Statement length

Is there a "trick" to programming a long complex (6000 character) SQL
statement in RPG?
We keep getting a "variable truncated" error message.



[Rodda Paint Company]
Chuck Graves
Director of Information Systems
Rodda Paint Co.<http://www.roddapaint.com>
6107 N. Marine Drive
Portland, Oregon 97203
(503) 737-6042

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


------------------------------

message: 5
date: Thu, 12 May 2016 15:34:46 -0500
from: Vernon Hamberg <vhamberg@xxxxxxxxxxxxxxx>
subject: Re: SQL Statement length

Chuck - it's help to see your code, if you can sanitize it for privacy -
is the statement variable declard as CHAR or as VARCHAR? You DO have to
break the statement up in order to fit in the 8-80 limits of RPG. Have
you run it in debug to see what your statement REALLY looks like?

Cheers
Vern

On 5/12/2016 3:24 PM, Tyler, Matt wrote:
There is no trick for the length if you set up your program correctly. The
system allows for a 32740 length statement. I admit to coding a 10K size
statement but nothing that comes close to the max. It would be nice to know
more about the "variable truncated" error, I could not find a standard message
with that phrase.
DCL-S Stmtsql Varchar( 32740 );
DCL-S Wherestmt Varchar( 8000 );
DCL-S Filter Char(1) INZ('A');

Stmtsql = 'select * from MYTABLE';
If Filter > ' ';
If %LEN( Wherestmt) > 0;
Wherestmt += ' And ';
Endif;
Wherestmt += 'FILTER = ''?'';
Endif;

Stmtsql += ' ' +Wherestmt;

Exec sql prepare PREP_SQL from :Stmtsql;
If Sqlstate <> '00000';
// Do some error routine
Endif;

exec sql declare MYCURSOR for PREP_SQL;

exec sql open MYCURSOR using :Filter;
If Sqlstate <> '00000';
// Do some error routine
Endif;

etc...

Thanks, Matt


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Graves,
Chuck
Sent: Thursday, May 12, 2016 2:03 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: SQL Statement length

Is there a "trick" to programming a long complex (6000 character) SQL
statement in RPG?
We keep getting a "variable truncated" error message.



[Rodda Paint Company]
Chuck Graves
Director of Information Systems
Rodda Paint Co.<http://www.roddapaint.com>
6107 N. Marine Drive
Portland, Oregon 97203
(503) 737-6042

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


------------------------------

message: 6
date: Thu, 12 May 2016 16:37:37 -0400
from: Jose Perez <joseenocperez.jp@xxxxxxxxx>
subject: Re: SQL Statement length

Maybe you are getting this error because your assigning the result of the
query to a host variable and the result is too large to be returned in
this variable.

On Thu, May 12, 2016 at 4:24 PM, Tyler, Matt <matt.tyler@xxxxxxxxxxxxxx>
wrote:

There is no trick for the length if you set up your program correctly.
The system allows for a 32740 length statement. I admit to coding a 10K
size statement but nothing that comes close to the max. It would be nice
to know more about the "variable truncated" error, I could not find a
standard message with that phrase.

DCL-S Stmtsql Varchar( 32740 );
DCL-S Wherestmt Varchar( 8000 );
DCL-S Filter Char(1) INZ('A');

Stmtsql = 'select * from MYTABLE';
If Filter > ' ';
If %LEN( Wherestmt) > 0;
Wherestmt += ' And ';
Endif;
Wherestmt += 'FILTER = ''?'';
Endif;

Stmtsql += ' ' +Wherestmt;

Exec sql prepare PREP_SQL from :Stmtsql;
If Sqlstate <> '00000';
// Do some error routine
Endif;

exec sql declare MYCURSOR for PREP_SQL;

exec sql open MYCURSOR using :Filter;
If Sqlstate <> '00000';
// Do some error routine
Endif;

etc...

Thanks, Matt


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Graves, Chuck
Sent: Thursday, May 12, 2016 2:03 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: SQL Statement length

Is there a "trick" to programming a long complex (6000 character) SQL
statement in RPG?

We keep getting a "variable truncated" error message.



[Rodda Paint Company]
Chuck Graves
Director of Information Systems
Rodda Paint Co.<http://www.roddapaint.com>
6107 N. Marine Drive
Portland, Oregon 97203
(503) 737-6042

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

------------------------------

message: 7
date: Thu, 12 May 2016 16:37:49 -0400
from: <paultherrien@xxxxxxxxxxxxxxxxxx>
subject: RE: SQL Statement length

The length of your statement may be a red-herring. Are you getting the
error on compile or on execution?
Is the returned data being truncated in one of your receiving variables?


Paul

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Graves,
Chuck
Sent: Thursday, May 12, 2016 4:03 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: SQL Statement length

Is there a "trick" to programming a long complex (6000 character) SQL
statement in RPG?

We keep getting a "variable truncated" error message.



[Rodda Paint Company]
Chuck Graves
Director of Information Systems
Rodda Paint Co.<http://www.roddapaint.com>
6107 N. Marine Drive
Portland, Oregon 97203
(503) 737-6042

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



------------------------------

Subject: Digest Footer

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

------------------------------

End of RPG400-L Digest, Vol 15, Issue 218
*****************************************






Paul Roy



paul.roy@xxxxxxx

+352 621 256 810

+32 477 971 925

REAL Solutions S.A.
33, rue d'Eich
L-1461 Luxembourg

real.lu

REAL Solutions Facebook



This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed. If
you have received this email in error please notify the system manager.
Please consider the environment before printing this e-mail.



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.