Programming Tips

This section provides some tips on using the Natural Web Interface.

This section covers the following topics:


Editing in Lower Case

If you use Natural on a mainframe, you may set at your Editor the following:

Set your Editor in Lower Case

  1. Follow the following menu structure: Profile > Additional Options > General Defaults > Editing in Lower Case

  2. Enter Y in the field Editing in Lower Case.

  • All programs delivered with the Natural Natural Web Server Extension use ' (quotation) and " (double quotation) in a way, that conversion to uppercase depends on which pair of characters is used.

  • Strings surrounded by pairs of ' (quotation) will not be converted to upper case and strings surrounded by pairs of " (double quotation) will be converted.

Quote vs. Apostrophe

To use both quote and apostrophe within your application, check the setting of keyword subparameter TQMARK of profile parameter CMPO or macro NTCMPO. This subparameter controls the translation of a quotation mark (") within a Natural text constant. It takes effect at compilation time only. Set this subparameter to OFF or use W3-QUOTE-DQUOTE.

Parameters
1 W3QUOTE            (A001) /*  o/  : Quote (")
1 W3APOSTROPHE       (A001) /*  o/  : Apostrophe (')
How To Invoke
PERFORM W3-QUOTE-DQUOTE W3QUOTE W3APOSTROPHE

Variables defined by Value

All input variables are defined BY VALUE, this means, every value which is MOVE compatible can be used, especially constant strings.

Access to Resources

All resources, such as pictures, sounds or Java applets, are saved at the HTTP server. If you want to create and relocate the program, do not hardcode the pathname of these resources.

When defining an environment variable, you specify the current path of the resource. The environment variable can be set at the Natural Web Server Extensions. If no variable is set, use a default setting.

Constant Values

The parameter data area W3CONST contains some useful constant values:

##HTTP_NEWLINE

Writing to the return page, a physical new line can be created by compressing the string ##HTTP_NEWLINE into the string.

##HTTP_NEWLINE_LENGTH

The length of the string ##HTTP_NEWLINE may differ for different implementations. Use ##HTTP_NEWLINE_LENGTH if the length of ##HTTP_NEWLINE is needed.

Creating a New Page

If your output may exceed the limits of your return page, use W3COUNTER to evaluate how may bytes are free at the return page.

DCOM / RPC

When you write an application that works with both RPC and DCOM, there are some aspects you should consider:

  • Do not exceed the name sign limitation for Natural libraries and subprograms. With the DCOM interface, you can use up to 32 characters to name a class and its methods.

  • Use the same name for a class and the library into which all your subprograms are located. This may not be according to object-oriented design principles, but gives you the possibility to access your subprograms via RPC or DCOM. EntireX Communicator supports a dynamic logon to a given Natural library.

  • Now the library is the equivalent to a class, and all programs contained in that library are the methods of this class. Calling with RPC is now ready. To call with DCOM, you only have to specify all subprogram as methods of your class.

  • With the Natural Web Interface, a program called W3-R2DC(SYSWEB) to generate a class for a Natural library is delivered. The program checks all subprograms if W3PARM is used as parameter data area and includes these subprograms as methods to the generated class.