72
Introduction to OSS Part 2

Tandem OSS Training Jan 2810

  • Upload
    nam-kim

  • View
    439

  • Download
    7

Embed Size (px)

Citation preview

Page 1: Tandem OSS Training Jan 2810

Introduction to OSS

Part 2

Page 2: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 2

Recap from Introduction to OSS Part 1

� Introduction to OSS

� OSS File System Basics

� Basic Commands and Utilities

� OSS File Editing

Page 3: Tandem OSS Training Jan 2810

Command Scripting

Module 5

Page 4: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 4

Running OSS Commands from the Guardian Environment and Vice Versa

OSH gtacl

Guardian OSS

Guardian files, programs,and objects

OSS files, programs,and objects

Page 5: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 5

Invoking TACL Commands from OSS (1 of 2)

The gtacl utility creates a Guardian process from the OSS shell environment

� Uses Guardian process creation API to:

� Create a Guardian process with TACL-like options

� Create a Guardian TACL process that will executea single TACL command

� Syntax:$ gtacl -p <program file> [<operand>]

$ gtacl -c <operand> [<operand>]

Page 6: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 6

Invoking TACL Commands from OSS (2 of 2)

� option -p <program file>

� Starts Guardian process from <program file>

� Default: Starts TACL process

� Can be used with -cpu #, -gpri #, -name /G/name, -debug, … ,options

� option -c <operand>

� Creates a TACL process that executes a single command and then returns to the OSS shell

� <operand> is command passed to the TACL process

