Sort Utility that uses Copybook field names

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
neomaxi
Member
Posts: 6
Joined: Tue Jul 07, 2015 6:32 pm

Sort Utility that uses Copybook field names

Post by neomaxi » Thu Apr 06, 2017 2:12 am

Not sure if anyone would find the useful,
But I created a menu based proc that does commonly used sort functions by Copybook field names as opposed to specificing the field length and positions of each record.

I work with these files a lot, and when layouts change, its a pain to have to change the record positions and lengths all the time... also, its easier to use since the proc will figure out the postions and lengths for you.


You just set the fieldname you want to the do the sort function on, and the flag setting for which sort function you want to use based on menu I provided below the proc name.

If there is a lot of interenst I can share the proc code.


Code: Select all

//**********************************************************************
//* SORT UTILITY BASED ON COPYBOOK FIELD NAME AND FLAG SETTING          
//* SET INPUT AND OUTPUT DATASET NAMES BELOW                            
//**********************************************************************
//*                                                                     
// INCLUDE MEMBER=CV#SRTCC ; CONTROL CARDS FOR DEFAULT SET STATEMENTS   
// SET CBLIB=TEST          ; CPYBOOK LIB LOCATION(TEST,PROD) 
//*                                                                     
// SET FILEIN=TEST.INPUT.FILE                      
// SET OUTPUT=TEST.OUTPUT.FILE                
//* BELOW DATASET IS ONLY POPULATED IF FLAG 09 OR 10 ARE USED (DUPS)    
// SET OUTDUP=TEST.OUTPUT.DUPS                
//*                                                                     
//**********************************************************************
//* SET FIELD NAME, COPYBOOK AND FLAG SETTING BELOW                     
//**********************************************************************
// SET FIELDNM=COPYBK1-FIELD1                                           
// SET CPYBOOK=COPYBK1    ; CPYBOOK= TEST.COPY(COPYBK1)         
//*                                                                     
//* TEST.CNTRLCDS(#SORTFLG) ; SEE HERE FOR FLAG SETTINGS        
//*                                                                     
// SET FLAG=00 ; SET FLAG ACCORDING TO OPTIONS ABOVE                    
//*                                                                     
//SRT01F00   EXEC PROC=CV#SRTV1                                         


***************************** Top of Data ******************************
             00 = SORT FIELD (ASCENDING ORDER)                          
             01 = SORT FIELD (DECENDING ORDER)                          
             02 = ADD LEADING ZEROES                                    
             03 = REMOVE LEADING ZEROS (LEFT JUSTIFY)                   
             04 = LEFT JUSTIFY                                          
             05 = RIGHT JUSTIFY                                         
             06 = LOWER TO UPPER CASE                                   
             07 = UPPER TO LOWER CASE                                   
             08 = REMOVE LOW VALUES FROM FILE (FIELDNM CAN BE DUMMY)    
             09 = SORT OFF DUPLICATES KEEP 1                            
             10 = SORT OFF ALL DUPLICATES                               
             XX = UNPACK (FUTURE NOT USED YET)                          
             XX = PACK   (FUTURE NOT USED YET)                          
[/code]

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others