net cobweb guide

32
8/4/2019 Net Cobweb Guide http://slidepdf.com/reader/full/net-cobweb-guide 1/32 For SPARC ® Architectur Web Guide

Upload: francisco-junior

Post on 07-Apr-2018

231 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 1/32

For SPARC®

Architectur

Web Guide

Page 2: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 2/32

Third Edition: January 2009 

The contents of this manual may be revised without prior notice. No part of this document maybe reproduced or transmitted in any form or by any means, electronic or mechanical, for any

purpose, without the express written permission of Fujitsu Limited.

© 1996-2009 Fujitsu Limited. All Rights Reserved.

Page 3: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 3/32

Preface

This manual contains an overview of Web applications using COBOL and the featuresof Web servers.

For detailed information about the NetCOBOL Web subroutines, refer to theNetCOBOL CGI Subroutine User's Guide and the NetCOBOL SAF Subroutine User's 

Guide .

Supported Operating Systems

The NetCOBOL Web link functions provide the environment for developing andexecuting applications on Web servers in the Solaris™ 10 operating systemenvironment.

Registered Trademarks

The trademarks used in this manual are:

  NetCOBOL is a trademark or registered trademark of Fujitsu Limited or itssubsidiaries in the United States or other countries or in both.

  Sun, Sun Microsystems, the SUN Logo, Solaris and all Solaris-based marks andlogos are trademarks or registered trademarks of Sun Microsystems, Inc. in theU.S.A. and other countries.

  SPARC® is a registered trademark of SPARC International, Inc. Products bearingSPARC trademarks are based on an architecture developed by Sun Microsystems,Inc.

  Microsoft, Windows, and Windows NT are trademarks or registered trademarksof Microsoft Corporation in the U.S.A. and other countries.

  Netscape, Netscape Navigator, and Netscape Enterprise Server are thetrademarks or registered trademarks of Netscape Communications Corporation inthe U.S.A. and other countries.

  ORACLE and Web Request Broker are the trademarks or registered trademarksof Oracle Corporation.

  Other brand and product names are the trademarks or registered trademarks of their respective owners.

Product Names

The product names used in this manual are abbreviated as follows:

Product Name Abbreviation

Solaris™ Operating System Solaris

Microsoft® Internet Explorer IE

Netscape Enterprise Server 3.6 with SP3 NES

NetCOBOL Web Guide 3

Page 4: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 4/32

4 NetCOBOL Web Guide

Contents

Chapter 1 . Overview .....................................................................................5 The Web Environment ........................................................................................ 6 Web Applications................................................................................................ 6 COBOL Web Applications..................................................................................... 7 Chapte r 2. Developing Web Appli cat ion s .....................................................9 Web Application Interfaces for Solaris .................................................................. 9 Web Application Data Flow.................................................................................10 Differences between NSAPI and CGI ...................................................................11 Chapte r 3. The NetCOBOL Web Subrouti nes .............................................13

 CGI ..................................................................................................................13 NSAPI accessed through SAF..............................................................................13 Features of the NetCOBOL Web Subroutines........................................................14  Appendi x A. In troduc tion to Web Appl ica tions ..........................................15 What is a Web Application?................................................................................15 NetCOBOL Web Subroutines...............................................................................16 HTTP Basics......................................................................................................17 HTML Basics .....................................................................................................19 Problems with Execution in Web Browsers...........................................................27   Append ix B. Un icode ..................................................................................29 Web Browsers...................................................................................................30 Input Code System From Web Browser ...............................................................30 Code System Output to Web Browser..................................................................30 Compile Options................................................................................................30 Unicode Supported Subroutines..........................................................................31 Code Systems ...................................................................................................32 

Page 5: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 5/32

Chapter 1. Overview

Today's business applications are appearing more and more often on the Internet.The system configuration where these Web-based applications are typically executedincludes host-centralized systems (Web servers), client systems, and network-computing system support.

The network-computing system support provides access to information as a result of 

the rapid increase of host computers connected to the Internet. The network-computing environment enables businesses to be mutually linked through a network,and business efficiency to be improved as a result of the shared information involvingthe World Wide Web. Web browsers with platform-independent operability are usedin linking various types of businesses.

For host-centralized and client/server systems, COBOL is often used as the core

language in the mission-critical area of business systems. The demand on COBOL tosupport the Internet and Intranet needs of the business enterprise is increasing.

Page 6: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 6/32

6 Chapter 1. Overview

The Web Environment

Features of the Web environment and the merits of using COBOL are explained asfollows.

• 

• 

Features of the Web

-  Remote SiteUsing a Web browser, all resources on the network can be accessed, so thata client system can be connected to any number of remote systems.

-  Cost ReductionUsing a Web browser simplifies client machine setup and maintenance work.

-  Independence from the Client SystemUsing a Web browser, a business system independent of the client systemcan be built. These systems can also be used in the mobile computingenvironment.

-  Distribution of the Load on the Server