� Might require either double or single quotes (" or ') if string contains spaces or metacharacters (details later)

Page 7: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 7

OSS gtacl Utility Examples (1 of 2)/users/member[62]: gtacl -name /G/mytac -gpri 150 -cpu 0 -p taclTACL 1> logon memberPassword: Last Logon: 22 MAY 1997, 16:38TACL (T9205D40 - 12JUL96), Operating System D40, Release D43.02

: :$DATA MEMBERA 1> status *,term Process Pri PFR %WT Userid Program file Hometerm$MYTAC 0,72 150 R 000 230,1 $SYSTEM.SYS77.TACL $ZTNT.#PTY004F $Z10R 3,46 171 001 230,1 $SYSTEM.SYS77.TACL $ZTNT.#PTY004F $Z11M X 3,288 170 001 230,1 /bin/gtacl $ZTNT.#PTY004F

X 3,292 170 000 230,1 /bin/sh $ZTNT.#PTY004F 3,296 170 001 230,1 $SYSTEM.SYS77.OSH $ZTNT.#PTY004F

$DATA MEMBERA 2> EOF! Are you sure you want to stop this TACL (\SOFTED.$MYTAC)?y /users/member[63]: gtacl -p fup copy taclcstm?TACL MACRO == TACL created this file for your protection. 2 RECORDS TRANSFERRED/users/member[64]: gtacl -p edit "\$data.member.taclcstm;lu a;e"TEXT EDITOR - T9601D20 - (01JUN93) CURRENT FILE IS $DATA.MEMBER.TACLCSTM ?TACL MACRO== TACL created this file for your protection. /users/member[65]:

Page 8: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 8

OSS gtacl Utility Examples (2 of 2)

/users/member[66]: gtacl -c time

January 31, 2001 19:11:06

/users/member[67]: gtacl -c "status *,term"

Process Pri PFR %WT Userid Program file Hometerm

$Z10Z 3,36 170 R 000 34,100 $SYSTEM.SYS77.TACL $ZTNT.#PTY004F

$Z10R 3,46 171 001 34,100 $SYSTEM.SYS77.TACL $ZTNT.#PTY004F

$Z10Y X 3,288 170 001 34,100 /bin/gtacl $ZTNT.#PTY004F

X 3,292 170 000 34,100 /bin/sh $ZTNT.#PTY004F

3,296 170 001 34,100 $SYSTEM.SYS77.OSH $ZTNT.#PTY004F

/users/member[68]: gtacl -c 'fileinfo $data.membera.*'

$DATA.MEMBERA

Code EOF Last Modification Owner RWEP PExt SExt

TACLCSTM 101 2048 31JAN2001 10:32:16 34,100 AAAA 8 32

/users/member[69]:

Page 9: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 9

Shell Scripts

� Shell commands can be stored in ASCII text files (such as command files).

� Can be programmed like TACL macros.

� Needs to be secured for execution:$ chmod u+x my_script

� Executed by typing in the filename such as:$ my_script # Executes in subshell

$ . my_script # Executes in current shell

$ ./my_script # When my_script is not in PATH

� Commands can be stacked by using the semicolon (;)

Page 10: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 10

Comments and Metacharacters

� Comments# This is a comment to let you know what I am doing.

� Metacharacters$ ` ‘ “ \

� The slash “\” is used to escape the other metacharacters.

� The semicolon “;” is used to separate commands

� The ampersand “&” executes a command in the background

� The braces “{ }” are used for command grouping (for body of a function)

� The parens “()” are used to group commands for a subshell or to identify a function (details later)

Page 11: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 11

Variables

� Name can be any sequence of letters and digits.

� First character must be a letter.

� Hyphen “-” is not allowed.

� Declaration and initialization:$ me=Liew # Note absence of blanks

$ xyz=" HH” # Quotes needed with embedded blanks

� Display with echo statement and use of “$”:$ echo This is Mr. $me

� Removed with the unset command:$ unset me

� No special concatenation operator:$ me=$me" Goon-Loong" # me has "Liew Goon-Loong"

$ me=$me "Sir" # me becomes "Liew Goon-Loong Sir"

$ me=$me$xyz # me becomes "Liew Goon-Loong Sir HH"

Page 12: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 12

alias Command

� The alias command is a mechanism for defining new commands.

� Usage examples:

� Defined in this manner:

$ alias w=who

$ alias duh=`who; date`

� To obtain a listing of defined aliases:

$ alias

� To obtain a listing of a specific alias:

$ alias w

� Invoked by referring to the name:

$ w

� Can be used to stack multiple commands:

$ alias w="who;date; time"

Page 13: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 13

Control Structures

These control structures allow conditional testing and looping:

� if then fi

� if then else fi

� for in do done

� for do done

� while do done

� until do done

� case in esac

Page 14: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 14

if Statement

� Test command is used to ascertain TRUE or FALSE

� TRUE is 0 and FALSE is 1

� In place of test, the bracket pair [ ] can be used

� Examples:if test 6 = 6

thenecho "equal"

else

echo "not equal" fi

# [ ] is short form for test

if [ 6 = 6 ]

then

echo "Same same, both the same"

else

echo "Not the same"

fi

Page 15: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 15

test Command Options

� General formtest condition or [ condition ]

� Some options for condition are:

� -a file — # True if file exists

� -d file — # True if file exists and is a directory

� -e file — # True if file exists

� -f file — # True if file exists and is a regular file

� -n string — # True if the length of string is nonzero

� -p file — # True if file exists and is a named pipe (FIFO)

� -r file — # True if file exists and process has read permission

� -s file — # True if file exists and has a size > 0

� -u file — # True if file exists and its set-user ID bit is set

� -w file — # True if file exists and process has write permission

� -x file — # True if file exists and is executable

� -z string — # True if string is null

� Use man pages for test to obtain more options

Page 16: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 16

Loops

� for loop# This script demos use of the for ....do loop.

for season in Spring Summer Autumn Winter

do

echo "Season is " $season

done

Echo

� while loop# Script to demo while construct and use of exprutility.

number=0

while [ "$number" -lt 5 ]

do

echo "$number"

number=`expr $number + 1 `

done

echo

Page 17: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 17

until Loop

Example:# Script to demo until construct and use of expr utility.

number=0

until [ "$number" -gt 5 ]

do

echo "$number"

number=`expr $number + 1 `

done

echo

Page 18: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 18

case Structure

Example:# Script to demo use of case construct.

echo "Enter A, B, or C: \c"

read letter # More on read command later

case "$letter" in

a | A) echo "You entered A."

;;

b | B) echo "You entered B."

;;

c | C) echo "You entered C."

;;

* ) echo "Not A or B or C."

;;

esac

Page 19: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 19

Arguments

� Arguments are positional and space separated

� $0 is the name of the script file

� $# is the argument count

� $n is the nth. argument’s value

� $@ is the argument list (like %*% in TACL)

� $* is also the argument list

� $$ is PID number of the current process

� $! is PID number of the most recent background task

� $? is the exit status of the last executed task or the True or False value from the last execution of the test command

Page 20: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 20

Argument Usage

Example:# Script to demo argument usage.

# Usage: <This-file> arg1 arg2 arg3

echo "arg count is: $#"

echo "arg list is: $@"

for arg in $@

do

echo $arg

done

Page 21: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 21

read Command

Syntax:read [ -r ] variablename …

where -r specifies that the read command treat a \ (backslash) character as just part of the input line, not as a control character.

� Reads from standard input

� Input items are moved to the target variables

� If there is only one target, then all input items are moved to that target

� Line continuation is a slash (\), unless the -r flag is used

� Default item separator is white space

� IFS (Internal Field Separator) environment variable is used to specify separators

Page 22: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 22

Miscellaneous Statements

� for, while, or until loops can be interrupted with:

� break

� continue

� return

� break transfers control to the statement after the done statement, terminating execution of the loop

� continue transfers control to the done statement, which continues execution of the loop

� return terminates the function or script

� exit provides a return code to the parent:

� Used to terminate a script

� Non-zero return code represents false, meaning failure

� Zero return code represents true, meaning success

Page 23: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 23

Arithmetic on Shell Variables

x=1 expr 5 + 1

x=$x+1 6

echo $x

1+1

expr 17 * 6

102

x=1

expr $x + 1

2

Page 24: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 24

let Command

x=5

let x=x+1

echo $x

6

X=5y=6let "x = x + 1" "y = y - 2"echo $x $y6 4

let "x = (x + 10) * y"

echo $x

64

let (( x = x + 6 ))

echo $x

70

Page 25: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 25

select Command

� Useful for continuously displaying a menu to the user

� Displays each word, preceded by its relative numeric position inlist

� The variable PS3 is displayed as a prompt (default: #?)

� User keys in a numeric value; var holds corresponding wordi from list

� Execution stops with break statement or when user enters Control^Y

select var in word1 word2 … wordn

do

command

command

done

1

PS3="Pick one of the above numeric options: "

select choice in Add Delete Quitdo

case "$choice"inAdd) echo Acting on Add function;;Delete) echo Acting on Delete function;;Quit) break;;*) echo Wrong choice;;

esacdone

Page 26: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 26

Debugging Scripts

sh -x myscript

execute the script and show all the statements that get executed with the variables and wildcards already expanded.

check for syntax errors without actually executing the program.

sh -n myscript

If this returns nothing then your program is free of syntax errors.

Page 27: Tandem OSS Training Jan 2810

OSS Development

Module 6

Page 28: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 28

Workstation

HP NonStop Server

OSS Development Environment

Editor (for example,CodeWright)

FTP (for example, FTPC32)

Editor (vi, ed)

CC++ CompilersCOBOL

Enterprise Toolkit (ETK)Enterprise Plug-in Eclipse

Visual Inspect(VI)

Inspect, eInspect

Page 29: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 29

Editing Source Files

� EDIT files

� Type 101, exist only in Guardian name space

� ASCII text files

� Type 180, exist in OSS and Guardian name space

� Guardian programs can access only Guardian files

� EDIT/TEDIT editors work on only EDIT files

� OSS programs can access OSS and Guardian files

� vi and ed editors work only ASCII text files

� Conversion programs:

� EDITTOC converts EDIT file to ASCII text file

� CTOEDIT converts ASCII text file to EDIT file

� cp /G/vol/subvol/<editfile> <oss path> converts EDIT file to ASCII text file

Page 30: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 30

pax Utility

� Portable Archive Interchange (pax) utility

� POSIX-compliant program

� Supports ustar and cpio archive formats

� Reads, writes, and lists members of an archive file

� Copies directory hierarchies

� Supports both disk and tape media

� Command syntaxRead: pax -r [-cdiknuv] [-f archive] ...

Write: pax -w [-adituvX] [-b blocksize] [-f archive] ...

List: pax –f archive

� Notes

� ustar format is written by default

� Standard input/output is assumed if -f flag not provided

Page 31: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 31

tar Utility

� Useful for file transfers

� Packs files into archive file on source machine

� Extracts files from archive file on destination machine

� Examples:

� To archive all .c and .h files in current directory:

$ tar -cvf tarfile *.c *.h

� To archive files in sourcedir directory:

$ tar -cvf tarfile sourcedir

� To list archive files in tarfile archive file:

$ tar -tvf tarfile

� To extract only .c and .h files from tarfile archive:

$ tar -xvf tarfile *.c *.h

Page 32: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 32

Transferring Files to OSS

� On the UNIX/Windows workstation:

� Create pax file

$ pax -w -v -f src.pax [files . . .]

� FTP file to OSS environment

$ ftp <OSS host>

> quote oss

> cd src

> put src.pax src.pax

� On the OSS host:

� Change to src directory

$ cd src

� Extract archive files

$ pax -r -v -f src.pax

Page 33: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 33

Retrieving Files from OSS

� On the OSS host:

� Create archive file in src directory

$ cd src

$ pax -w -v -f paxfile [files . . .]

� On the UNIX/Windows workstation:

� Get pax file using FTP

$ ftp <OSS host>

> quote oss

> cd src

> get paxfile paxfile

� Read pax file

$ pax -r -v -f paxfile

Page 34: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 34

Native C and C++ Compilers

� TNS native C compiler

� Accepts K&R C and ISO/ANSI C

� TNS native C++ compiler

� More powerful than TNS C++ preprocessor

� Can use forward declarations of class specializations

� Can use nested templates

� Compiler drivers TNS/R

� ccomp, cppcomp for Guardian environment

� c89 for OSS environment

� Compiler drivers TNS/E

� nmc, nmcPlus for Guardian environment

� c89 for OSS environment

� Guardian and OSS environment cross compilers

Page 35: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 35

Native c89 C Compiler

� Accepts C/C++ language source files that comply with ISO/ANSI C standard.

� Is supplied with standard header files and run-time libraries

� Reads input files using OSS APIs

� Use /G syntax to access Guardian files

� Supports NonStop extensions

� Embedded SQL

� Guardian procedure calls

� Supports WIDE data model and native memory model

� 32-bit integers and 32-bit pointers

� Available on OSS and Guardian environments

Page 36: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 36

Native c89 C Compilation System

� Components

� sqlcfe — Processes embedded NonStop SQL/MP source statements

� cfe — Preprocesses C/C++ source code into binary ucode

� uopt — Optimizes binary ucode

� ugen — Processes binary ucode into binary assembly code

� as1— Processes binary assembly code into object code

� nld — Links object and library files into an executable program

� sqlcomp — Further processes non-SRL executable file

� Input to c89

� C source files and object files generated by c89 C

� Libraries of object files produced by the ar utility or by nativecompilers in either the OSS or Guardian environments

Page 37: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 37

Input/Output Files

� OSS files

� .L — Compilation listing

� .o — Object file

� .a — Archive file

� .srl — Shared run-time library (SRL)

� .c — C source file

� .C — C++ source file

� .cc — C++ source file

� .cpp — C++ source file

� Guardian files in /G

Page 38: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 38

Compiling/Linking Flow

prog.c

c89

a.outeld

eld

prog.o

ar

prog.oprog2.oprog3.o

lib.a

executable

prog.L

-Wnosuppress

Page 39: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 39

c89 Command Options (1 of 2)

� -c — Compiles source file and suppresses binding

� -g — Produces symbolic information for debug

� -o — Produces named output file

� -D — Defines name value

� -U — Undefines name value

� -E — Expands preprocessor directives without compiling

� -I — Changes search order for header files

� -L — Changes search order for libraries

� -O — Optimizes executable

� -W — Uses options specific to NonStop systems

Page 40: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 40

c89 Command Options (2 of 2)

� -Wnolink — Suppresses linking with nld

� -Wextensions — Enables NonStop extensions

� -Wnld= or –Weld= — Passes arguments to nld/eld utility

� -Woptimize= — Specifies optimization level 0, 1, or 2 (default is 1)

� -Wsystype= — Execution environment, default OSS

� -Wsqlcomp=[args] — Invokes NonStop SQL/MP compiler, sqlcomp

� -Wrunnamed — Directs nld/eld to set RUNNAMED ON

� -Wfieldalign — Controls alignment within structures

� -Winnerlist — Shows generated instructions for each statement

� -Wsuppress — Default mode, suppresses listing

Page 41: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 41

c89 Command Examples

� To compile test.c and produce a.out executable:$ c89 test.c

� To create native SRL, called mylib, in current directory:$ c89 -Wsrl -Wnld=-ul -o mylib mylib.c

� To compile source code modules x.c, y.c, and z.c; bind object files into executable called tst; and produce symbolic information for debugging:

$ c89 -g -o tst x.c y.c z.c

� To compile a source file having HP NonStop SQL/MP statements, without sqlcomp phase:

$ c89 srvr.c -Wsql

� To compile a source file having SQL/MP statements, including sqlcomp phase:

$ c89 srvr.c -Wsql -Wsqlcomp="catalog \$data.applcat"

Page 42: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 42

The make Program

� Compatible with the UNIX make program

� Default make file names

� makefile, Makefile, s.makefile, and s.Makefile

� make file rules

� Default rules kept in /usr/share/mk/posix.mk

� Macros typically defined in the UNIX make file

� CC = cc

� Macros defined in the OSS make file

� CC = c89

� CFLAGS = -Wextensions

Page 43: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 43

COBOL Compilers

� cobol — Compiles standard TNS COBOL85 programs

� nmcobol — Compiles G native COBOL85 programs

� ecobol — Compiles H & J native COBOL85 programs

� Use man utility to find out information about compilation options

Page 44: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 44

OSS Development Utilities

� ar — File archiver, for example:$ ar tv libc.a

� nm — Displays binary file symbolic information, for example:

$ nm object.o

� strip — Removes the symbolic debugging information and symbol tables from an executable file

� strings — Finds printable strings in files

� lex — Lexical analyzer program generator

� yacc — Parser program generator

� nld & eld — Native link editor

� noft & enoft — Native object file tool

Page 45: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 45

Creating a Guardian Executable in the OSS Environment

� Use -Wsystype=guardian to generate a Guardian object file

� Macros predefined:

� _TANDEM_SOURCE

� _GUARDIAN_TARGET

� Attributes turned on:

� HIGHPIN

� HIGHREQUESTER

� WIDE model only

� Example:$ c89 -Wsystype=guardian -o /G/data/fred/newprog prog.c

$ exit

TACL> run newprog

Page 46: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 46

Debugging a Program

� Run program under control of the Inspect debugger

� Use Inspect (or native inspect) or Visual Inspect debugger

� Source-level process debugging

� Inspect

� $ run -debug program

� Equivalent to RUND or RUNV program from TACL

� eInspect

� gtacl –p einspect

Page 47: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 47

Visual Inspect

� Powerful, easy-to-use visualinterface

� Improved data structure handlingand COBOL support

� Better windows management

� System-level and application-level debugging

� Support for distributed, multiprocess applications

� Improved program navigation

� Support for postmortem debugging

Page 48: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 48

SQL/MX Processes

MXCI

DML Statements

OSS Environment

DP2

Guardian Environment

MXCMP MXRTDSRV

SQL/MXCatalog

DP2

SQL/MXDatabase

NonStop Kernel Environment

Page 49: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 49

Compiling a C/C++ SQL/MX Program (option 1)

SQL/MX C/C++Source File

SQL/MX C/C++Preprocessor

Annotated C/C++Source File

SQL/MX object

C/C++Compiler

SQL/MXCompiler

C/C++object

SQL/MXexecutable

eldLinker

MyProg.sql

mxsqlc

MyProg.c orMyProg.cpp

/usr/bin/c89

MyProg.o

eld

MyProg.exe

mxCompileUserModule

MyProg.exe

Page 50: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 50

Compiling a C/C++ SQL/MX Program (option 2)

SQL/MX C/C++Source File

SQL/MX C/C++Preprocessor

Annotated C/C++Source File

SQL/MX ModuleDefinition File

C/C++Compiler

SQL/MXCompiler

C/C++Executable

SQL/MXModule File

Page 51: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 51

OSS-Hosted SQL/MX C/C++ Preprocessor

� Running the preprocessormxsqlc myProg.sql -c myProg.cpp

-m myProg.m -l myProg.lst

mxsqlc source-file[ -c out-file ][ -m module-definition-file ][ -l list-file ][ -p ][ -t timestamp ][ -d flag [=value] ]

Page 52: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 52

SQL/MX Compiler (1 of 2)

� Installed in $system.system

� Compiler functions are as follows:

� Expands SQL object names by using the current default settings

� Expands any view definitions

� Performs type checking for C/C++, NMCOBOL and SQL data types

� Checks SQL object references to verify their existence

� Determines an optimized execution plan and access path for each DML statement

� Generates executable code for the execution plans and creates anSQL module

� Places the module in the /usr/tandem/sqlmx/USER MODULES subdirectory or embedded in executable file

� Generates a list of the SQL statements in the program file

� Returns a completion code

Page 53: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 53

SQL/MX Compiler (2 of 2)

� Running the SQL/MX compiler for module files

mxcmp -e -v myProg.m

� Running the SQL/MX compiler for embedded modules

mxCompileUserModule -e -v myProg.exe

� Running the SQL/MX compiler from c89

c89 -Wsqlmx -Wmxcmp -o sqlprog.exesqlprog.ec

� Running the SQL/MX compiler from ecobol

ecobol -Wsqlmx -Wmxcmp -o sqlprog.exesqlprog.ecob

Page 54: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 54

$RECEIVE Handling

� Same usage as within Guardian requesters/servers

� For servers:

� Use FILE_OPEN_ to open $RECEIVE

� Use REPLY[x] to return response

� For requesters:

� Use FILE_OPEN_ to open server process by name

� Use WRITEREAD[x] for two-way communication

� Usage:

� Server: $ run -name=/G/<srv-name> <srvobj>

� Requester: $ run <reqobj>

Issue: How can requesters and servers be folded into the Pathway environment?

Page 55: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 55

Pathway Specifics (1 of 2)

� Requester:

� Consider using PATHSEND APIs

� Replace FILE_OPEN_ and WRITEREAD[x] with:

� SERVERCLASS_SEND_

� SERVERCLASS_SEND_INFO_

� Server:

� Can still use REPLY[x]

� Needs PATHWAY configuration update

Page 56: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 56

Pathway Specifics (2 of 2)

� Server configuration needs:set server processtype OSS

set server cwd <OSS-pathname>

set server stdin <fname>

set server stdout <fname>

set server stderr <fname>

set server program <object-pathname>

� These conflict with processtype OSS:set server IN <fname>

set server OUT <fname>

Page 57: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 57

dot1test

� /bin/unsupported/dot1test

� Allows you to call APIs interactively (OSS version of lispproc).

� Example:

/home/software/tome: dot1test

Welcome to dot1test, version 2.25 30NOV96.

*** type "help new" for a list of the latest features & bug fixes in dot1test

proc name <exit>: open

path <"">: /bin/ls

oflag <0x00000002 (O_RDWR)>: O_RDONLY

mode:<enter>

open() succeeded, returned fildes == 3.

proc name <open>:

Page 58: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 58

NonStop + Open Source

Higher productivity through Unix/linux like environment.

200+ Open Source ready to run out of the box on S-series and NonStop Integrity.

Porting time and effort dramatically reduced.

“Runtime” Open Source opening a wide range of applications to run on NonStop without porting efforts.

Page 59: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 59

Download Open Source from:

� Connect: http://www.connect-community.org/

� Internet: Java, Perl, Php or python based Open Source.

ITUG downloads are delivered as file.tar.z

� .z: You can use winzip, gzip or jar.

� .tar: use pax or tar utilities in OSS

Extract the download under / and read: /usr/local/Floss/<package>/README_FLOSS

Your software is ready to use!

� No need to run Configure or make

Getting started.

Page 60: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 60

200+ Open Source on S & NS Series

Vim

nano

Emacs

ed

Editors

Perl

Python

ruby

php

Languages

Openssl

Openssh

sudo

Gnupg

stunnel

Security bash

cscope

wget

findutils

ProductivityX11

Samba

vnc

Gvim

LPRng

GUI apps

dmalloc

cvs

floss

make

Dev tools

Apache

Zope

App servers

Page 61: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 61

Special Interest Group "Open SIG“

� register at http://www.connect-community.org/� Now regroups Java, OSS and Open Source interests.

You can still also use the Tandem Newsgroup:

� news:comp.sys.tandemRemember Open Source is often not supported but you can get help in many various ways (FAQ, Newsgroup, Project page, …).

NED/GMCSC supported Open Source:� NonStop XML Parser = Apache Xerces C++ 2.4.0

� NonStop Fast XML Parser = Expat 1.95.7

� NonStop Soap Client = gSOAP 2.6

� NS/JSP = Apache Tomcat

� LDAP client SDK = Mozilla's Directory SDK 3.0

� XSLT Version 2.0 Stylesheet Processor for C++

Active community

Page 62: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 62

If you want minimum impact on the OSS behavior, place /usr/local/bin at the end of the PATH:export PATH=$PATH:/usr/local/bin

If placing /usr/local/bin at the beginning of the PATH:export PATH=/usr/local/bin:$PATHThen Open Source commands will be used instead of OSS commands (e.g. if you install grep from Floss).

Most Open Source can be installed as a regular user. This makes sure you won’t alter any existing system directory or settings.

Integration into OSS

Page 63: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 63

Open Source man(ual) pages are often delivered in /usr/local/man.

But the OSS man commands also scans other directories by default:

Integration into OSS: Documentation

Default search order:/usr/share/man/manX

/usr/local/man/manX/usr/share/man/catX/usr/local/man/catX

So if you install OpenSource “grep”, man will find the OpenSourcegrep man page first:

� /usr/local/man/man1/grep.1 <-- Open Source grep

� /usr/share/man/cat1/grep.1 <-- OSS grep

Solution: Use MANPATH:ie: to access only OSS commands documentation:

� Permanent: export MANPATH=/usr/share/man

� Temporary: man –M /usr/share/man <man page>

G06.27 search order corrected in the man documentation

� It was incorrectly documented before.

Page 64: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 64

A possible second issue is that OSS man supports only ASCII man pages.

/home/roland [2145]: man grep

Nroff/troff is not currently installed, this must be

installed in order to use formatted man pages.

To support those formats you can:

� Install the OpenSource utility nroff and create a symbolic link /bin/nroff to point to /usr/local/bin/nroff:ln -s /usr/local/bin/nroff /bin/nroff

� Install OpenSource man:Package Man_db(requires: Grep, Groff, Gzip, Less, Sed, Textutils.)

Integration into OSS: Documentation

Page 65: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 65

Samba: Connecting from start/Run

Page 66: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 66

Vim - Vi Improved, an Enhanced vi Editor

Vim is a nearly fully-compatible version of the vi editor.

Features include multi-level undo, syntax highlighting, command line history, online help, filename completion, and block operations.

Vim is a major enhancement to the vi editor.

The following screen demonstrates use of the syntax-aware feature of Vim.

Note the use of color to differentiate the various syntactical elements of a C program.

Page 67: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 67

Vim - Vi Improved, an Enhanced vi Editor (cont’d)

Page 68: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 68Future product plans, dates, and functionality are subject to change without notice

NonStop support for best-in-class frameworks

SASH : MyFaces, Axis2, Spring, HibernateSASH : MyFaces, Axis2, Spring, Hibernate

Apache MyFacesComponent based web UI framework

Apache Axis2Web services framework

SpringFramework for developing apps using POJO components

HibernateObject Relational Mapping framework

Page 69: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 69Future product plans, dates, and functionality are subject to change without notice

Where do SASH frameworks fit?Mapping SASH to requirements for enterprise Java apps

NonStopSQL/MX

Scalable and available

SASH execution container

Presentation

Web Services

Business logic

NSJSP (Tomcat)

NonStop TS/MP

NonStop OS

Persistence Services

Page 70: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 70

End-to-end scalability and availability

Transparent Scalability

Fault Tolerance

����

����

����

����

����

����

����

����

Page 71: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 71

OSS Manuals

•Open System Services Installation Guide

•Open System Services Library Calls Reference Manual

•Open System Services Management and Operations Guide

•Open System Services Porting Guide

•Open System Services Programmer’s Guide

•Open System Services Shell and Utilities Reference Manual

•Open System Services System Calls Reference Manual

•Open System Services User’s Guide

http://docs.hp.com/

Page 72: Tandem OSS Training Jan 2810

© 2002 hp (524907-001) 72