Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Dynamice increment using overlay in dfsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Dynamice increment using overlay in dfsort
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    Post subject:
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    Post subject: Reply to: Dynamice increment using overlay in dfsort
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    Post subject: overlay increment
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    Post subject: Re: overlay increment
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts DFSORT sorting only specific records akodakka DFSORT/ICETOOL 4 Thu Aug 04, 2016 11:24 am
No new posts Symbolic Parameters in SYSIN DD state... madishpa DFSORT/ICETOOL 3 Mon Jun 27, 2016 6:23 pm
No new posts DFSORT to match two files and write John F Dutcher DFSORT/ICETOOL 6 Thu May 12, 2016 5:17 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us