The networked server allows various business systems to be distributed.

-  SecurityConnecting a client system to the Internet may cause security problems.Self-defense measures need be taken, for example, to limit access to thedomain to which the client is connected and setting user restrictions in the

application.

Merits of using COBOL

Generally, when selecting a programming language for Web-based applications,the following features are needed to support data input/output with Webbrowsers:

-  Data manipulation

-   Access to files or databases

-  Environment variable manipulation

COBOL satisfies these requirements and can be used to develop Web-basedapplications efficiently, especially considering the following:

-  Use of accumulated knowledge

-  Effective use of existing resources

Web Applications

HTML documents can return only static information, so updated information cannotbe displayed in real-time. Real-time information can be provided however by using

CGI or server-specific APIs for the applications called from Web browsers. Theseapplications return dynamically updated information relative to the input from theWeb browser. In addition to returning information, data processing procedures, suchas file input/output and database access, can be requested (or executed) from Webbrowsers.

Page 7: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 7/32

Chapter 1. Overview 7

COBOL is the common processing language for data processing and dynamic Webpages can be created interactively by effectively using these features of COBOL.

COBOL Web Applications

Use the NetCOBOL Web subroutines to build business systems in COBOL forexecution on the Web. These subroutines allow you to create applications usingexisting COBOL knowledge without having to worry about the complexities of low-level APIs.

run-time system

SUBMIT

Web Server

Web Browser

Page 8: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 8/32

8 Chapter 1. Overview

Page 9: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 9/32

Chapter 2. Developing Web Applications

For development and maintenance of Web applications, knowledge of Web browserinterfaces is generally required. Using the NetCOBOL Web subroutines, data can beinput and output between the COBOL programs and the Web browsers by usingCOBOL knowledge only.

Web Application Interfaces for Solaris

The following interfaces are available for Web applications that will run on Solaris :

  CGI

CGI (Common Gateway Interface) is a specification for transferring data between

a Web server and a CGI program. CGI is the most commonly used interface fordata input and output between client systems and Web servers. Most Webservers support CGI, but it is not as efficient as server-specific APIs such asNSAPI. NetCOBOL provides COBOL CGI subroutines as functions for more easilydeveloping applications using CGI.

  NSAPI accessed through SAF

NSAPI (Netscape Server API) is the application programming interface for NES. Itenables programmers to create web applications that are more sophisticated andrun faster than CGI-based applications.

NetCOBOL provides the NSAPI and its execution codes, which are encapsulatedaccording to the COBOL language specification. NetCOBOL Server Application

Function (SAF) subroutines and NetCOBOL SAF director enable the programmerto easily develop NSAPI-based applications.

NSAPI differs from CGI in the amount of resources it requires, including CPU andmemory, as well as in performance. For details of the difference between NSAPI

and CGI, see “Differences between NSAPI and CGI” in this manual.

Page 10: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 10/32

10 Chapter 2. Developing Web Applications

Web Application Data Flow

The following explains the process flow of Web applications, using CGI as theexample.

CGI executes on the Web server and is used for data transfer with Web browsers(clients). CGI is the most fundamental interface for executing CGI programs (calledCGI scripts) on Web servers from Web browsers. A request to the server from abrowser activates the CGI program and transfers the data, including the data inputby environment variables.

CGI is executed in the processing flow of inputting the data (request), processing thedata, and outputting the processing result (response). The CGI program must becoded to handle this processing flow.

The processing flow by NSAPI and other APIs is basically the same, except that CGItransfers the data through the standard input/output. NSAPI and the other APIsprovide a special “hidden” API for transferring the data. This difference between CGIand other APIs is included in the NetCOBOL Web subroutines.

Web Browser

Web Server

Page 11: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 11/32

Chapter 2. Developing Web Applications 11

Differences between NSAPI and CGI

CGI applications must have an executable module format (.EXE). The Web servergenerates a separate process for each CGI application for each request from thebrowser. As a result, resources, especially CPU and memory, are consumed in largequantities.

In contrast, NSAPI (accessed through the SAF NetCOBOL subroutines) applicationsare generated using shared objects (.so) and are loaded into one overall process inthe Web server. The shared object is controlled by being loaded directly into memoryor by being unloaded after a specified amount of time.

The major difference between NSAPI and CGI is that CGI is executed in separateprocesses for each request, but NSAPI generates a thread within a common addressspace in web servers and is executed in a multi-threaded environment. As a result,the overhead caused by process generation and deletion in CGI, memory allocation,and task switching can be greatly reduced, and Web applications with higherperformance can be built.

Web Server (NES)

Page 12: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 12/32

12 Chapter 2. Developing Web Applications

Web Server

Process space inWeb Server

Page 13: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 13/32

Chapter 3. The NetCOBOL Web Subroutines

The NetCOBOL Web subroutines provide functions for analyzing Web parametersinput from Web browsers. These include functions for outputting the processingresult. Using these functions, Web applications can be developed easily using onlyCOBOL, without requiring specialized knowledge of the Web server interface.

