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

Extraction of records until the key break using Sort


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

New User


Joined: 19 May 2007
Posts: 25
Location: Chennai

PostPosted: Tue Apr 22, 2008 7:22 pm
Reply with quote

I have few records with same keys repeated if I found a valid data in the first key I need to write out all the records with the same keys

Eg:
Input:
Key1 Valid-Date
Key1 Invalid-Date
Key1 Invalid-Date
Key2 Invalid-Date
Key2 Invalid-Date
Key3 Valid date
Key3 Invalid-Date

Ouput:
Key1 Valid-Date
Key1 Invalid-Date
Key1 Invalid-Date
Key3 Valid date
Key3 Invalid-Date
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 Apr 22, 2008 8:33 pm
Reply with quote

What are the "rules" for determining if a date is valid or invalid?

What is the RECFM and LRECL of the input file?

What is the starting position, length and format of each relevant field?

What is the approx. maximum number of unique keys (e.g. key1, key2).
Back to top
View user's profile Send private message
MGayathri

New User


Joined: 19 May 2007
Posts: 25
Location: Chennai

PostPosted: Wed Apr 23, 2008 11:45 am
Reply with quote

1.The date is considered as invalid if it has spaces

2. The Recfm = FB and total Lrecl is 1454

3. Key Date Data
1-62byte 74-8 ----1454

4. Doest know the maximum number for repeated keys
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Apr 23, 2008 12:08 pm
Reply with quote

Frank Yaeger wrote:
What are the "rules" for determining if a date is valid or invalid?
MGayathri wrote:
1.The date is considered as invalid if it has spaces
For all eight characters? Or just any of the eight being a space?
Quote:
What is the starting position, length and format of each relevant field?
Quote:
Code:
3. Key           Date    Data
    1-62byte    74-8    ----1454
So 63 to 73 can be dropped? And the data start right after the date, at 82 till the last byte at 1454? Is that a length of 1373?
Quote:
What is the approx. maximum number of unique keys (e.g. key1, key2).
Quote:
4. Doest know the maximum number for repeated keys
Is that do know or don't know the max number of duplicate or unique keys?
Back to top
View user's profile Send private message
MGayathri

New User


Joined: 19 May 2007
Posts: 25
Location: Chennai

PostPosted: Wed Apr 23, 2008 12:34 pm
Reply with quote

I think the specification I made is not much clear clear.Let me explain the scenario again with example

Eg: INPUT
Code:
Key(1-62)  Data(72,2)  Date(74,8)  Data(82-1373)
100F429A   XX             20040421      AAAAAA
100F429A   YY
1115A503   xx                           jjjjjjjjjjjjjj
1115A503   yy                           kkkkkkkkk
1115A588   XX             20060426      --------------
1115A588   XX                           -------------
1115A588   XX                           --------------


REQUIRED OUTPUT
Code:
Key(1-62)  Data(72,2)  Date(74,8)  Data(82-1373)
100F429A   XX             20040421      AAAAAA
100F429A   YY
1115A588   XX             20060426      --------------
1115A588   XX                           -------------
1115A588   XX                           --------------



In this the number of repeated keys is unknown

I think this wud better explain the scenario required
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Apr 23, 2008 12:45 pm
Reply with quote

Is the 'coded' data in your post what you intended? (use notepad' to align).....
Frank Yaeger wrote:
What is the approx. maximum number of unique keys (e.g. key1, key2).
Please try answering the question, unique not repeated (though the repeated information might prove useful)......
Back to top
View user's profile Send private message
MGayathri

New User


Joined: 19 May 2007
Posts: 25
Location: Chennai

PostPosted: Wed Apr 23, 2008 1:05 pm
Reply with quote

The keys are not uniquie it is having Duplicates.The maximum number duplicate key is around 25
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Apr 23, 2008 9:22 pm
Reply with quote

The following DFSORT/ICETOOL JCL will give you the desired results.
Code:

//STEP0100 EXEC PGM=ICETOOL                                   
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//IN       DD DSN=your input file,DISP=SHR                               
//OUT      DD DSN=your output file,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(5,5),RLSE)
/*
//TOOLIN   DD *                                               
  SPLICE FROM(IN) TO(OUT) ON(1463,8,CH)         -             
  WITHALL WITH(1,1462) KEEPBASE KEEPNODUPS USING(CTL1)                   
//CTL1CNTL DD *                                               
  INREC IFTHEN=(WHEN=INIT,                                     
       OVERLAY=(1455:SEQNUM,8,ZD,RESTART=(1,62),SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1455,8,ZD,EQ,1),   
       OVERLAY=(1463:SEQNUM,8,ZD,74,8)),                       
        IFTHEN=(WHEN=NONE,                                     
       OVERLAY=(1471:SEQNUM,8,ZD,                             
                1463:1463,8,ZD,SUB,1471,8,ZD,M11,LENGTH=8))   
  SORT FIELDS=COPY                                             
  OUTFIL FNAMES=OUT,INCLUDE=(1471,8,CH,NE,C' '),BUILD=(1,1454)
/*


Hope this helps...
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Thu Apr 24, 2008 2:51 pm
Reply with quote

Skolusu,

One small suggestion.
Code:
OVERLAY=(1455:SEQNUM,8,ZD,RESTART=(1,62),SEQNUM,8,ZD)),


Can be coded as
Code:
 OVERLAY=(1455:SEQNUM,8,ZD,RESTART=(1,62))),



Logic is working fine but one small clarification about splice.Keepnodups is for keeping the records that are not spliced. Then how the sort is picking only this record


Code:
1115A588   XX                           --------------


how this record is omitted as this is also not spliced


Code:
1115A503   yy                           kkkkkkkkk



Can you please explain the way splice way of working bit clearly.

Regards
Amar
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Apr 24, 2008 9:22 pm
Reply with quote

Quote:

Skolusu,

One small suggestion.
Code:

OVERLAY=(1455:SEQNUM,8,ZD,RESTART=(1,62),SEQNUM,8,ZD)),



Can be coded as
Code:

 OVERLAY=(1455:SEQNUM,8,ZD,RESTART=(1,62))),



NO you canNOT do that. We need 2 sequence numbers, the first sequence number is to identify the key and the next is identify the group.

Quote:

Logic is working fine


The only reason it worked for you because the omit condition is checking for not equal to space condition. Run your job removing the Include and build card on OUTFIL and you will notice how the grouping has gone wrong if you remove the seqnum.


Quote:

but one small clarification about splice.Keepnodups is for keeping the records that are not spliced. Then how the sort is picking only this record
Code:

1115A588   XX                           --------------




KEEPNODUPS parm is required to records which does not have a duplicate. for ex add the following record at the end and rerun the job

Code:

1115A589   zz             20060427      --------------


Without keepnodups parm SPLICE will eliminate the record, where as you need this record to be kept as the record has a valid date.

Quote:

Can you please explain the way splice way of working bit clearly.


Read the link given below. Frank has done a fantastic job explaining how splice works. Read the examples also.

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/6.13?
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Fri Apr 25, 2008 3:43 pm
Reply with quote

I think I thought bit wrongly.Thanks for the clarification and help

Regards
Amar
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 How to split large record length file... DFSORT/ICETOOL 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top