Question: How do we do a sort in a custom emPath command file ( .CMD )
Response: Following is an excerpt from article 50018 which provides several command procedure examples.
Execute MicroFocus sort:
The following example shows the execute from a command procedure which uses MicroFocus sort.
# statement 01 @echo *** Step 080 Sort 401k and Loan payment 02 (set sortresult=%hrdatdir%\fsav_extract_401k.dat) 03 (if exist %sortresult% del %sortresult%) 04 (�tadrive%:) 05 (cd %hrdatdir%) 06 (mfsort take %cmn_srt%\fsav_srt_spec1.txt) |
Statement 06 executes MFSORT and references the file fsav_srt_spec1.txt. This file contains the sort statements. They are shown below:
# statement 07 use fsav_extract_401k_from_cdh.dat org ls record f,90 08 use fsav_extract_loan_payment.dat org ls record f,90 09 use fsav_extract_place_record.dat org ls record f,90 10 give fsav_extract_401k.dat org ls record f,90 11 sort fields (6,2,ch,a,13,11,ch,a) |
NetExpress help will explain how to use MFSORT. Documentation can be found as follows:
- Open MicroFocus Cobol
- Select help > help topics
- click on the index tab
- enter mfsort
You should find help for command lines, error messages, examples, field instructions, input and output files, key instructions, and record instructions.