Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : All available storage is assigned to the job or jobstep, If REGION is coded 0K or 0M

Google
 
Web mainframegurukul.com

how to get sequence number like this?

 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities
  View previous topic :: View next topic  
Author Message
rangab
Active Member


Joined: 17 Mar 2006
Posts: 56

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Feb 09, 2009 8:35 pm    Post subject: how to get sequence number like this? Reply with quote

Hi,

My input dataset (LRECL=80, RECFM=FB):
Code:

12345600000ZX
12345600000ZY
12345700000ZX
12345700000ZY
12345800000ZX
12345800000ZY
12345600000ZX
12345600000ZY


Expected output: LRECL=90, RECFM=FB
Code:

12345600000ZX    0001
12345600000ZY    0002
12345600000ZX    0001
12345600000ZY    0002


Input dataset contains duplicates and output should contain duplicates but with sequence number assigned to them.

Thanks.
_________________
========
Ranga...:-0)
========
Learn Which You Don't Know - Teach Others Which They Don't Know.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Feb 09, 2009 9:17 pm    Post subject: Reply with quote

I wish you would make more of an effort to match your examples to your descriptions and explain the "rules" for your examples.

What is the starting position and length of the key field you want to check for duplicates on? Why do you have the first two records in the output and the last two records in the output, but not the other four records? I don't see any difference between the 4 pairs of records.

Assuming your input records are already in order by the key (as shown in your example) and you want to restart the sequence numbers each time the key in positions 1-11 changes (just a guess on the key positions), you can do it with a DFSORT job like this:

Code:

//S1    EXEC  PGM=SORT                                 
//SYSOUT    DD  SYSOUT=*                               
//SORTIN DD *                                           
12345600000ZX                                           
12345600000ZY                                           
12345700000ZX                                           
12345700000ZY                                           
12345800000ZX                                           
12345800000ZY                                           
12345600000ZX                                           
12345600000ZY                                           
/*
//SORTOUT DD SYSOUT=*                                   
//SYSIN    DD    *                                     
  OPTION COPY                                           
  INREC OVERLAY=(18:SEQNUM,4,ZD,RESTART=(1,11),90:X)   
/*


SORTOUT would be RECFM=FB/LRECL=90 with these records:

Code:

12345600000ZX    0001     
12345600000ZY    0002     
12345700000ZX    0001     
12345700000ZY    0002     
12345800000ZX    0001     
12345800000ZY    0002     
12345600000ZX    0001     
12345600000ZY    0002     


If that's not what you want, then you need to do a better job of explaining what you do want.
_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
rangab
Active Member


Joined: 17 Mar 2006
Posts: 56

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Feb 10, 2009 2:04 pm    Post subject: Reply with quote

Frank, thanks for the reply. I will try to improve Embarassed

The key here starts in 1st column and of 6 bytes length. I want this sequence number technique to be applied on certain key value only (ex. 123456). However, the code you have given here should work for me.

Thanks a lot.
_________________
========
Ranga...:-0)
========
Learn Which You Don't Know - Teach Others Which They Don't Know.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
rangab
Active Member


Joined: 17 Mar 2006
Posts: 56

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Feb 10, 2009 2:27 pm    Post subject: Reply with quote

Frank, thank you again. It has worked.
_________________
========
Ranga...:-0)
========
Learn Which You Don't Know - Teach Others Which They Don't Know.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
rangab
Active Member


Joined: 17 Mar 2006
Posts: 56

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Feb 10, 2009 2:59 pm    Post subject: how to apply this technique? Reply with quote

Hi, Frank.

How to apply the sequence number technique on below data? This dataset's LRECL=80 & RECFM=FB. The key field starts in 19th column and of 6 bytes. I want to apply 5 digit sequence number only for key value '161009' and it's next record (01 & 02) at column position 30.

Input:
Code:

----+----1----+----2----+
0000012121800000VA161009
0000012121800000VB11+C1U
0000012121800000VA131009
0000012121800000VB11+P1U
0000012121800000VA161009
0000012121800000VB08+B1U
0000012121800000VA141009
0000012121800000VB11+X1U
0000012121800000VA161009
0000012121800000VB08+J1U
0000012121800000VA161009
0000012121800000VB08+H1U


Output:
Code:

0000012121800000VA161009     00001
0000012121800000VB11+C1U     00002
0000012121800000VA161009     00001
0000012121800000VB08+B1U     00002
0000012121800000VA161009     00001
0000012121800000VB08+J1U     00002
0000012121800000VA161009     00001
0000012121800000VB08+H1U     00002


I hope, have explained it better this time. Smile
TIA.
_________________
========
Ranga...:-0)
========
Learn Which You Don't Know - Teach Others Which They Don't Know.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Feb 10, 2009 9:07 pm    Post subject: Reply with quote

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(19,6,CH,EQ,C'161009'),
    RECORDS=2,PUSH=(30:SEQ=5))
  OUTFIL OMIT=(30,1,CH,EQ,C' ')
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
rangab
Active Member


Joined: 17 Mar 2006
Posts: 56

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Feb 11, 2009 4:51 pm    Post subject: Reply with quote

wow....thanks a lot.
_________________
========
Ranga...:-0)
========
Learn Which You Don't Know - Teach Others Which They Don't Know.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
academyindia4
Guest





Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Jan 25, 2016 10:34 pm    Post subject: Topic deleted by Admin Reply with quote

<< Content deleted By Admin >>
Back to top
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities All times are GMT + 5 Hours
Page 1 of 1



 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts EZtrv+ - Is there a way to suppress ez-code from printing... 5 seagreg 11386 Mon Feb 01, 2016 1:39 am
academyindia4 View latest post
No new posts Reg DFSORT utility. 5 ursvmg 18134 Mon Feb 01, 2016 1:38 am
academyindia4 View latest post
No new posts test datase empty 8 nick.mamone 16632 Mon Feb 01, 2016 1:38 am
academyindia4 View latest post
No new posts Xpeditor use in batch process 4 nanda_cse 15743 Wed Jan 27, 2016 8:56 pm
academyindia4 View latest post
No new posts Many JCL statements contain specific values designed to dire 1 Krishna 4873 Tue May 12, 2009 5:39 pm
Krishna View latest post
 


Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-3764.html