CGI

Use the NetCOBOL CGI subroutines to generate Web-based applications that use CGIand execute on various Web servers.

DocumentationWhen COBOL CGI subroutines are to be used, refer to the NetCOBOL CGI 

Subroutines User's Guide for details of the COBOL CGI subroutines.

When an application developed by using NetCOBOL CGI Subroutines is to beconverted to an application using COBOL SAF subroutines, refer to “Appendix D. CGIto SAF Subroutine Conversion Guide” in the NetCOBOL SAF Subroutines User's Guide .

NSAPI accessed through SAF

To generate Web-based COBOL applications that use NSAPI on NES, use theNetCOBOL SAF subroutines and the NetCOBOL SAF director.

The NetCOBOL SAF subroutines execute through an interface that is common to theNetCOBOL CGI subroutines. These subroutines can use the NES extended functions.This simplifies the conversion from CGI to NSAPI. The CGI subroutine is almost thesame as the NSAPI specification, but NSAPI-specific changes need to be added.

Documentation

When COBOL SAF subroutines are to be used, refer to the NetCOBOL SAF 

Subroutines User's Guide for details of the COBOL SAF subroutines.

Page 14: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 14/32

14 Chapter 3. The NetCOBOL Web Subroutines

Features of the NetCOBOL Web Subroutines

Features/Function SAF Subroutines

(to access NSAPI )

CGI Subroutines

Web server that can beused

NES All servers supporting CGI

Web interfacetechnology

NSAPI CGI

File format activated byWeb server

Shared object Executable

Operation model Thread Process

Loading mechanism of COBOL applicationsexecuted on Webservers

Loaded when activating the server orat the first request to the application,then resides in memory for the nextrequest.

 Activates a process for each requestto the application and discards theprocess after processing ends.

Execution performance High-speed performance bymultithreaded operation or sharedobject pre-load function.

Low-speed performance due to theoverhead caused by a separateprocess activated/ deleted for eachrequest.

User/ApplicationInterface

•  HTML•  Web subroutines

Ease of generating abusiness application

Because the interfaces with Web servers are hidden in Web subroutinescomplying with the COBOL language specification, no special knowledge of Web application development is required.

Utilization of existingresources

The actual business logic of existing applications can be mostly used withoutbeing modified significantly. However, interfaces with Web servers arerequired, so the description for using Web subroutines must be added and thebusiness logic must be organized to make use of such.

Forms printing The server can execute forms printing contained in the application. However,the printing function of the Web browser or the downloaded application maybe used by the client.

Merit Applications with high performanceand resources consumed in smallquantities can be generated bymultithreaded operation.

 Applications with high independencecan be generated, independent of theserver.

Page 15: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 15/32

 Appendix A. Introduction to Web Applications

This appendix describes the fundamental principles of building Web-basedapplications using the NetCOBOL subroutines.

What is a Web Application?

The Internet’s World Wide Web connects Web servers to Web browser clientapplications by using the Hyper Text Transfer Protocol (HTTP). Web browsers enableusers to access resources on Web servers by specifying a Uniform Resource Locator(URL). The Web server sends the requested resource, typically an HTML page, back to the requesting browser. Usually the Web server sends data in Hyper Text MarkupLanguage (HTML), so that the receiving browser can display the data in anappropriate format.

Web Browser

Web Browser

Web Server

The Web Browser …

The Web Server …

Because Web browsers allow information on networked servers to be accessed easilyby many client systems, they can be used as the environment for executing businessapplications.

But business-critical applications can’t survive by just pushing static information outto the user. They must be able to receive information from the user and respondwith appropriate content based on the user’s request. An interface is needed to allow

the application on the server to provide this dynamic content. The most commoninterfaces for this purpose are:

CGI (Common Gateway Interface)• •  NSAPI (Netscape Server Application Programming Interface)

 Applications that use these interfaces are called Web applications.

Page 16: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 16/32

16 Appendix A. Introduction to Web Applications

NetCOBOL Web Subroutines

NetCOBOL Web subroutines provide the interfaces for generating Web applicationsusing COBOL and the environment for executing these Web applications. NetCOBOLWeb subroutines consist of various interfaces including CGI and NSAPI. Being able touse these interfaces without being conscious of the differences between CGI andNSAPI, however, allows the user to develop Web applications more easily than using

other languages such as Perl and C.

NetCOBOL Web subroutines have the following features:

• • 

• 

• 

• • • • • • 

Being able to be executed by the CALL statement interface, NetCOBOL Websubroutines can be used easily by COBOL.

Using the functions provided for converting parts of HTML documents and foroutputting the HTML document, the program and HTML document can be madeindependent, and development with high productivity and maintainability can berealized.

The user can generate Web applications operating on various Web servers bydescribing a program with the interface provided by the NetCOBOL Websubroutines.

NetCOBOL Web subroutines provide the following services:

