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

Increment count till specific interval


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

New User


Joined: 21 Dec 2006
Posts: 20
Location: London

PostPosted: Tue Jan 23, 2007 12:24 am
Reply with quote

I have one input record and have to repeat this by incrementing the specific value for a particular interval and then start again if the interval is reached from the same start value.

First calumn will be incremented by one and for second column we have to increment value for a particular interval and then start again if that interval is reached from the initial value.

Example:

12345 123 ASD
12346 124 ASR
12347 125 ASR

12348 123 ASR
12349 124 ASR
12350 125 ASR

12351 123 ASR
12352 124 ASR
12353 125 ASR

How to achieve this using DFSORT.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Jan 23, 2007 12:48 am
Reply with quote

Your description is not clear. You say you have one input record - is that input record:

12345 123 ASD

or something else? Or do you actually have more than one input record?

If you have one input record, how many output records do you want to create? Do you want to add 1 to field1 for each input record? Do you want to add 1 to field2 for each input record until you have three records and then start over at the initial field2 value in your input record (123)? The first record you show has ASD whereas the other records have ASR. Where did ASR come from?

You need to explain more clearly what you want to do and show input and output records that correspond to that explanation.
Back to top
View user's profile Send private message
shuklas

New User


Joined: 21 Dec 2006
Posts: 20
Location: London

PostPosted: Tue Jan 23, 2007 12:57 am
Reply with quote

Hi Frank,
I just have one input record and that is
12345 123 ASD
what i want is to increment the value of column by 1 for all the output records and for column two i just want to increment till interval is reached
like in Example for second field has value.
123 124 125 and again 123 124 125 and so on.

The output third field is constant field it will remain unchanged.
Mistake from my side.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Jan 23, 2007 2:24 am
Reply with quote

You didn't say how many output records you want, so I'll assume it's 9 as shown in your example. Given that, here's a DFSORT job that will do what you asked for. You can change the INTVL symbol to whatever interval you want. I set it to +3 as in your example.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD *
INTVL,+3
/*
//SORTIN DD DSN=...  input file (FB - one record)
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REPEAT=9,
    IFTHEN=(WHEN=INIT,OVERLAY=(14:SEQNUM,5,ZD,START=0,
             19:14,5,ZD,MOD,INTVL,TO=ZD,LENGTH=3)),
    IFTHEN=(WHEN=INIT,BUILD=(1:1,5,ZD,ADD,14,5,ZD,TO=ZD,LENGTH=5,
     7:7,3,ZD,ADD,19,3,ZD,TO=ZD,LENGTH=3,11:11,3))
/*
Back to top
View user's profile Send private message
shuklas

New User


Joined: 21 Dec 2006
Posts: 20
Location: London

PostPosted: Tue Jan 23, 2007 4:45 pm
Reply with quote

Thanks Frank.
It worked fine and i am getting expected result.
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 To get the count of rows for every 1 ... DB2 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
This topic is locked: you cannot edit posts or make replies. Construct new record using specific f... DFSORT/ICETOOL 6
Search our Forums:

Back to Top