W$GETURL Routine

If desired, you can enhance your COBOL program to give your end users access to other Web pages and the ability to send e-mail messages, conduct Web searches, and execute JavaScript. You determine how much functionality you want to give to your end users, and you code those functions into your application by passing URLs to the Web browser with the W$GETURL library function.

The W$GETURL library routine tells the runtime to pass a given URL to the host browser. The browser will handle the URL as if it were typed in the URL entry field.

Each URL that you pass with the W$GETURL routine contains a protocol and a path, separated by a colon.

Accessing a Web page uses the "http" protocol. For example,


tells the browser to contact the Web server "www.acucorp.com" and ask for the root page (/).

Sending e-mail uses the "mailto" protocol. For example,


opens an e-mail message to the user "support" at the machine "acucorp.com".

JavaScript is also supported as a protocol, so you can execute JavaScript sequences that display dialog boxes, create Web pages, build text files, and much more.

Use this library routine as follows:



URL, PIC X(n), contains the complete URL. This can be of any type, such as http, FTP, news, mailto, gopher, or javascript.

TARGET, PIC X(n), represents the destination for displaying the URL. This can be a window or a frame. You can specify "_blank", "_parent", "_self", or "_top". You can also write the response data to a frame by specifying the frame name as the target parameter.

After a CALL is made to W$GETURL, subsequent URL requests are ignored until the CALL completes.


This routine is available only when the calling COBOL program is running in a Web browser window via the ACUCOBOL-GT Web Runtime. This routine is unavailable to programs run in a separate window when it is executed by a Web browser. The RETURN-CODE register is set to "1" after a successful call and "0" if this routine is unavailable.