Receiving the request data (Web parameters) passed from a Web server whenactivating the application and converting this data into the proper COBOL dataformat.

Outputting the processing result (for example, dynamic HTML output function)

 Automatically generating the header (for example, Content-Type)

System command execution function

Obtaining request information

Receiving/Outputting Cookie data

Uploading files

Page 17: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 17/32

  Appendix A. Introduction to Web Applications 17

HTTP Basics

The Web is established through the use of HTTP. The data transmission betweenWeb servers and Web browsers is performed through HTTP. The data sent from aWeb browser to a Web server is called a "request." The data sent from a Web serverto a Web browser is called a "response." Generally, a response must exist for eachrequest. A communication path is assured by the request and released when a

response is completed. For HTTP, the request and response have the same formatexcept the first line, which have very simple formats as shown below.

Request Data 

Method URL version

HTTP header

Message body

Response Data  Version Status code Reason

HTTP header

Message body

The following explains each of the terms used in the above tables:

• • • • • • • 

• 

Method: Indicates the contents of a request to a Web server, which include GET,POST, and HEAD.

URL: Indicates the location of a resource to be requested.

 Version: Indicates the version of HTTP to be used.

Status code: Indicates the condition of processing by the server or Webapplication, which is represented in 3 digits.

Reason: The reason for the status code.

HTTP header: Used to control Web browser from Web server, or to add theconditions to the Web browser information or method.

Message body: Indicates the data to be transmitted between a Web server and aWeb browser.

For details of these terms, refer to the specifications or books about HTTP. Thisappendix briefly explains the method, status code, and HTTP header that arereferred to or set up by Web applications.

The following lists the main methods:

GETThis method fetches the information specified in the URL. When the informationspecified in the URL is a Web application (an executable file name and optionalinput parameters), GET resends the data output by the Web application. There isan upper limit to the amount of data that the Web server can receive throughthe data input to the form that is passed to the application.

Page 18: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 18/32

18 Appendix A. Introduction to Web Applications

• 

• 

HEADThis method is functionally the same as GET, but different in that only the HTTPheader is resent. HEAD is used for checking the attribute of the informationspecified in a URL.

POSTThis method is used for sending the data input from forms to the Webapplication. GET functions similar to POST, but the quantity of data transmittedby GET is limited.

Status Codes 

Status code Explanation

200 Normal end

302 The requested document was temporarily moved. Refer to the "Location"header to find out where it was moved.

303 The requested document was moved to a different URL. Refer to the"Location" header to find out where it was moved.

400 Syntax error

401 Authorization has failed

403 Accessing the specified URL is inhibited

404 There is no resource for the requested URL

410 There is a resource inconsistent between the Web browser and server

500 Internal error. For example, when no response is sent from Webapplications.

502 An invalid request was returned from the Web server

503 Web server cannot be accessed because of high load

HTTP Headers 

HTTP header Explanation

  Accept Indicates the MIME type that Web browser can received

  Accept-Charset Indicates the character code set that the Web browser can receive

  Accept-Encoding Encoding format that the Web browser can receive; generallyindicates the data compression format

  Accept-Language Indicates the language type that Web browser can receive. Japaneseis represented as "ja"; English is represented as "en."

Content-Encoding Indicates the encoding format of the response data

Content-Language Indicates the language type of the response data

Content-Type Indicates the MIME type of the response dataDate Indicates the date when the request data or response data was

created

Expires Indicates the term of validity for the response data

Location Indicates the location where the information is stored

Host Host name of the server where Web server is operated

Referer Indicates the requesting URL

User-Agent Indicates the Web browser information

Page 19: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 19/32

  Appendix A. Introduction to Web Applications 19

HTML Basics

HTML (Hyper Text Markup Language) is the language for representing hyper text.

The text style or link is represented with specific keywords called "tags." A tag isrepresented with a character string placed between "<" and ">." This characterstring is called "tag-name."

In most cases, the tag has a start and end tag-name, which are represented as"<tag-name>" and "</tag-name>," respectively. The character string placedbetween the start and end tag is significant for Web browsers. A few tags do notrequire an end tag-name.

Tags may have one or more attributes. An attribute is usually represented in theformat:

attribute-name=attribute-value

but it may be represented in the simplified format:

attribute-name.

 A tag with attributes is represented in the format:

<tag-name attribute-name-1=attribute-value attribute-name-2>

This appendix introduces the common tags required for describing basic HTML, andtags required for calling Web applications. For details of these tags and others, referto books or Web pages providing an explanation of HTML.

The most commonly used Web browsers are Microsoft's Internet Explorer andNetscape NavigatorTM. Each of these browsers defines its own tags. Therefore, alltags cannot be used for both browsers. Even the most common tags may be eachinterpreted differently by the two browsers. In addition, the tag support range or

operation depends on the actual version of the Web browser. For details, refer torelated books or Web pages.

The following explains the main tags and their attributes.

• 

• 

• 

