DFSORT SUM Handling overflow - NOVLSHRT

DFSORT SUM: Handling overflow - VLSHRT DFSORT Reformatting with fixed fields

Advertisements


When a sum value becomes larger than the space/size available for it, overflow occurs.

The summary fields in the two records involved are not added together if overflow occurs.

The records are kept unchanged; neither record is deleted if overflow occurs.


Syntax:

OPTION NOVLSHRT
SORT FIELDS=sort_options
SUM FIELDS=sort_options

NOVLSHRT communicates DFSORT to fail the job if overflow happened.

By Default, NOVLSHRT is in effect.

If NOVLSHRT is in effect or not specified, DFSORT terminates if it finds a short summary field in any VB record.

Example:


From the below data, sum the marks at department level.


Input:- MTH.SORT.INPUT02

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
00001     student1            dept1          095                                 
00003     student3            dept2          070                                 
00004     student4            dept1          090                                 
00005     student5            dept2          083                                 
00002     student2            dept3          088                                 
******************************** Bottom of Data ********************************

Input Record Layout:

01 INPUT-REC.
	05 STD-ID			PIC X(05).
	05 FILLER			PIC X(05).
	05 STD-NAME			PIC X(15).
	05 FILLER			PIC X(05).
	05 STD-DEPT			PIC X(10).
	05 FILLER			PIC X(05).
	05 STD-MARKS		PIC 9(03).
	05 FILLER			PIC X(32).

Job:

000100 //Jobcard
000400 //*                                                                     
000003 //*                                                                     
000004 //**********************************************************************
000005 //*                                                                     
000006 //* SORT SUM WITH OVERFLOW STATEMENT                                    
000007 //*                                                                     
000008 //**********************************************************************
000009 //STEP01   EXEC PGM=SORT                                                
000010 //SORTIN   DD DSN=MTH.SORT.INPUT02,DISP=SHR                    
000011 //SORTOUT  DD SYSOUT=*                                                  
000012 //SYSOUT   DD SYSOUT=*                                                  
000013 //SYSIN    DD *                                                         
000014      OPTION NOVLSHRT                                                      
000015      SORT FIELDS=(30,10,CH,A)                                           
000016      SUM  FIELDS=(45,03,ZD)                                             
000017 /*                                                                      
****** **************************** Bottom of Data ****************************

Output:

DFSORT terminates the job because of the overflow

Explaining Solution:

  1. The summing of the marks at department level was not happened because there is an overflow if 560 and 540 added.

  2. The total exceeds 999 which is the maximum value in 3 bytes. So the DFSROT terminates the job.

DFSORT SUM: Handling overflow - VLSHRT DFSORT Reformatting with fixed fields

Advertisements