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

how to get the occurance of a field using sort or icetool


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
prathap_ts
Warnings : 1

New User


Joined: 07 May 2005
Posts: 9
Location: Duluth, US

PostPosted: Fri Jun 05, 2009 1:35 pm
Reply with quote

input file

col1 col2

12345 11111
12345 11111
12345 22222
12345 33333
12345 33333

54321 77777
54321 77777
54321 33333

67890 22222
67890 44444
67890 88888

98765 99999
98765 99999

in col3, i want to display the occurance of col1 for every change in col2 as
mentioned below

output file

col1 col2 col3

12345 11111 1
12345 22222 2
12345 33333 3

54321 77777 1
54321 33333 2

67890 22222 1
67890 44444 2
67890 88888 3

98765 99999 1
Back to top
View user's profile Send private message
senjay

Active User


Joined: 10 May 2007
Posts: 147
Location: India

PostPosted: Fri Jun 05, 2009 6:12 pm
Reply with quote

Hi,

You may want to refer RESTART of SEQNUM from 'DFSORT application programming guide'.

Quote:
RESTART specifies that DFSORT is to restart the sequence number at the starting value (START=j) when the binary value for the specified OUTFIL input field or parsed input field changes. This allows you to sequence each set of records with the same value (that is, duplicate records) separately. For example: Without RESTART, if you had six OUTFIL input records with ’A’, ’A’, ’A’, ’B’, ’B’ and ’C’, respectively, in position 1, the output records would be given the sequence numbers 1, 2, 3, 4, 5 and 6. But with RESTART=(1,1), the output records are given the sequence numbers 1, 2, 3, 1, 2 and 1; DFSORT restarts at the starting value (1, by default) when the input value at position 1 changes from ’A’ to ’B’ and again when it changes from ’B’ to ’C’.
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: Fri Jun 05, 2009 9:23 pm
Reply with quote

parthap_ts,

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 *
12345   11111
12345   11111
12345   22222
12345   33333
12345   33333
54321   77777
54321   77777
54321   33333
67890   22222
67890   44444
67890   88888
98765   99999
98765   99999
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
 OPTION COPY
 INREC OVERLAY=(17:SEQNUM,3,FS,RESTART=(1,13))
 OUTFIL OMIT=(17,3,ZD,GT,1),
   OVERLAY=(17:SEQNUM,3,FS,RESTART=(1,5))
/*
Back to top
View user's profile Send private message
prathap_ts
Warnings : 1

New User


Joined: 07 May 2005
Posts: 9
Location: Duluth, US

PostPosted: Sat Jun 06, 2009 6:05 pm
Reply with quote

hey farnk... its works thanks

u too senthil.

bfn
Prathap TS.
Back to top
View user's profile Send private message
prathap_ts
Warnings : 1

New User


Joined: 07 May 2005
Posts: 9
Location: Duluth, US

PostPosted: Wed Jun 10, 2009 6:12 pm
Reply with quote

there is a little change in the input structure

RCFMT - FB, LRECL - 80

F1 PIC S9(9) USAGE COMP.
F2 PIC S9(9) USAGE COMP.
F3 PIC S9(4) USAGE COMP.
F4 PIC S9(9) USAGE COMP.

input

F1 --F2--- F3 --F4--
10 12345 1 11111
10 12345 1 22222
10 12345 1 33333
10 54321 1 77777
10 54321 1 33333
10 67890 1 22222
10 67890 1 44444
10 67890 1 88888
10 98765 1 99999

output

F1 --F2--- F3 --F4--
10 12345 1 11111
10 12345 2 22222
10 12345 3 33333
10 54321 1 77777
10 54321 2 33333
10 67890 1 22222
10 67890 2 44444
10 67890 3 88888
10 98765 1 99999

for the above req i tried with the sysin st

Code:
SYSIN :                                                       
  OPTION COPY                                                 
  INREC OVERLAY=(9:SEQNUM,4,BI,RESTART=(5,10))
  OVERLAY=(9:SEQNUM,4,BI,RESTART=(5,4))       
  *                                                           


But getting error like
NO KEYWORDS FOUND ON CONTROL STATEMENT
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: Wed Jun 10, 2009 10:01 pm
Reply with quote

That's a Syncsort message, so you're using Syncsort, not DFSORT. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.

I'm moving this thread to the JCL Forum. Please post future questions on Syncsort there.
Back to top
View user's profile Send private message
prathap_ts
Warnings : 1

New User


Joined: 07 May 2005
Posts: 9
Location: Duluth, US

PostPosted: Thu Jun 11, 2009 7:05 am
Reply with quote

frank then let me know how to do with ICETOOL or ICEMAN

hope i mentioned this in subject also...
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Jun 11, 2009 7:23 am
Reply with quote

Frank Yaeger wrote:
That's a Syncsort message, so you're using Syncsort, not DFSORT. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.

I'm moving this thread to the JCL Forum. Please post future questions on Syncsort there.
prathap_ts,

Which part of the above message dint you understand?

Being able WORK with "ICEMAN" and "ICETOOL" in a SyncSort shop does not mean that you have DFSORT unless your shop has both the products installed. These will invoke the modules SORT/SYNCSORT and SYNCTOOL respectively in your shop.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Thu Jun 11, 2009 8:16 am
Reply with quote

Hello,

If the job Frank provided worked, why did you not continue in the same way?

Your sort control info is somewhat different than the original. . . icon_confused.gif

Suggest you also learn to use the "Code" tag to make jcl, code, and data more readable icon_wink.gif
Back to top
View user's profile Send private message
prathap_ts
Warnings : 1

New User


Joined: 07 May 2005
Posts: 9
Location: Duluth, US

PostPosted: Thu Jun 11, 2009 12:20 pm
Reply with quote

arun
if u know the answer for requirement either in syncsort or dfsort
then post it here and don't bother abt the sort tools.
if u can move the post accordingly...



dick
i mentioned clearly that 'there is a little change in the input structure'

hope here i'm looking for an answer for my requirement
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Jun 11, 2009 12:46 pm
Reply with quote

prathap_ts,

Quote:
arun
if u know the answer for requirement either in syncsort or dfsort
then post it here
Already there's a working solution posted above, you just need to copy it and make a few changes. It's not working for you because instead of changing the field format, you have discovered your own syntax. So correct your syntax and re-run your job.
Quote:
don't bother abt the sort tools
I am least bothered about your "sort tools". But you should be aware which product/tool you have and ask for a solution which works on your product.
Quote:
if u can move the post accordingly
If you had bothered to read the last post made by Frank, you would n't have made this statement.
This topic is already in JCL forum since "Wed Jun 10, 2009 9:31 pm"
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Thu Jun 11, 2009 12:49 pm
Reply with quote

Thanks Arun, you put that in a far more user friendly way than I would have icon_biggrin.gif
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Help with SORT - I need to validate d... DFSORT/ICETOOL 0
No new posts Help required to reset decimal points... DFSORT/ICETOOL 10
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts Is this possible via sort (in one pass)? SYNCSORT 4
No new posts GDG generation name to GDG Base name ... DFSORT/ICETOOL 3
Search our Forums:

Back to Top