• 

<HTML> ∼ </HTML>

The HTML tag indicates that the data being sent comprises an HTML document.They must be placed at the very beginning and the very end of every HTMLdocument.

<HEAD> ∼ </HEAD>

The HEAD tag indicates the beginning and end of the header of the HTMLdocument. <TITLE> must be described in the header. <BASE>, <SCRIPT>,<STYLE>, <META>, <LINK>, <OBJECT>, <NEXTID>, and <ISINDEX> can be

also described in the header.

<TITLE> ∼ </TITLE>

The TITLE tag indicates the title of the HTML document. Generally, the title isnot displayed on the page.

<BODY> ∼ </BODY>

The BODY tag indicates the body of HTML text. In the body, the text style must

be arranged with various tags.

Page 20: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 20/32

20 Appendix A. Introduction to Web Applications

  Attribute name Explanation

BGCOLOR="Color" Specifies the background color.

BACKGROUND="URL" Specifies the background image.

TEXT="Color"

LINK="Color"

 VLINK="Color"

 ALINK="Color"

Specifies the text color. TEXT indicates the general text, LINK 

does the link text, VLINK does the cached link text, and ALINK does the link text during mouse clicking.

<Hn>∼</Hn>

The Hn tags specify headers such as the title of each chapter. "n" is the headerlevel that can be specified in the range of 1 to 6, with 1 being the largest andboldest text.

• 

  Attribute name Explanation

  ALIGN=Position Specifies the position where the text is to be displayed.

"left," "center," or "right" can be specified as a position.

Example of use:

<H1> Introduction to HTML </H1><H2 ALIGN=right> About HTML </H2>

Displayed result:

<P>∼</P>

The P tag indicates a new paragraph. </P> can be omitted, but is requiredwhen specifying any optional attributes.

• 

  Attribute name Explanation

  ALIGN=Position Specifies the displayed position. "left," "center," or "right" can bespecified as a position

Example of use:

<P> First paragraphThe Line feed character is not significant for HTML text.<P> Second paragraph

 When the paragraph is specified, the Line feed character is inserted, orone line is placed. Then, the next sentence is described.<P ALIGN=right> Third paragraph

 When specifying the attribute, describe the end tag. </P>

Page 21: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 21/32

  Appendix A. Introduction to Web Applications 21

Displayed result:

<HR>This tag draws a horizontal line.

•   Attribute name Explanation

  ALIGN=Position Specifies the displayed position. "left," "center," or "right" can bespecified as a position

SIZE=Height Specifies the horizontal line height in the unit of pixels.

WIDTH=Width Specifies the horizontal line width in the unit of pixels. For thisspecification, the rate (%) of the horizontal line width for the Webbrowser-displayed width can be used specified.

NOSHADE Specifies the horizontal line without three-dimensional shading.

Example of use:

First horizontal line<HR>Second horizontal line<HR SIZE=5 WIDTH=50% NOSHADE>Third horizontal line<HR ALIGN=left SIZE=8 WIDTH=20%>

Displayed result:

<FORM>∼</FORM>This tag indicates an input form. Using the <INPUT> or <SELECT> tag in the

form enables the input component to be allocated. When executing the action,the data input to the <INPUT> or <SELECT> tag can be passed, which can beused for executing Web applications.

• 

Page 22: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 22/32

22 Appendix A. Introduction to Web Applications

  Attribute name Explanation

  ACTION="Action-name" Specifies the action to be executed when pressing the Submitbutton. Generally, it specifies a Web application to beexecuted.

METHOD=Method-name Specifies the method for passing the data input on the form tothe Web application. When the method name is GET, thisvalue is passed to the environment value, or when it is POST,this value is passed to the standard input.

ENCTYPE="Encode type" Specifies the encode type for data that is input or output tothe script. When the file uploading function is used though it isusually an omitted attribute, "Multipart/form-data" is specifiedas an attribute.

TARGET=Target-name Specifies the window (frame) where the action execution resultis displayed.

NAME=Form-name Add the name to the form. It is selected and used from thescript.

onSubmit="Script" Specifies the script to be executed when pressing the Submitbutton.

onReset="Script" Specifies the script to be executed when pressing the Resetbutton.

Example of use:

<FORM METHOD=POST ACTON="sample/action.script"> Name:<INPUT TYPE=TEXT NAME="FULLNAME1" VALUE="Your name" SIZE=30><BR>Password:<INPUT TYPE=PASSWORD NAME="PASSWORD1" SIZE=30>

<HR><P>Hobby:

<INPUT TYPE=CHECKBOX NAME="CHECK1" VALUE="Listening to music"CHECKED>Listening to music<INPUT TYPE=CHECKBOX NAME="CHECK1" VALUE="Reading">Reading<INPUT TYPE=CHECKBOX NAME="CHECK1" VALUE="Sports"> Sports

<P>Sex:<INPUT TYPE=radio NAME="RADIO1" VALUE="Male" CHECKED>Male<INPUT TYPE=radio NAME="RADIO1" VALUE="Female">Female

