Categories: JCLMainframe

PARM: How to use in SORT JCL with examples

DYNALLOC PARM: This option requests the dynamic allocation of SORTWK data sets. DYNALLOC=OFF can be specified to override a DYNALLOC=ON installation default. If DYNALLOC has been specified on the SORT control statement as well as in the PARM field, the PARM specification will take precedence.

ZDPRINT PARM: This option applies to the SUM, DUPKEYS SUM, and DUPKEYS AVG features. ZDPRINT specifies if positive ZD summed or averaged results are to be converted to printable numbers. ZDPRINT, the default, enables conversion to printable format. NZDPRINT prevents the conversion.

Example:
 //STEP1    EXEC PGM=SORT              
 //SYSOUT   DD SYSOUT=*                
 //SORTIN   DD DSN=INPUT.FILE1,DISP=SHR
 //         DD DSN=INPUT.FILE2,DISP=SHR
 //SORTOUT  DD DSN=&&OUTPUT,DISP=(,PASS),UNIT=3390,              
 //   SPACE=(CYL,(5,1)),DCB=(LRECL=22)                           
 //SYSIN    DD *                                                 
   OMIT COND=(5,1,CH,EQ,C'M')                                    
   SORT FIELDS=(20,8,CH,A,10,3,FI,D)                             
   SUM FIELDS=(16,4,ZD)                                          
   OPTION DYNALLOC,ZDPRINT                                       
   OUTREC FIELDS=(10,3,20,8,16,4,2Z,5,1,C' SUM')                 
 //*

Explanation

OMIT statement. COND specifies that input records with a character M in position 5 are to be omitted from the output data set.

SORT statement. FIELDS specifies an ascending 8-byte character control field starting at position 20 and a descending 3-byte fixed-point control field starting at position 10.

SUM statement. FIELDS specifies a 4-byte zoned-decimal summary field starting at position 16. Whenever two records with the same control fields (specified in the SORT statement) are found, their summary fields (specified in the SUM statement) are to be added and placed in one of the records, and the other record is to be deleted.

OPTION statement. DYNALLOC specifies that work data sets are to be dynamically allocated using the installation defaults for the type of device and number of devices. ZDPRINT specifies that positive ZD SUM fields are to be printable.

OUTREC statement. FIELDS specifies how the records are to be reformatted for output. The reformatted records are 22 bytes long and look as follows:

Position Content

1-3           Input positions 10 through 12

4-11         Input positions 20 through 27

12-15       Input positions 16 through 19

16-17       Zeros

18            Input position 5

19-22      The character string ‘ SUM’

EQUALS/ NOEQUALS PARM:

EQUALS: specifies that the original sequence must be preserved.

NOEQUALS: specifies that the original sequence need not be preserved.

For sort applications, the sequence of the output records depends upon the order of:

  • The records from the SORTIN file
  • The records inserted by an E15 user exit routine
  • The E15 records inserted within input from SORTIN.

For merge applications, the sequence of the output records depends upon the order of:

  • The records from a SORTINnn file. Records that collate identically are output in the order of their file increments. For example, records from SORTIN01 are output before any records that collate identically from SORTIN02.
  • The records from an E32 user exit routine for the same file increment number. Records that collate identically from E32 are output in the order of their file increments. For example, records from the file with increment 0 are output before any records that collate identically from the file with increment 4.
