IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Dynamice increment using overlay in dfsort


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jdeepak_mca

New User


Joined: 07 Aug 2007
Posts: 7
Location: Hyderabad

PostPosted: Thu Dec 18, 2008 5:44 pm
Reply with quote

Hi All,

Input : SORTIN
0501
1002
2003
3019
4019

Code:

//COPY1   EXEC PGM=SORT                                   
//SORTIN  DD DSN=&&TEMP3,DISP=SHR                         
//SORTOUT DD SYSOUT=*                                     
//SYSIN   DD *                                           
  OPTION COPY                                             
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4)),                   
        IFTHEN=(WHEN=(3,2,CH,EQ,C'01'),OVERLAY=(3:C'02'))
        IFTHEN=(WHEN=(3,2,CH,EQ,C'02'),OVERLAY=(3:C'03'))
        IFTHEN=(WHEN=(3,2,CH,EQ,C'03'),OVERLAY=(3:C'04'))
/*     


The output becomes
0502
1003
2004
3019 ------- Since we dont have any if then statement its unchanged
4019
------- Since we dont have any if then statement its unchanged

but I want all the records to have the last 2 numbers to get incremented automatically ( 01 becomes 02 , 02 becomes 03 and 19 becomes 20 and so on ) and give me the output. For example If I have 10000 records I cant have if then statements 10000 times.

What I expect now is I sud have some option in
//SYSIN DD *
OPTION COPY
To do the purpose of incrementation.so that it can just check with the (3,2,CH,EQ,C'01') and increment it by 1.

Please let me know how can we handle this kind of problem.

Regards,
Deepak
Back to top
View user's profile Send private message
nelson.pandian

Active User


Joined: 09 Apr 2008
Posts: 133
Location: Phoenix, AZ

PostPosted: Thu Dec 18, 2008 6:32 pm
Reply with quote

Hi jdeepak,

Welcome to the forum. Try this code.

Code:
//STEP01   EXEC PGM=ICETOOL                             
//*                                                     
//SYSOUT       DD  SYSOUT=*                             
//TOOLMSG      DD  SYSOUT=*                             
//DFSMSG       DD  SYSOUT=*                             
//*                                                     
//I1       DD  *                                       
0501                                                   
1002                                                   
2003                                                   
3019                                                   
4019                                                   
/*                                                     
//*                                                     
//T1       DD  DSN=&&T1,                               
//             DISP=(MOD,PASS),                         
//             UNIT=SYSDA,SPACE=(CYL,(50,10),RLSE)     
//*                                                     
//O1       DD  SYSOUT=*                                 
//*                                                     
//TOOLIN   DD  *    *** CONSTANT CONTROL CARDS ***         
  COPY FROM(I1) TO(T1) USING(CTL1)                         
  COPY FROM(T1) TO(O1) USING(CTL2)                         
/*                                                         
//CTL1CNTL DD *                                             
  INREC OVERLAY=(11:C'01')                                 
/*                                                         
//CTL2CNTL DD *                                             
   OUTREC IFTHEN=(WHEN=INIT,                               
        OVERLAY=(03:03,2,SFF,ADD,11,2,SFF,M11,LENGTH=2,76X))
/*                                                         


Output:
Code:
0502
1003
2004
3020
4020


Hope this gives you the desire output.
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Thu Dec 18, 2008 6:50 pm
Reply with quote

Hi,

you can try using the below card:

Code:
//SYSIN DD *
  OPTION COPY
  OUTREC FIELDS=(1,2,3,2,ZD,ADD,+1,M11,LENGTH=2)


I have a question for you. If your input has last 2 bytes as '99',then what shud the o/p be ?
ex:
IN
3099
4099

Expected o/p - ?

Let me know if you face any problem.
Thanks,
-Kapil.
Back to top
View user's profile Send private message
jdeepak_mca

New User


Joined: 07 Aug 2007
Posts: 7
Location: Hyderabad

PostPosted: Thu Dec 18, 2008 8:10 pm
Reply with quote

Hi Nelson,

Thanks for your input, Thats really nice of you, your solution for my problem works fine.

@ Kapil,

Thank you for your quick response, Yes now we have limit till 99 but in regard to your question my answer is we have been informed that we cant have more than 99 as this job is run monthly we might have to look this case in future. And in that case 99 becomes 100.

Thanks all,

Regards,
Deepak
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Dec 18, 2008 11:01 pm
Reply with quote

jdeepak_mca wrote:
Hi Nelson,
Thanks for your input, Thats really nice of you, your solution for my problem works fine.


You really don't need 2 passes of data to get the desired results. A simple 1 pass of data is enough to get the desired results

jdeepak_mca wrote:

@ Kapil,

Thank you for your quick response, Yes now we have limit till 99 but in regard to your question my answer is we have been informed that we cant have more than 99 as this job is run monthly we might have to look this case in future. And in that case 99 becomes 100.

Thanks all,

Regards,
Deepak


You only have 2 bytes to accommodate the number, if it is 100 it would require 3 bytes. would you increase the size of the field? Ideally if you want to just limit the increment of the number upto 99, I suggest you use the following DFSORT control cards

Code:

//STEP0100 EXEC PGM=ICEMAN           
//SYSOUT   DD SYSOUT=*               
//SORTIN   DD *                       
0501                                 
1002                                 
2003                                 
3019                                 
4019                                 
//SORTOUT  DD SYSOUT=*               
//SYSIN    DD *                       
  SORT FIELDS=COPY                   
  INREC IFTHEN=(WHEN=(3,2,ZD,LT,99), 
  OVERLAY=(3:+1,ADD,3,2,ZD,EDIT=(TT)))
//*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
No new posts DFSORT - VB file RDW getting overridden DFSORT/ICETOOL 3
Search our Forums:

Back to Top