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
 

 

Extraction of records until the key break using Sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Extraction of records until the key break using Sort
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 Moderator


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

PostPosted: Tue Apr 22, 2008 8:33 pm    Post subject:
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    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Wed Apr 23, 2008 12:08 pm    Post subject:
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    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Wed Apr 23, 2008 12:45 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: Extraction of records until the key break using So
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: 200
Location: USA

PostPosted: Thu Apr 24, 2008 2:51 pm    Post subject: Reply to: Extraction of records until the key break using So
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    Post subject: Reply to: Extraction of records until the key break using So
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.

http://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: 200
Location: USA

PostPosted: Fri Apr 25, 2008 3:43 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm


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