- Why is the XSM program named hxsm ?
In order to avoid confusion with UNIX X11 Session Manager "xsm
"

- Common software activation troubles
XSM software is activated using an activation key obtained on XSM Extranet from a Serial Number.
When you download/copy XSM on a new platform, XSM displays its Serial Number using following commands:
./hhnsinst[VER] ./hxsm[VER]
( VER=version example: hhnsinst656 hxsm656)
./hxsm[VER]
Example:
[root@srv1 tmp]# ./hhnsinst656 hxsm656
Program 'hxsm656' successfully installed
[root@srv1 tmp]# ./hxsm656
Thanks for testing the 'HHNS Sort/Merge Program MultiPRO - V.6' Program
If you wish to register for the 'HHNS Sort/Merge Program MultiPRO - V.6' Product on THIS machine,
just contact HHNS with the following registration (serial number) key:
0013-3432-1505-M
For further informations : http://www.hhns.fr, email:support@hhns.fr
Please press Enter to continue...
You must then generate an activation key for this platform on the Extranet.
(a platform = hostname + Operating System + Serial Number).
Then activate XSM with the activation key you get, using following command:
./hhnsinst[VER] ./hxsm[VER] cle_d_activation
( VER=version example: hhnsinst656 hxsm656)
Example:
[root@srv1 tmp]# ./hhnsinst656 hxsm656 1234-5678-9012-A
Program 'hxsm656' successfully installed
XSM is now ready. When you start it with no parameter, it displays its usage documentation.
Common troubles:
- When you run
hhnsinst
command, you don't give the proper pathname of XSM program ;
for instance, your current working directory is not the one containing XSM, or
you have mistyped XSM program name
- You have more than one XSM installed in your PATH ; when your run XSM, it is a non-activated
version that runs because it has priority in the PATH
- [UNIX] You don't have R/W rights on hxsm program. In this case, install program
hhnsinst
stops an error.
- On some UNIX/Linux, you must be superuser "root" to activate the software.
- Extranet refuses to generate a new key because the Serial Number is already in database:
Check a platform with same Serial number is not already declared on your account:
if yes, just proceed to "Reconduct key" to renew the activation key (30-days).
if not, please contact us.
- Extranet refuses to generate a new key because you have already generated 3 actiation keys:
Contact us.

- Software Activation with LPAR AIX, POWER6 Live Partition Mobility
Up to version 6.79, XSM Serial Number is based on software and hardware details.
Thus when an XSM binary is activated on a LPAR system, it is NOT possible to move LPAR to another
hardware p/System without re-activating XSM (it will display a new Serial Number).
From version 6.80, XSM Serial Number is no longer based on hardware.
Once activated on a LPAR system, XSM will continue running when LPAR is moved to another hardware.

- How to display software expiration date for an activated XSM binary ?
$ hhnsinstxxx -q [pathname/]hxsmxxx
example:
$ hhnsinst680 -q /usr/local/bin/hxsm680
0024-1095-6502-U D=18092012
! !
! +- expiration : September 18, 2012
+-Serial Number
Beware:
- do not mix a 64-bits hhnsinst with a 32-bits XSM and vice-versa.
- specify the correct pathname to XSM binary if it is not on current directory.

- Inside a script, how to pass file names as variables ?
a) using a parmfile (parameter file), using SORTIN and SORTOUT environment variables
associated to INPFIL and OUTFIL orders:
myparm.xsm contains:
SORT FIELDS=(14,7,B,A)
RECORD RECFM=V,LRECL=200
INPFIL DD:SORTIN
OUTFIL DD:SORTOUT
Script sets SORTIN and SORTOUT values before running XSM:
export SORTIN=/a/b/c/myinputfile
export SORTOUT=/d/e/f/myoutputfile
# Windows: set SORTIN=/a/b/c/myinputfile
# Windows: set SORTOUT=/d/e/f/myoutputfile
hxsm myparm.xsm
b) using command line mode,
A=/a/b/c/myinputfile
B=/d/e/f/myoutputfile
# Windows: set A=/a/b/c/myinputfile
# Windows: set B=/d/e/f/myoutputfile
# old syntax:
hxsm -rF -l180 -k14,10,A,C -o$B $A
# Windows: hxsm -rF -l180 -k14,10,A,C -o%B% %A%
# new syntax:
hxsm --recfm=F --lrecl=180 --key=14,10,A,C --infile=$A --outfile=$B
# Windows: hxsm --recfm=F --lrecl=180 --key=14,10,A,C --infile=%A% --outfile=%B%
# You can use as well UNIX stdin stdout redirections:
hxsm --recfm=F --lrecl=180 --key=14,10,A,C < $A > $B
# Windows: hxsm --recfm=F --lrecl=180 --key=14,10,A,C < %A% > %B%
Nota Bene: XSM gives better performances if you specify input file name, as it can dynamically
work out the optimal STORAGE parameter from input file size.
Using a parmfile, you can use DD:SORTIN
only if there is a single input file.
Otherwise, you must give static file names:
SORT FIELDS=(14,7,B,A)
RECORD RECFM=V,LRECL=200
INPFIL /a/b/c/myinputfile1
INPFIL /a/b/c/myinputfile2
INPFIL /a/b/c/myinputfile3

