Skip to main content

Problem:

Using MFSORT utility but it may also has a requirement to define collation sequence in some cases.

For example: sort input file  a.inp  on position1, size 10 , output file is a.out

Command for this using MFSORT  is:

mfsort sort fields(1,10,ch,a)

   use a.inp

   give a.out

So the question is how to define Collation Sequence using MFSORT?

By definition MFSORT supports DFSORT syntax, but what about about alternate collating sequence (ALTSEQ Control Statement). How does this work on WINDOWS, and how to use it with different code pages?

Resolution:

In this example to presume the codepage in question is 1250.

ALTSEQ function can be used in MFSORT by using the same command as in DFSORT.

The attached demo - demo.zip contains a file to sort where we want to sort the file as

if an 'A' has the same value as an 'a' and a 'B' as a 'b'. By sorting with 'SORT

FIELDS=(1,10,AQ,A)' rather than 'SORT FIELDS=(1,10,CH,A)' it tells SORT to use the

Alternate Collating Sequence.

Next to define the alternate collating sequence by adding the line 'ALTSEQ CODE=(fftt,fftt). ff specifies in hexadecimal the character whose position is to be changed in the ALTSEQ table and tt specifies it's new position.

There can be multiples of these specified separated by a comma. In this example this

line would look like 'ALTSEQ CODE=(4161,4262)'.

Attachments:

demo.zip

Old KB# 1340

#RMCOBOL
#netexpress
#ServerExpress
#COBOL
#AcuCobol