Here describe the micro focus utility 'mfsort' usage, and give some samples:
Command Options
Usage: mfsort . . . TAKE [CHAR-EBCDIC|SIGN-EBCDIC] SORT|MERGE FIELDS (start,length,type,A|D,...)|COPY RECORD F|V,min,max USE filename ORG LS|SQ|RL|IX RECORD F|V|FCxxx|FVxxx,min,max [KEY (start,length,P|A|AD|C,...)] GIVE (with parameters as for USE) INCLUDE|OMIT COND=(condition) [FORMAT=type] INREC FIELDS=(field-specifier...) OUTREC FIELDS=(field-specifier...) MODS {exit-name=(exit-routine)}... SUM FIELDS=(sum-field-specifier)|NONE [FORMAT=type] OUTFIL GIVE STARTREC start-record ENDREC end-record INCLUDE|OMIT SAVE SPLIT OUTREC LINES/HEADER1/TRAILER1/HEADER2/TRAILER2/SECTIONS/NODETAIL
Detail Options
There are 2 types of command line syntax:
- mfsort instructions
- mfsort take instruction_file
Option 1, instructions are placed in command line directly.
Option 2: instructions are placed in a file, and use 'take' option set the file.
Notice: lines start with a star('*') in instruction_file are comment lines.
Instruction SORT/MERGE
SORT/MERGE is the key instruction; SORT and MERGE are mutually exclusive.
Syntax:
SORT/MERGE FIELDS=(field_instruction,…)
field_instruction ::=
(<start>,<length>,{<type>},<A|D>,...){,FORMAT=<type>}
Instructions |
Description |
SORT FIELDS=(1,2,NU,D) |
sort field start from 1, and length is 2 |
SORT FIELDS=(1,2,NU,D,5,2,CH,A) |
sort 2 fields |
SORT FIELDS=(1,2,D),FORMAT=NU |
use FORMAT instruction to define format |
MERGE FIELDS=COPY |
COPY |
There are common used data types:
Data type |
COBOL data type |
CH |
PIC X USAGE DISPLAY |
NU |
PIC 9 USAGE DISPLAY |
PD |
PIC S9 COMP-3 |
BI |
USAGE COMP |
Instruction USE
The USE Statement declares the input files, as well as record type, and record length, and the overall organization of the file.
Syntax:
USE <filename> ORG <LS|SQ|RL|IX> RECORD <F|V>,min,max [KEY …,]
Instruction GIVE
The GIVE Statement declares the output files, as well as record type, and record length, and the overall organization of the file.
More than one GIVE instruction can be used when we need to output multiply output files, for example:
GIVE DATA.SORTOUT1
GIVE DATA.SORTOUT2 ORG LS
GIVE DATA.SORTOUT3 ORG SQ
GIVE DATA.SORTOUT4 ORG SQ RECORD F,80