[USflag] The American Programmer [USflag]


Home
Books on Mainframe Programming
Mainframe Manuals and Tutorials
System Abend codes, Sqlcodes, VSAM/QSAM codes
Everything about the IBM AS/400 Midrange Computer
Everything about CICS
Everything about COBOL
Everything about DB2 and SQL
Everything about IMS
Everything about Java and JavaScript
Everything about JCL and JES
  Just Enough JCL. A bare-bones introduction
  Examples of JCL
  Examples of Idcams JCL
  Examples of JCL to run SYNCSORT
  Example of JCL to run ISPF in batch
  Example of JCL to run SQL in batch
  Example of JCL to run REXX in batch
  Books on JCL
  JCL Manuals
Everything about REXX
Everything about zOS, VSAM, Tivoli, Assembler
Everything about TSO, ISPF, Spufi
Site Map and Site Search

           Home   > JCL   > SYNCSORT Examples

SYNCSORT program examples

Examples of some of the things that you can do with Syncsort (PGM=SORT)
//SORT01  EXEC PGM=SYNCSORT                                 
//SYSOUT  DD   SYSOUT=*                                     
//SORTIN  DD   DSN=userid.TEST.INPUT.DATA,DISP=SHR          
//SORTOUT DD   SYSOUT=*                                     
//SYSIN   DD   *                                            
* EXAMPLE 1                                                 
* SORTING ON 1 FIELD. SHOWS OPTIONAL PARAMETERS             
 SORT FIELDS=(01,06,CH,A),                                  
      FILSZ=E1000,SKIPREC=3,STOPAFT=10,                     
      DYNALLOC=(3390,6)                                     
                                                            
                                                            
                                                            
                                                            
                                                            
                                                              
                                                              
                                                              
* EXAMPLE 2                                                   
* SORT. SUMMING. INCLUDING ON A CONDITION. BUILDING OUTPUT REC
 SORT FIELDS=(01,07,CH,A,     ACCOUNT NUMBER, CHARACTER       
              08,06,CH,A),    CLIENT NUMBER   CHARACTER       
              FILSZ=E1000                                     
*                                                             
 SUM  FIELDS=(16,13),           SUM STARTING IN 16, L 13      
              FORMAT=ZD                                       
*                                                             
*INCLUDE THE RECORD IF:                                       
 INCLUDE COND=(29,01,CH,EQ,C'I')        RECORD TYPE IS 'I'    
*                                                             
*                                                             
*                                                             
 OUTREC FIELDS=(01:01,28,           MOVE FIRST 28 FROM INPUT     
             29:C'  ',              PUT SPACES INTO 29, 30       
             32:C'0000000000000',        PUT 13 ZEROS  INTO 32   
             46:C'A')                    PUT 'A'       INTO 46   
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
* EXAMPLE 3                                                      
* SORT. SUM. INCLUDE. SHOWS ANDS / ORS                           
 SORT FIELDS=(03,07,CH,A,     ACCOUNT NUMBER, CHARACTER          
              10,06,CH,A),    CLIENT NUMMBER  CHARACTER          
              FILSZ=E1000                                        
*                                                                
*                                                                
*                                                                
 SUM  FIELDS=(30,13),           STARTING IN 30, L 13             
              FORMAT=ZD                                          
*                                                                    
*SORT THE RECORD ONLY IF:         (INCLUDE CONDITIONS)               
*                                                                    
 INCLUDE COND=((01,01,CH,NE,X'00'), FIRST POSITION IS NOT LOW-VALUES 
*                                                                    
       AND,                                                          
        (01,01,CH,NE,X'FF'),        FIRST POSITION IS NOT HIGH-VALUES
*                                                                    
       AND,                                                          
        (01,02,CH,EQ,C'CA'),        FIRST 2 POSITIONS = 'CA'         
*                                                                    
       AND,              PRODUCT ID     STARTS WITH 001 OR 002       
        ((10,03,CH,EQ,C'001'),OR,(10,03,CH,EQ,C'002')),              
*                                                                    
       AND,             TAX CODE      IS '0', '6', '8'               
        ((22,01,CH,EQ,C'0'),OR,(22,01,CH,EQ,C'6'),OR,                
         (22,01,CH,EQ,C'8')))                                        
                                                         

[Books Computer]

Home Books for Computer Professionals Privacy Terms |
Site Map and Site Search Programming Manuals and Tutorials The REXX Files Top of Page |