<P> Age:<SELECT NAME="DRDLIST1"><OPTION VALUE="10s">10 to 19 years<OPTION VALUE="20s" SELECTED>20 to 29 years<OPTION VALUE="30s">30 to 39 years<OPTION VALUE="40s or later">40 years or later

</SELECT>

<P>Occupation:<BR><SELECT NAME="LIST1" SIZE=3><OPTION VALUE="Free">Temporary worker<OPTION VALUE="Office worker" SELECTED>Office worker<OPTION VALUE="Public service">Public service<OPTION VALUE="Self-employed">Self-employed</SELECT>

<P>

Page 23: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 23/32

  Appendix A. Introduction to Web Applications 23

Comment:<BR><TEXTAREA NAME="TEXTAREA1" COLS=25 ROWS=4></TEXTAREA><P><INPUT TYPE=submit VALUE="Submit"><INPUT TYPE=reset VALUE="Reset"></FORM></BODY></HTML>

Displayed result:

Page 24: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 24/32

24 Appendix A. Introduction to Web Applications

•  <INPUT>This tag displays various form components on the input form. The displayedcomponent depends on the TYPE attribute.

  Attribute name Explanation

TYPE=Type-name The displayed content depends on the type name.

TEXT: Text

PASSWORD: Password

CHECKBOX: Checkbox

RADIO: Radio button

HIDDEN: Hidden area

BUTTON: Button

SUBMIT: Submit button

RESET: Reset button

FILE: File upload

NAME=Name Specifies the form component name.

•  <INPUT TYPE-TEXT>This tag is the form component for inputting the text.

  Attribute name Explanation

SIZE=Width Specifies the input area width.

MAXLENGTH=Length Specifies the maximum number of input characters.

onChange=Script Specifies the script to be called when the input area is changed.

onSelect=Script Specifies the script to be called when the character string in theinput area is selected.

onFocus=Script Specifies the script to be called when the focus is moved to theinput area.

onBlur=Script Specifies the script to be called when the focus moves out of theinput area.

• 

• 

<INPUT TYPE=PASSWORD>This tag is the form component for inputting the password, which is same as

TYPE=TEXT except that the input characters are displayed as asterisks (*).

<INPUT TYPE=CHECKBOX>This tag is the form component for specifying a checkbox.

  Attribute name Explanation VALUE="Character-string" Specifies the value to be sent when this item is checked.

CHECKED Sets the initial state of this item to the checked state.

onClick=Script Specifies the script to be called when this item is checked.

•  <INPUT TYPE=RADIO>This tag is the form component for a radio button (also called option button ingraphical programming).

Page 25: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 25/32

  Appendix A. Introduction to Web Applications 25

  Attribute name Explanation

 VALUE="Character-string" Specifies the value to be sent when this item is checked.

CHECKED Sets the initial state of this item to the checked state.

onClick=Script Specifies the script to be called when this item is checked.

•  <INPUT TYPE=HIDDEN>This tag is for a hidden field and is not displayed on the Web browser. Forexample, this field is used for Web applications to inherit the data through Webbrowsers.

  Attribute name Explanation

  VALUE="Character-string" Specifies the field value.

•  <INPUT TYPE=SUBMIT>This tag executes the action specified by the ACTION attribute in the FORM tag.

  Attribute name Explanation

 VALUE="Character-string" Specifies the character string to be displayed on the button.

onClick=Script Specifies the script to be called when this item is checked.

•  <INPUT TYPE=RESET>This tag resets all input items in FORM to initial values.

  Attribute name Explanation

 VALUE="Character-string" Specifies the character string to be displayed on the button.

onClick=Script Specifies the script to be called when this item is checked.

•  <INPUT TYPE=BUTTON >

This tag is used for JavaScript, so it is not displayed by Web browsers thatcannot use JavaScript (or JScript).

  Attribute name Explanation

 VALUE="Character-string" Specifies the character string to be displayed on the button.

onClick=Script Specifies the script to be called when this item is checked.

•  <INPUT TYPE=FILE>This tag is the form component to specify a file upload from the client side to theWeb server side.

Example of use:

<FORM METHOD=POST ACTON="sample/action.script"ENCTYPE="multipart/form-data">

<P>Send file 1<INPUT TYPE="file" NAME="FILE1"><BR>Send file 2<INPUT TYPE="file" NAME="FILE2"><BR><P><INPUT TYPE=submit VALUE="Send"><INPUT TYPE=reset VALUE="Reset"></FORM>

Page 26: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 26/32

26 Appendix A. Introduction to Web Applications

Displayed result:

<TEXTAREA>∼</TEXTAREA>

This tag displays the multiple-line-input field on the input form. The textbetween <TEXTAREA> and </TEXTAREA> is displayed in the field.

• 

  Attribute name Explanation

NAME="Character-string" Add the name to the field.

