OpenTP1 Version 7 User's Guide

[Contents][Index][Back][Next]

3.2.3 Creating UAPs in COBOL2002

This subsection explains UAP creation in COBOL2002.

Organization of this subsection
(1) Specifying commands (COBOL2002)
(2) Example of a makefile (COBOL2002: SPP)
(3) Example of a makefile (COBOL2002: MHP)
(4) COBOL2002 Development Manager settings
(5) Environment settings when Visual Studio is also used (version earlier than COBOL2002 02-00)

(1) Specifying commands (COBOL2002)

This subsection explains the commands that are specified in the following cases:

(a) Using the trnmkobj command to create transaction control objects

If you use the trnmkobj command to create transaction control objects, make sure that you specify the -C "/Zl" option.

(b) Using the default transaction control object file (dc_trn_allrm.obj)

If you use the default transaction control object file (dc_trn_allrm.obj) that is created by using the trnlnkrm command, execute the trnlnkrm command with the -C "/Zl" option specified and re-create the object.

(c) Compiling the stub file

If you compile the C language source file created by stbmake, make sure that you specify the "/Zl" compiler option.

(2) Example of a makefile (COBOL2002: SPP)

This subsection shows an example of a makefile needed for creating an SPP.

(a) Names of source files

The following are the source files that are used in the example of a makefile:

(b) Example of a makefile

The following shows an example of a makefile:

!include <ntwin32.mak>
# TP1TEST Make File
CBLFG1 = -Compile,NoLink -Comp5 -Lib,CUI -Main,System
CBLFG2 = -Compile,NoLink -Comp5 -Lib,CUI
SYSLIB = $(conlibsdll)
TP1LIB = [libdam.lib]#1 [libtam.lib]#2 libbetran.lib
CCBL = ccbl2002
LK = ccbl2002 -Lib,CUI
 
all:TP1TEST.exe
# Compile
main.obj:main.cbl
         $(CCBL) $(CBLFG1) main.cbl
sev1.obj:sev1.cbl
         $(CCBL) $(CBLFG2) sev1.cbl
sev2.obj:sev2.cbl
         $(CCBL) $(CBLFG2) sev2.cbl
ex_sstb.obj:ex_sstb.c
         [$(cc) $(cflags) /Zl $(cvarsdll) $*.c]#3
# Create a stub source file
ex_sstb.c:ex.def
         $(DCDIR)\bin\stbmake $?
# Link
TP1TEST.exe: main.obj sev1.obj sev2.obj ex_sstb.obj
         $(LK) -OutputFile $*.exe $** \
         [$(DCDIR)\spool\trnrmcmd\userobj\dctrninf.obj \]#4
         $(TP1LIB) $(SYSLIB)

#1
Specify libdam.lib only if you use TP1/FS/Direct Access.

#2
Specify libtam.lib only if you use TP1/FS/Table Access.

#3
For ex_sstb.obj, specify the /Zl compiler option.

#4
Specify $(DCDIR)\spool\trnrmcmd\userobj\dctrninf.obj only if you use the transaction facility. For dctrninf.obj, specify the name of the object file for transaction control that was created by the trnmkobj command. If you execute the trnmkobj command, specify the -C "/Zl" option so that information about the manifest file is not embedded in the object. For details about the trnmkobj command, see Chapter 7. Operation Commands.

(3) Example of a makefile (COBOL2002: MHP)

This subsection shows an example of a makefile needed for creating an MHP.

!include <ntwin32.mak>
# makefile for making UAP(COBOL Language)
 
# COBOL2002 install directory
COBOL2002         = C:\Progra~1\HITACHI\COBOL2002
 
# command
STBMAKE           = $(DCDIR)\bin\stbmake.exe
 
# user server object
MHP_SRC           = CBLMHPM.obj TCPMHPSV.obj
 
# include file
INCDIR            =       -I.                 \
                          -I $(DCDIR)\include
 
# common object
SH_OBJ            =       $(DCDIR)\spool\trnrmcmd\userobj\mcf_sw.obj
 
# common library
LIBNAME           =       $(DCDIR)\lib\libmcf.lib \
                          $(DCDIR)\lib\libmnet.lib \
                          $(DCDIR)\lib\libbetran.lib
 
# COBOL2002 library
CBLLIBNAME        =       $(COBOL2002)\lib\cbl2k_32.lib \
                          $(COBOL2002)\lib\cbl2klc.lib \
                          $(COBOL2002)\lib\cbl2kdl.lib
 
# compiler options
CC                =       cl
CCBL              =       $(COBOL2002)\bin\ccbl2002
CCOPT             =       -nologo $(cflags) $(cvarsdll)
CONFIG            =       -c -Zl
CFLAGS            =       $(CCOPT) $(CONFIG) $(INCDIR)
CBLFG1            =       -Compile,Nolink -Comp5 -Lib,CUI -OpenTP1 -Main,System
CBLFG2            =       -Compile,Nolink -Comp5 -Lib,CUI -OpenTP1
 
# linker options
LK                =       ccbl2002 -Lib,CUI
LNKFLG            =       $(conflags) /NODEFAULTLIB
LINKAGE           =       $(conlibsdll) $(LIBNAME) $(CBLLIBNAME) msvcrt.lib
 
all : $(SH_OBJ) tcpmhp.exe
 
.SUFFIXES : .cbl
 
# compile
.c.obj   :
                $(CC) $(CFLAGS) $*.c
 
.cbl.obj :
                $(CCBL) $(CBLFG2) $*.cbl
 
TCPMHPSV.obj :
                $(CCBL) $(CBLFG2) TCPMHPSV.cbl
 
CBLMHPM.obj :
                $(CCBL) $(CBLFG1) cblmhpm.cbl
 
# stub, creating source file
cblmhp_sstb.c :
                $(STBMAKE) cblmhp.def
 
# link
tcpmhp.exe : $(MHP_SRC) cblmhp_sstb.obj
                $(LK) -OutputFile $*.exe $** $(LINKAGE) $(SH_OBJ)
                !if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;1
                !if exist $@.manifest del $@.manifest
 
$(SH_OBJ) :
                $(DCDIR)\bin\trnmkobj -o mcf_sw -R OpenTP1_MCF -C "/Zl"

(4) COBOL2002 Development Manager settings

Specify the COBOL2002 Development Manager settings as follows:

(5) Environment settings when Visual Studio is also used (version earlier than COBOL2002 02-00)

COBOL2002 with a version earlier than 02-00 is created by using Visual Studio .NET 2002. An error results if you use the ccbl2002 command and the linker (link) included in COBOL2002 to link an object created by using Visual Studio (Visual Studio 2005 and Visual Studio 2008). In order to avoid such an error, you must specify the environment settings according to the following rules and then link the program:

For COBOL2002 02-00 or later, this error will not occur because COBOL2002 is created by using Visual Studio 2005.