MODE Operator (for Experienced)


  • MODE operator controls the error checking and actions to be performed after error detection.
  • There are three modes available for error checking -
    • STOP mode (the default) stops subsequent operations if an error is detected.
    • CONTINUE mode continues with subsequent operations if an error is detected.
    • SCAN mode allows checking ICETOOL statements without performing any operations.

Syntax -

SCAN Mode -

 MODE SCAN
   RANGE ...
   UNIQUE ...

STOP Mode -

 MODE STOP
   VERIFY ...
   DISPLAY ...

CONTINUE Mode -

 MODE CONTINUE
   COPY ...
   SORT ...
   STATS ...
MODE Operator

Required Operands


STOP -

  • STOP mode stops processing the remaining operations that are coded immediately to the STOP statement if an error occurs.
  • However, it continues to check for errors in ICETOOL statements.
  • STOP mode is the default mode set at the beginning of an ICETOOL run.

SCAN -

  • SCAN mode checks for errors in ICETOOL statements without processing the operations.
  • SCAN mode is set automatically when an error is detected in STOP mode.

CONTINUE -

  • CONTINUE mode processes the remaining operations that are coded immediately to the CONTINUE even an error occurs.

Example -


Scenario - Separate employee details based on "IN", "US". If any error occurs in the first processing stops the second process.

INPUT - MATEPK.INPUT.PSFILE

 BROWSE    MATEPK.INPUT.PSFILE                        Line 00000000 Col 001 080 
 Command ===>                                                  Scroll ===> CSR  
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
001  PAWAN         MAINFRAME           JPM       AP        IN           
002  SRINIVAS      TESTING             ORACLE    TG        IN           
003  SRIDHAR       SAS                 CG        OR        US           
004  VENKATESH     ABAP                CSC       CA        IN           
005  RAVI          HADOOP              CTS       FL        US           
006  PRASAD        HR                  INFOSYS   MI        US           
007  RAJA          TESTING             IBM       CA        US           
******************************** Bottom of Data ********************************

JCL -

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//MATEPKIT JOB (123),'MATEPK',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),        
//             NOTIFY=&SYSUID                                           
//*                                                                     
//STEP01   EXEC PGM=ICETOOL                                             
//INDD     DD DSN=MATEPK.INPUT.PSFILE,DISP=SHR                          
//OUTDD1   DD DSN=MATEPK.OUTPUT.PSFILEM1,                               
//            DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD4,                
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,                        
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)              
//OUTDD2   DD DSN=MATEPK.OUTPUT.PSFILEM2,                               
//            DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD4,                
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,                        
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)              
//TOOLIN   DD *                                                         
  COPY  FROM(INDD) TO(OUTDD1) USING(CTL1)                               
  MODE  STOP                                                            
  COPY  FROM(INDD) TO(OUTDD2) USING(CTL2)                               
/*                                                                      
//CTL1CNTL DD *                                                         
  INCLUDE COND=(60,2,CH,EQ,C'IN')                                       
/*                                                                      
//CTL2CNTL DD *                                                         
  INCLUDE COND=(60,2,CH,EQ,C'US')                                       
/*                                                                      
//TOOLMSG  DD SYSOUT=*                                                  
//DFSMSG   DD SYSOUT=*                                                  
//                                                                      
**************************** Bottom of Data ****************************

OUTPUT1 - MATEPK.OUTPUT.PSFILEM1

 BROWSE    MATEPK.OUTPUT.PSFILEM1                     Line 00000000 Col 001 080 
 Command ===>                                                  Scroll ===> CSR  
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
001  PAWAN         MAINFRAME           JPM       AP        IN                   
002  SRINIVAS      TESTING             ORACLE    TG        IN                   
004  VENKATESH     ABAP                CSC       CA        IN                   
******************************** Bottom of Data ********************************

OUTPUT2 - MATEPK.OUTPUT.PSFILEM2

 BROWSE    MATEPK.OUTPUT.PSFILEM2                     Line 00000000 Col 001 080 
 Command ===>                                                  Scroll ===> CSR  
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
003  SRIDHAR       SAS                 CG        OR        US                   
005  RAVI          HADOOP              CTS       FL        US                   
006  PRASAD        HR                  INFOSYS   MI        US                   
007  RAJA          TESTING             IBM       CA        US                   
******************************** Bottom of Data ********************************

TOOLMSG (SDSF SPOOL) - Verify TOOLMSG for the return code of the submitted job.

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9
********************************* TOP OF DATA ********************************************
1ICE600I 0 DFSORT ICETOOL UTILITY RUN STARTED                                   
                                                                                
 ICE650I 0 VISIT http://www.ibm.com/storage/dfsort FOR ICETOOL PAPERS, EXAMPLES AND MORE 
                                                                                
 ICE632I 0 SOURCE FOR ICETOOL STATEMENTS:  TOOLIN                               
                                                                                
                                                                                
 ICE630I 0 MODE IN EFFECT:  STOP                                                
                                                                                
             COPY  FROM(INDD) TO(OUTDD1) USING(CTL1)                            
 ICE606I 0 DFSORT CALL 0001 FOR COPY  FROM INDD     TO OUTDD1   USING CTL1CNTL COMPLETED
 ICE602I 0 OPERATION RETURN CODE:  00                                           
                                                                                
             MODE  STOP                                                         
 ICE630I 1 MODE IN EFFECT:  STOP                                                
 ICE602I 1 OPERATION RETURN CODE:  00                                           
                                                                                
             COPY  FROM(INDD) TO(OUTDD2) USING(CTL2)                            
 ICE606I 0 DFSORT CALL 0002 FOR COPY  FROM INDD     TO OUTDD2   USING CTL2CNTL COMPLETED
 ICE602I 0 OPERATION RETURN CODE:  00                                           
                                                                                
                                                                                
 ICE601I 0 DFSORT ICETOOL UTILITY RUN ENDED - RETURN CODE:  00                  
******************************** BOTTOM OF DATA ******************************************

Explaining Solution -

  • INDD - Specifies the ddname for input file.
  • OUTDD1,OUTDD2 - Specifies the ddnames for output files.
  • TOOLIN DD * - Specifies the ICETOOL statements for DFSORT.
  • TOOLMSG - Specifies where to write the ICETOOL processing messages.
  • DFSMSG - Specifies where to write the DFSORT processing messages.
  • COPY FROM(INDD) TO(OUTDD1) USING(CTL1) - Copies the data records which satisfies the selection criteria specified in CTL1 from INDD to OUTDD1.
  • MODE STOP - Stops the process if error occurs by the statement throws an error.
  • COPY FROM(INDD) TO(OUTDD2) USING(CTL2) - Copies the data records which satisfies the selection criteria specified in CTL2 from INDD to OUTDD2.
  • CTL1CNTL DD *, CTL2CNTL DD * - Specifies the DFSORT statements for processing.
  • INCLUDE COND=(60,2,CH,EQ,C'IN') - Selection criteria to copy the records which are having 'IN' from 60th byte of length 2 bytes.
  • INCLUDE COND=(60,2,CH,EQ,C'US') - Selection criteria to copy the records which are having 'US' from 60th byte of length 2 bytes.