Increment numbers using SORT



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Increment numbers using SORT

Postby ANAND.GADRE » Wed Nov 04, 2009 6:32 pm

I have a control card used in a job which has some run numbers, and I would like to know whether I can increment them through a SORT step. It looks like this --

//SETVAR01 SET WEEK='516'
//SETVAR02 SET ABCGDG='G0365V00'
//SETVAR03 SET XYZGDG='G0367V00'

I want to add a step in my job which will increment all these numbers by 1. Can I do it through SORT?
ANAND.GADRE
 
Posts: 3
Joined: Mon Nov 02, 2009 5:27 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Increment numbers using SORT

Postby skolusu » Wed Nov 04, 2009 9:41 pm

ANAND.GADRE,

use the following DFSORT JCL which will give you the desired results. This job also automatically resets the counter to 1 when the counts exceeds 999 and 9999.

//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD DATA,DLM=$$                               
//SETVAR01 SET WEEK='516'                               
//SETVAR02 SET ABCGDG='G0365V00'                       
//SETVAR03 SET XYZGDG='G0367V00'                       
$$                                                     
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                     
  INREC IFTHEN=(WHEN=(9,2,ZD,EQ,1),                     
  OVERLAY=(22:+1,ADD,22,3,ZD,EDIT=(TTT))),             
  IFTHEN=(WHEN=(9,2,ZD,GT,1),                           
  OVERLAY=(25:+1,ADD,25,4,ZD,EDIT=(TTTT)))             
                                                       
  OUTREC IFTHEN=(WHEN=(22,3,ZD,EQ,0),OVERLAY=(24:C'1')),
         IFTHEN=(WHEN=(25,4,ZD,EQ,0),OVERLAY=(28:C'1'))
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Increment numbers using SORT

Postby ANAND.GADRE » Thu Nov 05, 2009 11:33 am

Thank you..this does work !
ANAND.GADRE
 
Posts: 3
Joined: Mon Nov 02, 2009 5:27 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post