View previous topic :: View next topic
|
Author |
Message |
Vamshi Veludandi
New User
Joined: 17 Mar 2009 Posts: 27 Location: Bangalore
|
|
|
|
Hi all,
I have a requirement where in I need to increment a counter at a specific column.
The counter should be incremented for all between the records where in AA and ZZ in the 1st column.
Regards,
Vamshi. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Please Paste the samples and use the code tags, don't attach screen images.
You want to do this with a Sort? Which product are you using? Does it support a GROUP function? What have you tried? What problems did that give you? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
do not post screenshots, they waste space and p*** off people willing to help
( You cannot cut and paste from a screenshot, and retyping Your data to test the answers is pretty boring )
use a plain cut and paste ( text mode ) with the code tags
the screenshots will be deleted in a while |
|
Back to top |
|
|
elango_K
New User
Joined: 18 Aug 2011 Posts: 44 Location: India
|
|
|
|
Hi Vamshi,
This can be achieved using DFSORT When=Begin condition. |
|
Back to top |
|
|
Vamshi Veludandi
New User
Joined: 17 Mar 2009 Posts: 27 Location: Bangalore
|
|
|
|
My Sincere Apologies,
I shouldn't have attached screen images.
The counter position starts at 7th column for all the records.
The counter should be incremented for all the records between AA to ZZ in first column.
Can we do this using DFSORT ? If so, a sample code snippet would be much helpful.
Input file:
Code: |
XY -- 000000000
BC -- 000000000
AA -- 000000000
BC -- 000000000
AD -- 000000000
C -- 000000000
N3 -- 000000000
ZZ -- 000000000
11 -- 000000000
22 -- 000000000 |
Expected Output file:
Code: |
XY -- 000000000
BC -- 000000000
AA -- 000000001
BC -- 000000002
AD -- 000000003
C -- 000000004
N3 -- 000000005
ZZ -- 000000006
11 -- 000000000
22 -- 000000000 |
Regards,
Vamshi. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Yes, it can be done in DFSORT. It should have therefore been posted in the DFSORT forum.
You still didn't put your data in the Code tags.
This is so Spacing is preserved.
Code: |
This is so Spacing is preserved. |
If you click on the Quote button on this post, you'll see what I mean. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
TS post edited to add the code tags, in the hope that he will learn
screenshots deleted also |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can use a DFSORT job like the following to do what you asked for:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (VB)
//SORTOUT DD DSN=... output file (VB)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(5,2,CH,EQ,C'AA'),
END=(5,2,CH,EQ,C'ZZ'),PUSH=(11:SEQ=9))
/*
|
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080 |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
you will need to add 4 bytes to all of your start positions for a VB file.
Gerry |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Oops. I missed the "VB" in the Subject ... wasn't mentioned in the posts.
I've changed my previous post to use a VB file.
Thanks for the correction. |
|
Back to top |
|
|
Vamshi Veludandi
New User
Joined: 17 Mar 2009 Posts: 27 Location: Bangalore
|
|
|
|
Sorry for the delay in responding to your suggessions.
Thank you very much, Frank.
The code snippet you gave was perfect for my requirement.
But, I got the job done, by splitting the file for the records to be updated and then ran another step to update the sequence number and then again merged the files back .
I should have had the patience to look into the DFSORT tutorial, which is excellent, before posting it. It wasn't even hard to find the solution in the manual.
Regards,
Vamshi |
|
Back to top |
|
|
|