//EXEC PGM=SYNCSORT,PARM='EQUALS' 
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=INPUT.FILE1,DISP=SHR
// DD DSN=INPUT.FILE2,DISP=SHR
//SORTOUT DD DSN=OUTPUT.FILE,
// UNIT=3490,VOL=SER=246809,
// DISP=(NEW,KEEP)
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,20) 7
//SYSIN DD * 8
SORT FIELDS=(1,9,ZD,A,10,2,BI,A) 9
SUM FIELDS=(12,4,PD) 10
/*

Explanation

  • The SORT control statement specifies that two control fields will be sorted on. The major control field begins on byte 1 of the record, is 9 bytes long, contains zoned decimal data, and is to be sorted in ascending numerical order. The second, less significant, control field is found in the next two bytes of the record (bytes 10 and 11), is in (unsigned) binary format, and is to be sorted in ascending order.
  • Whenever two records have equal control fields, the sort will attempt to sum them. If the result of summing the packed decimal data found in the 4-byte field beginning at byte 12 can be contained in four bytes, one of the two records will be retained, the sum stored in bytes 12-15, and the other record will be deleted. The EQUALS PARM guarantees that the first of the two records will be preserved; thus, if a record from the INPUT.FILE1 file has the same key as one from the INPUT.FILE2 file, it is the master record which is retained in the output file, containing their sum

VLTEST PARM: It allows you to do the following when variable-length records are processed:

  • Choose the type of record length validity testing to be performed.
  • Choose whether to verify the correct sequence of segments in variable-length spanned records.

A primary use of VLTEST instructs the sort/merge in the handling of “short” variable length records, i.e., records not long enough to contain all of the control fields specified in the SORT/MERGE control statement. The delivered default for VLTEST is 1.

0* No record length validity testing of variable-length records.

1 If any input record does not contain all SORT/MERGE control fields, terminate. This is the default.

2* If any input record is longer than the maximum LRECL or l2 value, terminate.

3 If either or both of the conditions in tests 1 and 2 are satisfied, terminate.

4* If any input record is longer than the output LRECL or l3 value, terminate.

5 If either or both of the conditions in test 1 or 4 are satisfied, terminate.

6* If any input record is longer than the maximum input LRECL or l2 value, or longer than the output LRECL or both, terminate.

7 If any of the conditions in test 1, 2, or 4 are satisfied, terminate.

//STEP EXEC PGM=SORT,PARM=’VLTEST=1′

VLTESTI PARM: It specifies how to process variable-length records that do not contain all specified INCLUDE or OMIT fields. VLTESTI applies to the INCLUDE and OMIT control statements as well as OUTFIL and JOINKEYS INCLUDE/OMIT processing. It does not apply to the WHEN and KEYBEGIN sub parameters of the IFTHEN parameter of the INREC, OUTREC, and OUTFIL control statements. It also does not apply to the TRLID Sub parameter of the IFTRAIL parameter of the OUTFIL control statement.

The delivered default of 0 instructs MFX to terminate if a record does not completely contain all INCLUDE or OMIT fields. A WER250A critical error message is generated to indicate this condition.

When VLTESTI=1 is specified, a record that does not completely contain all INCLUDE/OMIT fields is treated as having failed the comparison. MFX will omit the record if INCLUDE is being used or include the record if OMIT has been specified.

When VLTESTI=2 is specified, MFX will treat comparisons to fields not completely contained within the record as false and decide a record’s status for inclusion or omission from fields that are available. If all fields are not present, the record will be processed as having failed the comparison. MFX will omit the record if INCLUDE is being used or include the record if OMIT has been specified.

//STEP EXEC PGM=SORT,PARM='VLTESTI=1'

VSAMEMT PARM:

Temporarily overrides the VSAMEMT installation option, which specifies whether DFSORT should accept an empty VSAM input data set.

VSAMEMT – specifies that DFSORT accepts an empty VSAM input data set and processes it as having zero records.

NVSAMEMT – specifies that DFSORT terminates if an empty VSAM input data set is found.

Note: VSAMEMT=YES can be used instead of VSAMEMT. VSAMEMT=NO can be used instead of NVSAMEMT.

//STEP EXEC PGM=SORT,PARM='VSAMEMT=YES'
PARM Description
DYNALLOC Requests the dynamic allocation of work data sets.
ZDPRINT/ NZDPRINT Specifies whether positive summed or averaged ZD fields will be converted to a printable format
EQUALS/ NOEQUALS EQUALS acts to preserve the order of equal-keyed records. It is not available with PARASORT.
VLTEST=(n/ 1 , ON /OFF /OFF4) Indicates the type of validity testing to be done when processing variable-length records.
VLTESTI=n/ 0 Indicates action to be taken when a variable-length record does not contain all fields referenced by INCLUDE or OMIT processing.
VSAMEMT= NO /YES Specifies the processing of empty VSAM data sets provided as input to a sort, merge, or copy.

Read JCL blogs : Click Here
SYNCSORT Manual :
Click Here

Admin

Share
Published by
Admin

Recent Posts

Increase Transparency and Collaboration Product Backlog

A well-maintained product backlog is crucial for successful product development. It serves as a single…

3 weeks ago

Product Backlog – Incremental value to the customer

Incremental value to the customer refers to the gradual delivery of small, functional parts of…

4 weeks ago

Product Market, Customer’s Desire, Need, and Challenges

A Product Market refers to the group of potential customers who might be interested in…

4 weeks ago

PAL-EBM Professional Agile Leadership – EBM Certification

The Professional Agile Leadership - Evidence-Based Management (PAL-EBM) certification offered by Scrum.org is designed for…

4 months ago

PAL I Professional Agile Leadership Certification

The Professional Agile Leadership (PAL I) certification, offered by Scrum.org, is designed to equip leaders…

4 months ago

Scrum Master Certification: CSM, PSM, SSM

Choosing the right Scrum Master Certification depends on your current experience and career goals. If…

6 months ago