Feedback
Did this article resolve your question/issue?

   

Article

SEARCH(URL) in Linux

Information

 
TitleSEARCH(URL) in Linux
URL Namesearch-url-in-linux
Article Number000119514
EnvironmentProduct: OpenEdge
Version: All supported versions
OS: AIX, Linux
Question/Problem Description
How do you check if a file exists using URL on Linux?
SEARCH(URL) always returns '?' when run on Linux.
Using SEARCH function with URL always returns '?'.
Steps to Reproduce
Clarifying Information
The following code will return '?' when run on Linux:
DISPLAY SEARCH("https://www.progress.com").

 
Error Message
Defect/Enhancement Number
Cause
SEARCH(URL) only applies in a Windows environment.  SEARCH(URL) will not work on Linux. 

As stated in the ABL Reference documentation, "In Windows, if you provide a fully-qualified URL, SEARCH checks if the file exists.  In this case, SEARCH does not search URLs on the PROPATH.  Valid URL protocols include HTTP and HTTPS."
 
Resolution
It is suggested to use an HTTP 'Head' or 'Get' request to determine if the URL exists.

The following code will return '200 OK' if the URL exists: 
 
USING OpenEdge.Net.HTTP.IHttpRequest.
USING OpenEdge.Net.HTTP.IHttpResponse.
USING OpenEdge.Net.HTTP.ClientBuilder.
USING OpenEdge.Net.HTTP.RequestBuilder.

DEFINE VARIABLE oRequest  AS IHttpRequest NO-UNDO.
DEFINE VARIABLE oResponse AS IHttpResponse NO-UNDO.

oRequest = RequestBuilder:Head('https://www.progress.com'):Request.

oResponse = ClientBuilder:Build():Client:Execute(oRequest).

MESSAGE
    oResponse:StatusCode SKIP
    oResponse:StatusReason SKIP
    VIEW-AS ALERT-BOX.



 
Workaround
Notes
References to Other Documentation:

Progress Information Hub, ABL Reference, ABL Syntax Reference, SEARCH function:
https://docs.progress.com/bundle/abl-reference/page/SEARCH-function.html

Progress Article(s):
000060873, Is there an HTTP client for OpenEdge?
Last Modified Date1/3/2020 2:28 PM
Attachment 
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.