ROWS=n Specifies the number of lines in the text area.

COLS=n Specifies the number of columns in the text area.

onChange=Script Specifies the script to be called when the input area ischanged.

onSelect=Script Specifies the script to be called when the character string inthe input area is selected.

onFocus=Script Specifies the script to be called when the focus is moved tothe input area.

onBlur=Script Specifies the script to be called when the focus moves out of the input area.

<SELECT>∼</SELECT>This tag displays the select form component on the input form.

• 

  Attribute name Explanation

NAME="Character-string" Add the name to the field.

SIZE=n Specifies the number of displayed lines on the selective field.

MULTIPLE Can select multiple options.

onChange=Script Specifies the script to be called when the input area ischanged.

onFocus=Script Specifies the script to be called when the focus is moved tothe input area.

onBlur=Script Specifies the script to be called when the focus moves out of the input area.

<OPTION>∼</OPTION>This tag displays the select item on the SELECT tag. </OPTION> can beomitted.

• 

  Attribute name Explanation

SELECTED Selects the select state as the initial state.

 VALUE="Character-string" Specifies the value to be sent when this item is checked.

Page 27: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 27/32

  Appendix A. Introduction to Web Applications 27

Problems w ith Execution in Web Brow sers

For client/server systems, users cannot freely change the control of the applicationon the client side. For Internet/Intranet applications using Web browsers, however,the user can easily change the Web browser's condition, so it may depend on thisoperation as to whether the consistency of the Web application on the serverfunctions properly.

Generally, problems may be caused by the following operations:

• 

• 

• 

• 

When the Refresh button of the Web browser is pressed.

This can re-execute the processing that has already executed, so a conflict mayoccur in an application, such as during registering or updating.

When the Submit button (with "SUBMIT" specified in the INPUT tag INPUTattribute) is pressed two or more times by the user.

This also repeats the execution of a process, potentially causing a conflict in theapplication, such as during registering or updating.

When processing is started in the middle of an application by directly inputtingthe bookmark or URL.

 An application can be executed without authorization, so a security problem mayresult. Also, the application is not executed in the correct sequence, so a logicproblem may occur.

When a cached page is referred to.

Using the cache function of a Web browser, the requested Web page can bereferred to without accessing the server (it is held in cache on the client system),so the user may refer to secret information contained along with the Web pagein the cache, for example, the sales data and personal information.

Page 28: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 28/32

28 Appendix A. Introduction to Web Applications

The following illustrates examples of measures you can take to avoid theseproblems.

Examples of MeasuresUser's Operation

Web Browsers Web Applications

Use the Refresh button of the Web browser.

Using JavaScript, open thewindow without the Returnbutton.

Keep track of the applicationexecution sequence andconfirm that the applicationis correctly executed.

Press the Submit buttontwo or more times.

Using JavaScript, determinewhether the application ishalf-processed. If theapplication is half-processed,disable the Submit button.

Design the Web applicationin such a way that a problemdoes not result when thesame processing is executedtwo or more times.

Start the processing in themiddle of a transaction bydirectly inputting thebookmark or URL.

Using JavaScript, open thewindow without a bookmark.

Keep track of the applicationexecution sequence andconfirm that the applicationis correctly executed.

Refer to the cached page. Invalidate the cache of theWeb browser.

Keep track of the applicationexecution sequence andconfirm that the applicationis correctly executed.

Generally, the measures to take depend on the content of an application. Forexample, the cache may not need to be validated for applications with low securityrequirements. If an operational problem is caused by the design of the application,resolve it by reviewing the design.

Page 29: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 29/32

 

 Appendix B. Unicode

 All COBOL CGI subroutines in NetCOBOL support Unicode. Web applications thatoperate using Unicode improve the expressional performance as the number of characters increases. However, these Unicode Web applications differ fromconventional Web applications that use native code. Note the following whencreating and executing Web applications that support Unicode.

The following table indicates the differences to consider when creating and executingWeb applications using native code and Web applications using Unicode.

No. Item Native code Unicode

1 Web browsers Web browser that displaysnative code. Any of thelatest Web browsers can beused

Web browser thatsupports UCS-2 andtransmits Web parameterson UTF-8

2 Input code system fromWeb browser

Native code UTF-8 (*1)

3 Output code system toWeb browser

Native code UTF-8

4 Compile options Not required Required

5 Supported subroutines CGI SubroutinesSAF Subroutines

CGI Subroutines (Partiallimitations)

6 HTML document codesystem for Web pagesused for invokingapplications

Native code UTF-8, or UCS-2

7 HTML document codesystem for Web pagesused for processingoutput result (prototypefile)

Native code UTF-8

8 Log file code system Native code UTF-8

9 Coexistence of NetCOBOL applicationswith different codesystems

Basically, code systems cannot be mixed.

*1 Any input code system can be used in a COBOL application because theNetCOBOL Web subroutines execute conversion processing according to the COBOLapplication code system. Each case is described in the following topics.

