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
 

 

Increment a counter in a VB PS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Vamshi Veludandi

New User


Joined: 17 Mar 2009
Posts: 23
Location: Bangalore

PostPosted: Wed Jan 25, 2012 4:05 pm    Post subject: Increment a counter in a VB PS
Reply with quote

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
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Wed Jan 25, 2012 4:17 pm    Post subject: Reply to: Increment a counter in a VB PS
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Jan 25, 2012 4:22 pm    Post subject: Reply to: Increment a counter in a VB PS
Reply with quote

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
View user's profile Send private message
elango_K

New User


Joined: 18 Aug 2011
Posts: 44
Location: India

PostPosted: Wed Jan 25, 2012 4:40 pm    Post subject:
Reply with quote

Hi Vamshi,

This can be achieved using DFSORT When=Begin condition.
Back to top
View user's profile Send private message
Vamshi Veludandi

New User


Joined: 17 Mar 2009
Posts: 23
Location: Bangalore

PostPosted: Wed Jan 25, 2012 4:48 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Wed Jan 25, 2012 4:53 pm    Post subject: Reply to: Increment a counter in a VB PS
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Jan 25, 2012 4:57 pm    Post subject: Reply to: Increment a counter in a VB PS
Reply with quote

TS post edited to add the code tags, in the hope that he will learn icon_cool.gif
screenshots deleted also
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Wed Jan 25, 2012 11:29 pm    Post subject:
Reply with quote

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:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Thu Jan 26, 2012 4:30 am    Post subject:
Reply with quote

Hi,

you will need to add 4 bytes to all of your start positions for a VB file.

Gerry
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Jan 26, 2012 5:09 am    Post subject:
Reply with quote

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
View user's profile Send private message
Vamshi Veludandi

New User


Joined: 17 Mar 2009
Posts: 23
Location: Bangalore

PostPosted: Fri Jan 27, 2012 7:13 pm    Post subject:
Reply with quote

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 icon_sad.gif .

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Auto increment column value while ins... kishpra DB2 2 Wed Feb 05, 2014 3:48 pm
No new posts increment of space in jcl saideepu JCL & VSAM 8 Wed Jul 10, 2013 6:22 pm
No new posts Increment YEAR - SMALLINT column by 1... rohanthengal DB2 6 Wed Jun 26, 2013 11:31 am
No new posts A checkpoint counter sets at 100,need... N.Kotivamsi IMS DB/DC 13 Wed Jul 25, 2012 8:50 pm
No new posts SYSPLEX Named counter and TSQ model rsshanmugam All Other Mainframe Topics 1 Tue Mar 06, 2012 12:01 pm


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