Fujitsu J Adapter Class Generator manuel d'utilisation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98

Aller à la page of

Un bon manuel d’utilisation

Les règles imposent au revendeur l'obligation de fournir à l'acheteur, avec des marchandises, le manuel d’utilisation Fujitsu J Adapter Class Generator. Le manque du manuel d’utilisation ou les informations incorrectes fournies au consommateur sont à la base d'une plainte pour non-conformité du dispositif avec le contrat. Conformément à la loi, l’inclusion du manuel d’utilisation sous une forme autre que le papier est autorisée, ce qui est souvent utilisé récemment, en incluant la forme graphique ou électronique du manuel Fujitsu J Adapter Class Generator ou les vidéos d'instruction pour les utilisateurs. La condition est son caractère lisible et compréhensible.

Qu'est ce que le manuel d’utilisation?

Le mot vient du latin "Instructio", à savoir organiser. Ainsi, le manuel d’utilisation Fujitsu J Adapter Class Generator décrit les étapes de la procédure. Le but du manuel d’utilisation est d’instruire, de faciliter le démarrage, l'utilisation de l'équipement ou l'exécution des actions spécifiques. Le manuel d’utilisation est une collection d'informations sur l'objet/service, une indice.

Malheureusement, peu d'utilisateurs prennent le temps de lire le manuel d’utilisation, et un bon manuel permet non seulement d’apprendre à connaître un certain nombre de fonctionnalités supplémentaires du dispositif acheté, mais aussi éviter la majorité des défaillances.

Donc, ce qui devrait contenir le manuel parfait?

Tout d'abord, le manuel d’utilisation Fujitsu J Adapter Class Generator devrait contenir:
- informations sur les caractéristiques techniques du dispositif Fujitsu J Adapter Class Generator
- nom du fabricant et année de fabrication Fujitsu J Adapter Class Generator
- instructions d'utilisation, de réglage et d’entretien de l'équipement Fujitsu J Adapter Class Generator
- signes de sécurité et attestations confirmant la conformité avec les normes pertinentes

Pourquoi nous ne lisons pas les manuels d’utilisation?

Habituellement, cela est dû au manque de temps et de certitude quant à la fonctionnalité spécifique de l'équipement acheté. Malheureusement, la connexion et le démarrage Fujitsu J Adapter Class Generator ne suffisent pas. Le manuel d’utilisation contient un certain nombre de lignes directrices concernant les fonctionnalités spécifiques, la sécurité, les méthodes d'entretien (même les moyens qui doivent être utilisés), les défauts possibles Fujitsu J Adapter Class Generator et les moyens de résoudre des problèmes communs lors de l'utilisation. Enfin, le manuel contient les coordonnées du service Fujitsu en l'absence de l'efficacité des solutions proposées. Actuellement, les manuels d’utilisation sous la forme d'animations intéressantes et de vidéos pédagogiques qui sont meilleurs que la brochure, sont très populaires. Ce type de manuel permet à l'utilisateur de voir toute la vidéo d'instruction sans sauter les spécifications et les descriptions techniques compliquées Fujitsu J Adapter Class Generator, comme c’est le cas pour la version papier.

Pourquoi lire le manuel d’utilisation?

Tout d'abord, il contient la réponse sur la structure, les possibilités du dispositif Fujitsu J Adapter Class Generator, l'utilisation de divers accessoires et une gamme d'informations pour profiter pleinement de toutes les fonctionnalités et commodités.

Après un achat réussi de l’équipement/dispositif, prenez un moment pour vous familiariser avec toutes les parties du manuel d'utilisation Fujitsu J Adapter Class Generator. À l'heure actuelle, ils sont soigneusement préparés et traduits pour qu'ils soient non seulement compréhensibles pour les utilisateurs, mais pour qu’ils remplissent leur fonction de base de l'information et d’aide.