- Inside a script, how to pass sort parameters as variables ?
a) using command mode, we assume the script has already built the necessary variables
RECFM=...
LRECL=...
KEYS=...
hxsm --recfm=$RECFM --lrecl=$LRECL --key=$KEYS --infile=$A --outfile=$B
b) dynamically building a temporary parmfile before running XSM
# create temp parmfile
echo "
**** temp parmfile /tmp/myparm.$$ ****
SORT FIELDS=($start1,$len1,C,A,$start2,$len2,C,A)
RECORD RECFM=$recfm,LRECL=$lrecl
INPFIL $A
OUTFIL $B
" > /tmp/myparm.$$
# run XSM
hxsm /tmp/myparm.$$
# suppress temp file if RC=0
if [ $? -eq 0 ] ; then rm /tmp/myparm.$$ ; fi
Nota: method b) is recommanded to ease tests and maintenance.

- Can I combine command line options and parmfile ?
You can use following options in command line, together with a parmfile:
-q, --quiet
: quiet
-v, --verbose
: verbose
-c, --check
: don't sort, just checks that a previous result is correctly sorted
Other options that define input/output file names, sort keys, sort options, temporary files (sortworks)
can be used in command line as long as they are not in parmfile.
Nota bene: parmfile must be the last command line parameter
Examples:
parmfile contains only sort keys and file format definition ;
filenames are defined on command line:
parmfile:
SORT FIELDS=(10,8,,C,A)
RECORD RECFM=F,LRECL=100
command line:
hxsm -v myparm.xsm < /a/b/c/myinputfile > /d/e/f/myoutputfile
parmfile contains sort keys, file format, input file name ;
output file name is defined on command line:
parmfile:
SORT FIELDS=(10,8,,C,A)
RECORD RECFM=F,LRECL=100
INPFIL /a/b/c/myinputfile
command line:
hxsm -v -o /d/e/f/myoutputfile myparm.xsm
This example does not work: output filename is specified both in parmfile and command line!
parmfile:
SORT FIELDS=(10,8,,C,A)
RECORD RECFM=F,LRECL=100
INPFIL /a/b/c/myinputfile
OUTFIL /d/e/f/myoutputfile
command line:
hxsm -v -o /d/e/f/myoutputfile myparm.xsm

- Can I combine FILE=n and static output file names in a parmfile ?
No: in a parmfile, output file names are specified using
OUTFIL file_name
or OUTFIL FILE=n
orders, but you cannot combine both forms in a same parmfile.
OUTFIL FILE=n
orders specify file names that have been set by SORTOFn
environment variables.
Example:
parmfile:
SORT FIELDS=(3,3,CH,A,51,11,CH,A)
RECORD RECFM=F,LRECL=402
INPFIL /tmp/worldclients.inp
OUTFIL /tmp/clients.fr,INCLUDE=(19,3,CH,EQ,C'.fr')
OUTFIL /tmp/clients.uk,INCLUDE=(19,3,CH,EQ,C'.uk')
OUTFIL /tmp/clients.de,INCLUDE=(19,3,CH,EQ,C'.de')
command line:
hxsm -v myparm.xsm
equivalent to
parmfile:
SORT FIELDS=(3,3,CH,A,51,11,CH,A)
RECORD RECFM=F,LRECL=402
INPFIL /tmp/worldclients.inp
OUTFIL FILE=1,INCLUDE=(19,3,CH,EQ,C'.fr')
# don't forget to set SORTOF1 environment variable
OUTFIL FILE=2,INCLUDE=(19,3,CH,EQ,C'.uk')
# don't forget to set SORTOF2 environment variable
OUTFIL FILE=3,INCLUDE=(19,3,CH,EQ,C'.de')
# don't forget to set SORTOF3 environment variable
command line:
SORTOF1=/tmp/clients.fr
SORTOF2=/tmp/clients.uk
SORTOF3=/tmp/clients.de
hxsm -v myparm.xsm

- How many maximum files can I process with FILE=n, SORTOFn ?
99 files.
Nota #1: first SORTOFn variable must be SORTOF1
Nota #2: variables order must be consecutive:
Correct:
SORTOF1=/tmp/clients.fr
SORTOF2=/tmp/clients.uk
SORTOF3=/tmp/clients.de
hxsm -v myparm.xsm
Incorrect:
SORTOF1=/tmp/clients.fr
SORTOF2=/tmp/clients.uk
SORTOF4=/tmp/clients.de
hxsm -v myparm.xsm
Nota #3: If this is not enought, please report it and we will make it higher.

- When should I use KEEP_ORDER option ?
Please check Desctructive vs non-destructive sorts

- In a parmfile, my FIELDS, INCLUDE, EXCLUDE are long lines, can I write them on separate lines ?
Yes: You can continue an instruction on next lines as long as it ends with a comma.
Example:
SORT FIELDS=(011,003,CH,A,
001,010,CH,A,
015,114,CH,A,
014,001,CH,A)
RECORD RECFM=V,LRECL=263
EXCLUDE COND=(030,002,CH,EQ,C'L1',AND,
032,001,CH,EQ,C'1',
OR,
030,002,CH,EQ,C'L2',AND,
032,001,CH,EQ,C'2')
INPFIL DD:SORTIN
OUTFIL DD:SORTOUT
Nota: In the COND=
expression, boolean operator 'AND' has priority on 'OR' operator.
You can add parenthesis for better readability:
EXCLUDE COND=((030,002,CH,EQ,C'L1',AND,
032,001,CH,EQ,C'1'),
OR,
(030,002,CH,EQ,C'L2',AND,
032,001,CH,EQ,C'2'))

- When input file is empty, XSM stops on XSM083E error. Is there a workaround ?