I tried your example and received an error;  Query cannot be run.  See 
lower level messages.
MSG:CDF503E was received ...
Message . . . . :   User-defined function error on member SYSDUMMY1.  
Cause . . . . . :   An error occurred while invoking user-defined function 
 
  HTTPGETCLOB in library SYSTOOLS. The error occurred while invoking the   
  associated external program or service program B2RESTUDF: in library  
  SYSTOOLS.D, program entry point or external name  
  com.ibm.db2.rest.DB2UDFWrapper.httpGetClob, specific name HTTPG00005. 
The 
  error occurred on member SYSDUMMY1 file SYSDUMMY1 in library SYSIBM. The 
 
  error code is 1. The error codes and their meanings follow:  
    1 -- The external program or service program returned SQLSTATE 57017. 
The 
  text message returned from the program is: ???????? . 
    2 -- The external program failed before it completed.  
    3 -- The database timed out waiting for the program to return. The 
timeout
  value used by the database was 0 minutes and 30 seconds.  
    4 -- The external program no longer exists or is not found.  
    5 -- One of the input parameters of the function had a data mapping 
error.
    6 through 26 -- See the previous message in the joblog.  
    For an external program, the program entry point displayed will be *N. 
 
Recovery  . . . :   For error codes 1 and 2, determine the cause of the 
error 
  from either the SQLSTATE or a previously listed message.  
I tried using CCSID or 1208 and 37 but still received same error.
Select 
     cast(systools.httpgetclob 
('
http://tinyurl.com/api-create.php?url=http://twitter.com/hashtag/i
bmi', 
'') as varchar(35) CCSID 37   ) as tinyurl 
 From  sysibm.sysdummy1 
Any suggestions ?
Don Brown
 
From:   Bryan Dietz <bdietz400@xxxxxxxxx>
To:     Midrange- L <midrange-l@xxxxxxxxxxxx>
Date:   29/08/2017 10:17 PM
Subject:        Newsletter / Marketing:  URL shorting
Sent by:        "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>
I wanted to pass along something I ran across.
I know in the past there have been discussions about using STRPCCMD to 
show long URLs on a screen.  I also recall that Scott K. had a sample 
http instance to capture(make) short urls.
https://www.reddit.com/r/IBMi/comments/6wkp1s/url_shortener_using_sql_httpgetclob/
(short) 
http://tinyurl.com/ya629qz8
<snip>
Had a request to add URL shortening to an application with only one 
prerequisite, it needs to shorten the URL without any type of 
authentication. I never needed to do this so in case others ever have to 
do something similar.
Chose the tinyurl api 
http://tinyurl.com/api-create.php?url= that has 
one parameter url which is the original URL that needs to be shortened. 
Example below shortening twitter
IBMi hashtag URL 
http://twitter.com/hashtag/ibmi
Select
     cast(systools.httpgetclob 
('
http://tinyurl.com/api-create.php?url=http://twitter.com/hashtag/ibmi', 
'') as varchar(35)) as tinyurl
 From  sysibm.sysdummy1  ;
The result will be the shortened URL.
</snip>
Bryan
As an Amazon Associate we earn from qualifying purchases.