Page 30: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 30/32

30 Appendix B. Unicode

Web Browsers

Native code Web applications can be used with any Web browser. Unicode Webapplications can only be used with a Web browser that supports Unicode. Note thatold Web browsers in particular do not usually support Unicode. The latest Webbrowsers support Unicode at various levels.

When Unicode is used in a NetCOBOL Web subroutine, the Web browser must beable to do the following:

Display the UTF-8 HTML document correctly, and• •  Transmit the Web parameter that is transmitted from a Web browser using

UTF-8.

Input Code System From Web Browser

Native code Web applications automatically identify whether the input code system

from the Web browser is native code. Therefore, the HTML document code systemused for Web pages for invoking an application could be native code. However, aUnicode Web application could only identify UTF-8. This is because Unicode Webapplications cannot identify UTF-8 and other code systems automatically andbecause in general Web browsers transmit Web parameter code systems as UTF-8when Unicode HTML documents are used. Therefore, a Web page for invoking anapplication that activates a Unicode Web application must be in Unicode.

Code System Output to Web Brow ser

In a Unicode Web application, the code system is UTF-8.

Compile Options

 A Unicode Web application does not require any special compile options. However, itis required to set the compile environment locale as Unicode locale. When creatingCOBOL applications that operate on Unicode, refer to Chapter 18, “Unicode” inNetCOBOL User’s Guide .

Page 31: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 31/32

  Appendix B. Unicode 31

Unicode Supported Subroutines

 You must use CGI subroutines to create Unicode Web applications.

The Web subroutines in the first column of the table below cannot be used by Web

applications with Unicode. Use the alternative subroutines on the right instead.

Web Subroutines 

Subroutine name Alternative subroutine

COBW3_GET_VALUE COBW3_GET_VALUE_XX

COBW3_GET_VALUE_NX

COBW3_GET_VALUE_XN

COBW3_GET_VALUE_NN

COBW3_CHECK_VALUE COBW3_CHECK_VALUE_X

COBW3_CHECK_VALUE_N

COBW3_SET_CNV COBW3_SET_CNV_XX

COBW3_SET_CNV_NX

COBW3_SET_CNV_XN

COBW3_SET_CNV_NN

COBW3_DEL_CNV COBW3_DEL_CNV_X

COBW3_DEL_CNV_N

COBW3_SET_REPEAT COBW3_SET_REPEAT_XX

COBW3_SET_REPEAT_NX

COBW3_SET_REPEAT_XN

COBW3_SET_REPEAT_NN

COBW3_DEL_REPEAT COBW3_DEL_REPEAT_XCOBW3_DEL_REPEAT_N

COBW3_SET_COOKIE COBW3_SET_COOKIE_XX

COBW3_SET_COOKIE_NX

COBW3_SET_COOKIE_XN

COBW3_SET_COOKIE_NN

COBW3_DEL_COOKIE COBW3_DEL_COOKIE_X

COBW3_DEL_COOKIE_N

COBW3_GET_COOKIE COBW3_GET_COOKIE_XX

COBW3_GET_COOKIE_NX

COBW3_GET_COOKIE_XN

COBW3_GET_COOKIE_NN

Page 32: Net Cobweb Guide

8/4/2019 Net Cobweb Guide

http://slidepdf.com/reader/full/net-cobweb-guide 32/32

32 Appendix B. Unicode

The Conventional Subroutines 

Subroutine name Alternative subroutine

COBW3_NAME COBW3_GET_VALUE_XX

COBW3_GET_VALUE_NX

COBW3_GET_VALUE_XN

COBW3_GET_VALUE_NN

COBW3_VALUE COBW3_CHECK_VALUE_X

COBW3_CHECK_VALUE_N

COBW3_CNV_SET COBW3_SET_CNV_XX

COBW3_SET_CNV_NX

COBW3_SET_CNV_XN

COBW3_SET_CNV_NN

COBW3_CNV_DEL COBW3_DEL_CNV_X

COBW3_DEL_CNV_N

COBW3_CNV_INIT COBW3_INIT_CNV

Refer to the associated Subroutines User's Guide for more information.

Code Systems

HTML Document Code System for Web Pages that Invoke Applications

In a native code Web application, the document code systems used for a Web page

that invokes an application are native code. However, in a Unicode Web application,the document code systems used for a Web page that invokes an application mustbe UTF8 or UCS-2 (depending on the type of Web browser).

HTML Document Code System for Web Pages that ProcessResult Output

In a Unicode Web application, only UTF-8 can be used for Web page for processingresult output.

Code System for Log Files

The code system for the log file that is output by the Web subroutines is determinedby the COBOL application code system. Therefore, the log file code is UTF-8.

NetCOBOL Applications with Combined Code Systems

NetCOBOL applications with different code systems cannot be used in the samesystem. Therefore, it is not possible to use multiple Web application code systems.Refer to the NetCOBOL User's Guide for details of combined code systems.