Table des matières du manuel d’utilisation

  • Page 1

    J Adapter Class Generator User’s Guide[...]

  • Page 2

    Seventh Edition: August 2005 The contents of this manual may be revised withou t prior notice. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express writte n permission of Fujitsu Limited. © 1996-2005 Fujitsu Limited. All Rights Reserved.[...]

  • Page 3

    Preface The "NetCOBOL J Adapter Class Generator " is a tool that generates a COBOL class (adapter class) used to call a Java class. Using the adapter class thus generated makes the Java class library available from COBOL. A Java runtime environment must be inst alled to execute the generator or the adapter class generated. See " Prep[...]

  • Page 4

    Chapter 5. Adapter Class Reference Chapter 5 provides detailed information on the FJ-JAVA-BASE, FJ-JAVA-CONTROL and FJ-JAVA-ERROR classes provided by th e J adapter class generator, and adapter classes generated by the J adapter class generator. Appendix A. Message List Appendix A explains the messages output by the J adapter class generator, inclu[...]

  • Page 5

    Registered Trademarks The registered trademarks appearin g in this manual are as follows: Microsoft, Windows, and Windows NT ar e registered trademarks of Microsoft Corporation in the U.S. and other countries. Java and other trademarks including Java are trademarks of Sun Microsystems, Inc. in the U.S. and other countries. J Adapter Class Generator[...]

  • Page 6

    6 NetCOBOL J Adapter Class Generator User's Guide[...]

  • Page 7

    NetCOBOL J Adapter Class Generat or User's Guide 7 Contents Chapter 1. Outline of J Adapter Class Generator ......................................... 9 What is the J Adapte r Class Gene rator? ...............................................................10 What the J Adapter Cla ss Generator Can Do ...........................................[...]

  • Page 8

    8 NetCOBOL J Adapter Class Generator User's Guid e Messages Output duri ng Execut ion .....................................................................77 Chapter 7. Samples .................................................................................... 81 Sample 1 – Usin g Classe s ...................................................[...]

  • Page 9

    Chapter 1. Outline of J Adapter Class Generator This chapter explains the function and op erating environment of the J adapter class generator.[...]

  • Page 10

    10 Chapter 1. Outline of J Adapter Class Generator What is the J Adapter Class Generator? Taking advantage of the object-oriente d function, Fujitsu NetCOBOL enables programming using class libraries . The Fuji tsu NetCOBOL also provides many useful foundation classes. Meantime, as Java be comes popular, many Java class libraries are also provided.[...]

  • Page 11

    Chapter 1. Outline of J Adapter Class Generator 11 The Java class interface must be converted into the COBOL interface for a COBOL program to use Java classes. The J adapter class generator generates an adapter class that converts the Java interface into the COBOL interface. What the J Adapter Class Generator Can Do Using adapter classes generated [...]

  • Page 12

    12 Chapter 1. Outline of J Adapter Class Generator Therefore, the following restrictions apply to COBOL: - Listener Java registers a listener object, in which event processing logic is written, within an object that generates an event. However, since no COBOL object can be registered in a Java object, CO BOL cannot be used to write listeners. - Col[...]

  • Page 13

    Chapter 2. Adapter Class Generator Framework This chapter explains the framework of the J adapter class generator.[...]

  • Page 14

    14 Chapter 2. Adapter Class Generator Framework Adapter Class To make Java classes available to COBOL, a mechanism for converting the Java class interface into the COBOL interface is requ ired. The J adapter class generator works as an interface converting mechanism to generate adapter classes corresponding to Java classes. To use a Java class from[...]

  • Page 15

    Chapter 2. Adapter Class Generator Framework 15 Adapter Object At execution time, an adapter class genera tes the adapter object corresponding to a Java instance object. The adapter object: Holds the pointer to the corresponding Java instance object. • • Calls the corresponding Java method of the corresponding Java instance object Only the adap[...]

  • Page 16

    16 Chapter 2. Adapter Class Generator Framework[...]

  • Page 17

    Chapter 3. Developing Programs This chapter explains how to develo p programs that use Java classes.[...]

  • Page 18

    18 Chapter 3. Developing P rograms Creating Adapter Classes This section explains how to generate an adapter class from a Java class. Investigating the Java Class First investigate the specifications of the Ja va class and interface to be used (class name, package name, usage, and so on) to check whether the J adapter class generator can handle the[...]

  • Page 19

    Chapter 3. Developi ng Programs 19 adapter classes when the class file is not available, see " Generating an adapter class when the class file is not available ." Building an Adapter Class Finally, compile and link-edit the generated ad apter class source to create an adapter class library (DLL). Use the COBOL project manager to do so. Re[...]

  • Page 20

    20 Chapter 3. Developing P rograms Therefore, an adapter class cannot be generated normally without these class files. These class files may not be available depending on the environment. In this case, to create an adapter class normally, dummy class files having these file names must be prepared. Prepare a dummy class file as follows: 1. Create a [...]

  • Page 21

    Chapter 3. Developi ng Programs 21 Example: When an application uses only the println (O bject) method of the java.io.PrintStream class, specify as follows: C:> java2cob -r java.io.PrintStream -gm "println(java.lang.Object)" Specifying the -om Option or the "Option ReduceClass" Parameter Specifying the -om option or the &quo[...]

  • Page 22

    22 Chapter 3. Developing P rograms ... REPOSITORY. CLASS J-OBJECT AS "java-lang-Object" ... LINKAGE SECTION. 01 P1-OUTPUTSTREAM OBJECT REFERENCE J-OBJECT. ... Developing an Application That Uses an Adapter Class This section explains how to develop a program that uses an adapter class. Outline The flow of program processing using the adap[...]

  • Page 23

    Chapter 3. Developi ng Programs 23 Terminating the Java VM When an adapter class is no longer used, the Java VM must be terminated. Use the JVM-TERMINATE method of the FJ-JAVA-CONTROL class to terminate the Java VM. A coding sample is shown below: ... REPOSITORY. CLASS FJ-JAVA-CONTROL ... PROCEDURE DIVISION. ... INVOKE FJ-JAVA-CONTROL "JVM-TER[...]

  • Page 24

    24 Chapter 3. Developing P rograms An example of generating a Date class object is shown below: ... REPOSITORY. CLASS J-Date AS "java-util-Date" ... WORKING-STORAGE SECTION 01 anDate OBJECT REFERENCE J-Date. ... PROCEDURE DIVISION. ... INVOKE J-Date "Create-Date-01" RETURNING anDate. ... Note: • Since the adapter class name is[...]

  • Page 25

    Chapter 3. Developi ng Programs 25 An example of referencing the class variable AM_PM_FIELD (static field) of the DateFormat class is shown below: ... REPOSITORY. CLASS J-DateFormat AS "java-text-DateFormat" ... WORKING-STORAGE SECTION 01 FMT-Type PIC S9(9) COMP-5. ... PROCEDURE DIVISION. ... MOVE JF-AM_PM_FIELD OF J-DateFormat TO FMT-Typ[...]

  • Page 26

    26 Chapter 3. Developing P rograms An example of assigning an object, which has been referenced with Object class data, into Data class data is shown below: ... REPOSITORY. CLASS J-Object AS "java-lang-Object" CLASS J-Date AS "java-util-Date" ... WORKING-STORAGE SECTION 01 anDate OBJECT REFERENCE J-Date. 01 anObject OBJECT REFER[...]

  • Page 27

    Chapter 3. Developi ng Programs 27 … When the -s option or the "Option String" parameter is specified, the conversion between the String object and the COBOL data items is not necessary since an alphanumeric item can be specified as the String type argument and returns a value directly. … REPOSITORY. CLASS J-Date AS "java-util-Da[...]

  • Page 28

    28 Chapter 3. Developing P rograms If an adapter class is generated by specifying the -t option or the "Option Terminal" parameter, the character string that is sh orter than the data item length can be passed to a method without setting the end of string, since the end (X "00") of the character string is set in the adapter clas[...]

  • Page 29

    Chapter 3. Developi ng Programs 29 DISPLAY "Error Code: " errCode. DISPLAY "Error Message: " errMessage(1:errMessageLen). IF rc NOT = -1 THEN DISPLAY "Java Class Name: " expClass(1:expClassLen) DISPLAY "Java Exception Message: " expMessage(1:expMessageLen) END-IF. END DECLARATIVES. … Note: When the exceptio[...]

  • Page 30

    30 Chapter 3. Developing P rograms Conversion to Java2 When using the resources (execute-form programs (EXE), DLLs, adapter class source, and program source using adapter classes) created by JDK1.1.x, note the following: • Adapter class source and DLLs created by JDK 1.1.x can be used as they are in the Java2 environment. • If an adapter class [...]

  • Page 31

    Chapter 4. Using the Generator Command This chapter explains how to use the ge nerator command (java2cob), optional file and output result.[...]

  • Page 32

    32 Chapter 4. Using the Generat or Command Starting the J Adapter Class Generator Command Syntax When the constructor/method/field is not specified: java2cob [-classpath class-path ] [-d output-folder ] [-ov] [-om] [-oi] [-c{s|u}] [- s[ n ]] [-t] class-name/interface-name ... When the constructor/method/field is specified: java2cob [-classpath clas[...]

  • Page 33

    Chapter 4. Using the Generat or Command 33 generated. When specifying two or more constructors, they must be delimited by comma (,) or a blank. When two or more constructors of the sa me name exist, only the constructor that matches the parameter type is generated by specifying the parameter-type. If a parameter type is omitted, all of the constr u[...]

  • Page 34

    34 Chapter 4. Using the Generat or Command -om Specified to reduce the number of adapter cl asses generated. When this parameter is specified, the object reference types of all parameters excluding RETURNING become java-lang-Object. Instead, the pa rameter names are generated so that they include original type information (see "Specifying the [...]

  • Page 35

    Chapter 4. Using the Generat or Command 35 name, replace the period "." of the internal class name with a dollar sign "$". More than one class name or interface name can be specified. Environment Variable CLASSPATH Specifies the Java class/interface search path. When -classpath is specified, the CLASSPATH environment variable is[...]

  • Page 36

    36 Chapter 4. Using the Generat or Command Optional File The optional file is a text format file used to define generator options in a file instead of on the command line. The optional file is specified in a command line of the java2cob command. For example, specifying the many method names, etc. in the command line every time is troublesome during[...]

  • Page 37

    Chapter 4. Using the Generat or Command 37 Notes on describing the optional file: • Clauses enclosed by square brackets can be omitted. • Curly brackets indicate selection of clause that is delimited by ”| ”. • Italic type indicates a variable character string. Class class-name/interface-name Specification format Class class-name/interfac[...]

  • Page 38

    38 Chapter 4. Using the Generat or Command Option Code Specification format Option Code = { SJIS | UNICODE } Specification contents Specify a code system during execution time. Specify the same code system as that of the COBOL program that uses the Java class. When omitted, it is assumed that SJIS is specified. Meaning of the parameter • SJIS Spe[...]

  • Page 39

    Chapter 4. Using the Generat or Command 39 Option MethodTable Specification format Option MethodTable { YES | NO } Specification contents Specify whether or not to output the method name cross-reference list file (list of adapter class methods that correspond to the Java class methods). If omitted, it is assumed that NO is specified. The method nam[...]

  • Page 40

    40 Chapter 4. Using the Generat or Command Option ReduceClass Specification format Option ReduceClass = { YES | NO } Specification contents Specify whether or not to reduce the number of adapter classes. When YES is specified, the type of object reference except RETURNING becomes java-lang-Object, and the parameter name is generated so as to includ[...]

  • Page 41

    Chapter 4. Using the Generat or Command 41 Option Terminal Specification format Option Terminal = { YES | NO } Specification contents Specify whether or not to generate an adapter class allowed to set end character strings, for the method that has string -type fields and string-type parameters. (Refer to "End control of character string."[...]

  • Page 42

    42 Chapter 4. Using the Generat or Command Output The generator outputs the following files: • Adapter class source file • Generation name management file • Method name cross-reference list file Adapter Class Source File The adapter class source file corresponding to the specified Java class or interface is generated. If the specified class o[...]

  • Page 43

    Chapter 4. Using the Generat or Command 43 Figure 4.1 Generation Name Management File The J adapter class generator uses a gene ration name management file to manage the correspondence between the names used in Java classes and adapter classes. The generation name management file is ge nerated with the following name in the adapter class output fol[...]

  • Page 44

    44 Chapter 4. Using the Generat or Command A method name cross-reference list file is output in the following format: [Java] java-class-name [COBOL] cobol-external-class-name (1) [Java] type java-method-name (argument-type) [COBOL] cobol-external-method-name (2) [Java] type java-method-name (argument-type) OVERRIDE [COBOL] -None- ... (n) [Java] typ[...]

  • Page 45

    Chapter 5. Adapter Class Reference This chapter provides detailed informatio n on the FJ-JAVA-BASE, FJ-JAVA-CONTROL and FJ-JAVA-ERROR classes provided by th e J adapter class generator, and adapter classes generated by the J adapter class generator.[...]

  • Page 46

    46 Chapter 5. Adapter Class Ref erence Class Configuration The figure below shows the hierarchical re lationships among the FJ-JAVA-BASE, FJ- JAVA-CONTROL and FJ-JAVA-ERROR classe s provided by the J adapter class generator, and adapter classes generated by the J adapter class generator. Figure 5.0.1 Class Hierarchy • FJ-JAVA-BASE: Super class of[...]

  • Page 47

    Chapter 5. Adapter Class Ref erence 47 FJ-JAVA-BASE class The FJ-JAVA-BASE class is the super class of every adapter class. The FJ-JAVA-BASE class has the methods shown below. Method name Type Function J-NARROW Factory Assigns an object to a subclass. J-DUPLICATE Object Duplicates an adapter object. J-EQUALS Object Checks whether the Ja va objects [...]

  • Page 48

    48 Chapter 5. Adapter Class Ref erence J-EQUALS Method (object method) Explanation This method checks whether the Java objects indicated by two adapter objects are equal. Syntax INVOKE object-1 "J-EQUALS" USING object-2 RETURNING result Parameter and return value • object-1, object-2 (attribute: OBJECT REFERENCE FJ-JAVA-BASE) Specifies [...]

  • Page 49

    Chapter 5. Adapter Class Ref erence 49 Environment variable name Function COBJNI_MAX_NSTACK Specifies the maximum size (bytes) of the stack used for the native code. The default is 128 kilobytes. COBJNI_JAVA_STACK Specifies the maximum size (bytes) of the stack used for the Java code. The default is 400 kilobytes. COBJNI_MIN_HEAP Specifies the star[...]

  • Page 50

    50 Chapter 5. Adapter Class Ref erence FJ-JAVA-ERROR class The adapter class generates the exception object when some error is detected during execution period. The FJ-JAVA-ERRO R class is the class of that exception object. The exception message, exception type and exception information of Java can be acquired by using the FJ-JAVA-ERROR class meth[...]

  • Page 51

    Chapter 5. Adapter Class Ref erence 51 GET-EXCEPTION method (object method) Explanation The Java exception information is returned. Syntax INVOKE EXCEPTION-OBJECT "GET-EXCEPTION" USING message messageLength class classLength RETURNING result Parameter and return value • message (attribute: PIC X ANY LENGTH) Specifies the data item that [...]

  • Page 52

    52 Chapter 5. Adapter Class Ref erence Data types The Java data types are mapped to the COBOL data types as shown below: Java data type COBOL data type boolean PIC 1 byte PIC X PIC X(2) • When an ANK character is stored, the first byte is used and the second byte is X'00'. • When a Japanese character is stored, two bytes are used. •[...]

  • Page 53

    Chapter 5. Adapter Class Ref erence 53 Expansion format CLASS-ID. internal-class-name-1 AS " external-class-name " INHERITS internal- class-name-2 . ... FACTORY. ... <<Factory method corresponding to a constructor>> <<Property method corresponding to a class variable>> <<Factory method corresponding to a clas[...]

  • Page 54

    54 Chapter 5. Adapter Class Ref erence Note: Fujitsu NetCOBOL does not distingu ish between uppercase and lowercase letters of a class name. Therefore, cl ass names whose external class names are different only in uppercase and lowercas e letters cannot be used concurrently. Supplement When the adapter class of java.lang.String is generated, the pu[...]

  • Page 55

    Chapter 5. Adapter Class Ref erence 55 6. When an exception is declared for the constructor, the RAISING specification is generated. Generation example The factory method corresponding to construc tor Date() of the java.util.Date class is generated as shown below: METHOD-ID. CREATE-01 AS "Create-Date-01". [1] ... LINKAGE SECTION. 01 CREAT[...]

  • Page 56

    56 Chapter 5. Adapter Class Ref erence Class variable Explanation A public class variable (static field) is ma pped to a COBOL property method (factory). Expansion format METHOD-ID. GET PROPERTY property-name. ... LINKAGE SECTION. 01 property-value data-description-entry. PROCEDURE DIVISION RETURNING property-value. ... END METHOD property-name. ME[...]

  • Page 57

    Chapter 5. Adapter Class Ref erence 57 2. "out" is mapped to J-PRINTSTREAM (interna l class name of java-io-PrintStream) because its attribute is java.io.PrintStream. Supplement When a property name is generated from a field name, a number is assigned to secure the uniqueness of the name. The class browser can be used to check the corresp[...]

  • Page 58

    58 Chapter 5. Adapter Class Ref erence Generation example The factory method corresponding to class method abs (long) of the java.lang.Math class is generated as shown below: METHOD-ID. JM-ABS-01 AS "abs-01". [1] ... LINKAGE SECTION. 01 RTN-VALUE PIC S9(18) COMP-5. 01 PARA-1 PIC S9(18) COMP-5. PROCEDURE DIVISION USING PARA-1 RETURNING RTN[...]

  • Page 59

    Chapter 5. Adapter Class Ref erence 59 - If a same property name has already been assigned, the second and subsequent property names are each suffixed with a hyphen "-" followed by a two-digit number (01 to 99) to prevent name duplication. (See " Numbering names. ") - A name exceeding 30 characters is truncated after the 30th ch[...]

  • Page 60

    60 Chapter 5. Adapter Class Ref erence Instance Method Explanation A non-public instance method (non-stati c method) is mapped to a COBOL object method. Expansion format METHOD-ID. internal-method-name AS "external-method-name" [OVERRIDE]. ... DATA DIVISION. LINKAGE SECTION. [parameter ...] [return-value ...] PROCEDURE DIVISION [USING par[...]

  • Page 61

    Chapter 5. Adapter Class Ref erence 61 Generation example The object method corresponding to instance method getTime() of the java.util.Date class is generated as shown below: METHOD-ID. JM-GETTIME AS "getTime". [1] ... LINKAGE SECTION. 01 RTN-VALUE PIC S9(18) COMP-5. PROCEDURE DIVISION RETURNING RTN-VALUE. ... END METHOD JM-GETTIME. 1. S[...]

  • Page 62

    62 Chapter 5. Adapter Class Ref erence Parameter and return value • class-name Specifies the internal class name of the java-lang-String class declared in the REPOSITORY paragraph. • initialValue (attribute: PIC X ANY LENGTH) Specifies an alphanumeric data item as the initial value of the String object. • createdObject (attribute: OBJECT REFE[...]

  • Page 63

    Chapter 5. Adapter Class Ref erence 63 • createdObject (attribute: OBJECT REFERENCE SELF) Returns the generated object. Supplement When a data name is specified for initialValue , a String object as long as data item length is generated. However, inserting X”0000” in the statement can generate a String object shorter than data item length. ..[...]

  • Page 64

    64 Chapter 5. Adapter Class Ref erence GET-STRING-N method (object method) Explanation This method fetches the character string fr om the String object as a national data item. Syntax INVOKE anObject "GET-STRING-N" RETURNING stringValue Parameter and return value • anObject Specifies the String object from which a character string is to[...]

  • Page 65

    Chapter 5. Adapter Class Ref erence 65 GET-STRING-LENGTH-N method (object method) Explanation This method returns the length of the char acter string of the String object as the length (number of characters) of the national data item. Syntax INVOKE anObject "GET-STRING-LENGTH-N" RETURNING stringLength Parameter and return value • anObje[...]

  • Page 66

    66 Chapter 5. Adapter Class Ref erence Expansion format CLASS-ID. internal-class-1 AS "external-class-name" INHERITS internal- class-name-2. ... FACTORY. ... <<NEW-ARRAY method>> END FACTORY. OBJECT. ... <<GET-ARRAY-LENGTH method>> <<GET-ARRAY-ELEMENT method>> <<SET-ARRAY-ELEMENT method>> EN[...]

  • Page 67

    Chapter 5. Adapter Class Ref erence 67 CLASS-ID. JA-1-STRING AS "JA-1-java-lang-String" INHERITS J-OBJECT. ... END CLASS JA-1-STRING. Adapter classes of int [] [] [] are generated as shown below: CLASS-ID. JA-3-INT AS "JA-3-int" INHERITS J-OBJECT. [1] ... END CLASS JA-3-INT. CLASS-ID. JA-2-INT AS "JA-2-int" INHERITS J-[...]

  • Page 68

    68 Chapter 5. Adapter Class Ref erence ... REPOSITORY. CLASS JA-2-INT AS "JA-2-int" CLASS JA-1-INT AS "JA-1-int" ... 01 anArray OBJECT REFERENCE JA-2-INT. 01 wArray OBJECT REFERENCE JA-1-INT. ... INVOKE JA-2-INT "NEW-ARRAY" USING n RETURNING anArray. [1] PERFORM VARYING I FROM 0 BY 1 UNTIL I >= n INVOKE JA-1-INT &qu[...]

  • Page 69

    Chapter 5. Adapter Class Ref erence 69 SET-ARRAY-ELEMENT method (object method) Explanation This method sets an element of an array object. Syntax INVOKE anObject "SET-ARRAY-ELEMENT" USING inx elemValue Parameter and return value • anObject Specifies the array object in which an element is to be set. • inx (attribute: PIC S9(9) COMP-5[...]

  • Page 70

    70 Chapter 5. Adapter Class Ref erence Name that is always unique according to generation rules A class name is generated from a class na me or interface name qualified by a Java package name. Since the qualified name is unique, the COBOL name generated from it is always unique. The sa me applies to an array class name. Thus, no class names and arr[...]

  • Page 71

    Chapter 5. Adapter Class Ref erence 71 the J adapter class generator. For instance, the java.io.ObjectInputStream class inherits the java.io.ObjectInput interfac e and java.io.InputStream class (see the figure below). Figure 5.2 Relationships among java.io.ObjectInput interface, java.io.InputStream class, and java.io.ObjectInputStream class For the[...]

  • Page 72

    72 Chapter 5. Adapter Class Ref erence read() read read(byte[]) read-01 java.io.ObjectInput interface read(byte[], int, int) java-io-ObjectInput class read-02 read() read read(byte[]) read-01 java.io.InputStream class read(byte[], int, int) java-io-InputStream class read-02 read() read java.io.ObjectInputStrea m class read(byte[], int, int) java-io[...]

  • Page 73

    Chapter 6. Messages This chapter explains the messages output by the J adapter class generator, including the operator responses to the messages.[...]

  • Page 74

    74 Chapter 6. Messa ges Java2cob Command Messages This section explains the messages output by the java2cob command, including the operator responses to the messages. Adapter class generation failed because of a memory space shortage. Terminate unnecessary applications and retry. A memory space shortage occurred. Terminate unnecessary applications,[...]

  • Page 75

    Chapter 6. Messa ges 75 Error: An invalid class name "xxx" was specified. Specify a Java class name or interface name qualified by a package name. Specify a valid class name or interface name and retry. Error: A valid directory name was missing. The option was ignored to continue processing.<<Same as above>> Specify a valid di[...]

  • Page 76

    76 Chapter 6. Messa ges Warning: The method name of constructor "xxx" exceeded 160 characters. The characters after the first 160 characters were deleted. Check whether deleting the characters after the first 160 characters results in an unusable name. Error: Class information was not found. Generation was interrupted. Check whether there[...]

  • Page 77

    Chapter 6. Messa ges 77 Messages Output during Execution This section explains the messages output during execution of programs using adapter classes, including the oper ator responses to the messages. The message format is shown below: Class name information: Message text Class name information indicates the adapter class in which an error occurre[...]

  • Page 78

    78 Chapter 6. Messa ges The current thread could not be connected to Java VM. Check whether the program properly invokes the JVM-ATTACH method. The current thread could not be disconnected from Java VM. Check whether the program properly invokes the JVM-DETACH method. The adapter class generated by the J adapter class generator contains a Java clas[...]

  • Page 79

    Chapter 6. Messa ges 79 No Java field is found. Check whether the Java class/interface was changed after execution of the J adapter class generator. The Java class/interface was probably ch anged after generation of an adapter class. Check the Java class/interface. Java class initialization failed. Call the J adapter class generator supplier. The J[...]

  • Page 80

    80 Chapter 6. Messa ges[...]

  • Page 81

    Chapter 7. Samples Sample 1 – Using Classes Example 1: Example of using java.lang.System, java.io.PrintStream, and java.util.Date classes This section explains the “Sample Program - Example 1 ” provided with this product. Example 1 shows how the java.lang.System, java.io.PrintStream, and java.util.Date classes of Java are used from COBOL. Out[...]

  • Page 82

    82 Chapter 7. Samples Generating adapter classes Generate adapter classes using the java2cob command. java2cob java. lang. Object [1] java2cob java.lang. System [2] java2cob java. until. Data [3] 1. Generate an adapter class of the java.lang.Object class (required for calling Java). 2. Generate an adapter class of the java .lang.System class used f[...]

  • Page 83

    Chapter 7. Samples 83 Sample 2 – Specifying Method Example 2: Example of generating an adapter class by specifying constructor/method/field This program description explains “Sample Program - Example 2” provided with this product. Example 2 shows how to generate the adapter class specifying constructor/method/field. Outline The program conten[...]

  • Page 84

    84 Chapter 7. Samples Generating adapter classes Generate adapter classes using the java2cob command. java2cob -r java.lang.System -gf out [1] -r java.io.PrintStream -gm "println(java.lang.Object)" [2] -r java.util.Date -gc "Date()" [3] Note: “” shows the continuance line. 1. Generate an adapter class of the java.l ang.[...]

  • Page 85

    Appendix A. Message List This chapter explains the messages output by the J adapter class generator, including the operator responses to the messages.[...]

  • Page 86

    86 Appendix A. Message Li st Java2cob Command Messages This section explains the messages output by the java2cob command, including the operator responses to the messages. Adapter class generation failed because of a memory space shortage. Terminate unnecessary applications and retry. A memory space shortage occurred. Terminate unnecessary applicat[...]

  • Page 87

    Appendix A. Message Li st 87 Messages Output during Generation This section explains the messages output during adapter class generation, including the operator responses to the messages. The message format is shown below: Message type: Message text The message types are shown below: Message type Level Meaning Error Severe No adapter class is gener[...]

  • Page 88

    88 Appendix A. Message Li st Error: The suffix number exceeded 99. Generation was interrupted. Retry while specifying –r option, -gc opti on, -gm option, -gf option, -om option, constructor/method/field-specifying-option in “Class class-name/interface-name ” parameter, or “Option ReduceClass” parameter to decrease the number of classes, f[...]

  • Page 89

    Appendix A. Message Li st 89 Warning: The property name of field "xxx" exceeded 30 characters. The characters after the first 30 characters were deleted. Check whether deleting the characters after the first 30 characters results in an unusable name. Warning: The name of method "xxx" exceeded 160 characters. The characters after[...]

  • Page 90

    90 Appendix A. Message Li st Messages Output during Execution This section explains the messages output during execution of programs using adapter classes, including the oper ator responses to the messages. Messages given while execution is underway ar e output to the same target output as that of the DISPLAY statement that is specified by UPON SYS[...]

  • Page 91

    Appendix A. Message Li st 91 The adapter class generated by the J adapter class generator contains a Java class name in invalid format. Contact the J adapter class generator supplier. The J adapter class generator failed. Co llect failure information and call your Fujitsu systems engineer. A same name is used for a parent and its child in the Java [...]

  • Page 92

    92 Appendix A. Message Li st No Java method is found. Check whether the Java class/interface was changed after execution of the J adapter class generator. The Java class/interface was probably ch anged after generation of an adapter class. Check the Java class/interface. The character string could not be fetched from the String object. Call the J a[...]

  • Page 93

    Appendix B. Exception Type List The exception types that can be acquired by the GET-CODE method of the FJ-JAVA- ERROR class are described in this chapter. 1 Meaning Java VM detected an error. Remove the error cause. Response The Java VM detected an execution-time e rror. Determine the error cause from the exception information returned by the GET-E[...]

  • Page 94

    94 Appendix B. Excepti on Type List 5 Meaning No Java field is found. Check whether th e Java class/interface was changed after execution of the J adapter class generator. Response The Java class/interface was probably changed after generation of an adapter class. Check the Java class/interface. 6 Meaning The subscript of the array object is invali[...]

  • Page 95

    Appendix B. Excepti on Type List 95 10 Meaning A required Java class/interface definition is not found. Check the environment variable (COBJNI_CLASSPATH). Response No Java class/interface is found on the search path. Check whether the value of the environment variable (COBJNI_CLASSPATH) is valid. 11 Meaning No Java interface/abstract class instance[...]

  • Page 96

    96 Appendix B. Excepti on Type List 15 Meaning An internal logical error (inconsistency between the return value and object reference) occurred. Call the J adapter class generator supplier. Response The J adapter class generator failed. Collect failure information and call your Fujitsu systems engineer. 16 Meaning Java VM detected an error. Remove [...]

  • Page 97

    Index adapter class, 14, 34, 46, 51 adapter object, 15 alphanumeric item, 27, 28, 34, 40 array, 65 assign, 25 -c, 32, 54, 63 class file, 18, 20 class method, 11, 26, 57 class variable, 11, 25, 26, 56 classpath, 35, 37 -classpath, 32 constructor, 32, 34, 37, 51, 54, 55, 57 , 70 constructors. See constructor cross-reference, 33, 39, 42 , 43, 58 -d, 3[...]

  • Page 98

    98 Index 98 -r, 20, 33, 34, 58 ReduceClass , 40 restrictions, 12 return value, 57 Runtime, 12 -s[n], 34 SET-ARRAY-ELEMENT, 69 source file, 19, 29, 42 String class, 26, 44, 54, 61 -t, 34 Termination, 22 Unicode, 35, 38 unique name, 69[...]