Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
MGayathri

New User

Joined: 19 May 2007
Posts: 25
Location: Chennai

 Posted: Tue Apr 22, 2008 7:22 pm    Post subject: Extraction of records until the key break using Sort 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

Frank Yaeger

DFSORT Moderator

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

 Posted: Tue Apr 22, 2008 8:33 pm    Post subject: 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).
MGayathri

New User

Joined: 19 May 2007
Posts: 25
Location: Chennai

 Posted: Wed Apr 23, 2008 11:45 am    Post subject: 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
CICS Guy

Senior Member

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

Posted: Wed Apr 23, 2008 12:08 pm    Post subject:

 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?
MGayathri

New User

Joined: 19 May 2007
Posts: 25
Location: Chennai

Posted: Wed Apr 23, 2008 12:34 pm    Post subject:

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
William Thompson

Global Moderator

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

Posted: Wed Apr 23, 2008 12:45 pm    Post subject:

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)......
MGayathri

New User

Joined: 19 May 2007
Posts: 25
Location: Chennai

 Posted: Wed Apr 23, 2008 1:05 pm    Post subject: The keys are not uniquie it is having Duplicates.The maximum number duplicate key is around 25
Skolusu

Senior Member

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

Posted: Wed Apr 23, 2008 9:22 pm    Post subject: Reply to: Extraction of records until the key break using So

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...
V S Amarendra Reddy

Active User

Joined: 13 Sep 2006
Posts: 213
Location: USA

Posted: Thu Apr 24, 2008 2:51 pm    Post subject: Reply to: Extraction of records until the key break using So

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
Skolusu

Senior Member

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

Posted: Thu Apr 24, 2008 9:22 pm    Post subject: Reply to: Extraction of records until the key break using So

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?
V S Amarendra Reddy

Active User

Joined: 13 Sep 2006
Posts: 213
Location: USA

 Posted: Fri Apr 25, 2008 3:43 pm    Post subject: I think I thought bit wrongly.Thanks for the clarification and help Regards Amar
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics MXG - Processing Compressed DB2 SMF r... vasanthz All Other Mainframe Topics 2 Thu May 10, 2018 12:47 am Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am Merge 2 records sancraig16 SYNCSORT 19 Tue Mar 27, 2018 8:17 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us