ZSORT Sort Utility
The z390 ZSORT internal sort facility is an open source J2SE java component of z390 which supports sorting of any number of fixed or variable length records of any size up to the limits of memory and 64 bit file system.
ZSORT is implemented via SVC x'A1' which has 3 function calls: one to initialize internal sort request, one to submit unsorted record, and one to retrieve sorted records. Unsorted records are loaded into dynamically allocated table in memory and sorted. If the unsorted records exceed size of table, then multiple blocks of sorted records are written to a work file and then merged. If all the records fit in table, then they are sorted and returned without requiring use of sort work files. When required, the merging is performed using two dynamically allocated sort work files with DDNAME's SORTWK01 and SORTWK02. The sorted strings are merged from one work file to another doubling the size of the sorted strings on each pass until all the records are sorted on last merge pass. All file I/O is blocked to minimize disk seeking on single disk systems. User can define location of SORTWK01 and SORTWK02 if multiple physical disk drives are desired.
A set of regression tests are executed via rt\RTSORT.BAT including test of all 7 sort key types. The utilities sort\TESTSRT3.MLC and TESTSRT4.MLC can be used to generate, sort, and verify any number of records. A million records can be sorted in 28 seconds. Statistics on each sort execution are recorded on the statistics file if option STATS is specified.
The initial sort method used to sort table is a shell sort. All comments, suggestions, and contributions for improving this open source J2SE java sort utility are welcome. You can join the discussion on firstname.lastname@example.org or send private email to email@example.com.
The ZSORT utility function can be called from z390 assembler using standard call interface with full work parameters in list pointed to by register 1. The first positional macro parameter contains the operation code and options: The operations include:
The following key work macro parameters are required for ISORT operations are:
The PUT and GET operations only require the keyword REC= defining address of record area.
Here is an example of internal sort interface:
Here is example of REPRO
utility used to create alternate index (Still in
development as of v1.5.01c)
Run REPRO with INFILE set to VSAM cluster data file and OUTFILE set to name of alternate index in catalog:
Here is example of zcobol internal
See zcobol\demo\DEMOSRT1.CBL for COBOL file sort.
See zcobol\demo\DEMOSRT2.CBL for COBOL internal sort using input/output procedure paragraphs.
ZSORT SORT Utility (Available in v1.5.01c)
The open source z390 SORT utility program in linklib\SORT.MLC is designed to be compatible with DFSORT and SYNCSORT. SORT currently supports fixed and variable length files with ascending or descending single binary keys. The input and output files are defined via SORTIN and SORTOUT DDNAME's. Work files if required may be defined using SORTWK01 and SORTWK02 DDNAME's. The input control record is defined using SYSIN DDNAME. For example:
The SYSIN file must be ASCII line sequential file format containing SORT command defining any number of sort key fields as follows:
SORT FIELDS=(offset,length,type,A/D,,,,) See SORT FIELD= definition above for options.
Use the STATS option to output statistics on sort performance on the STA statistics file. For example, here is output from one of the regression tests in rt\RTSORT.BAT:
10:20:53 SORT EZ390 ZSORT ID=1 started=10:20:50
Note in the above example, the optional parm PARM(1000) was passed to the SORT utility to force the maximum memory table size to 1000 records which in turn forced the sort to perform 7 merge passes to complete the sort of 100,000 reecords in 3 seconds.
Additional functionality will be added to this z390 SORT utility program and to the ZSORT function based on future user requests.
IBM, CICS, HLASM, MVS, OS/390, VSAM,
z9, z10, and z/OS are registered trademarks
of International Business Machines Corporation
This page last updated
Wednesday May 23, 2012.
Copyright 2011 Automated Software Tools Corporation