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

To get earliert date from using sort


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

New User


Joined: 05 Dec 2005
Posts: 79

PostPosted: Tue Nov 02, 2010 7:04 pm
Reply with quote

I have an input file with 2 dates START DATE and END DATE.

Format is
ID Key startdate end date
AAA4567892010090920101010YYY
BBB4567892010070920102010YYY
CCC4567892010080920103010YYY
AAA5567892010090920101010YYY
BBB6567892010090920101010YYY
CCC7567892010090920101010YYY
CCC7567892010090920101010YYY

Key is 6 bytes starting from 4th position.
We have to find earliest start date and latest end date for each key which has duplicates.

Example:
For key 456789, there are 3 dates 20100909, 20100709, 20100809

Here earliest start date is 20100709. SImilarly same procedure to be applied for end date also. Here End date is 20103010.

If key has duplicates, then only we need to find earliest start date end latest end date.

date format in input file YYYYMMDD.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Nov 02, 2010 7:12 pm
Reply with quote

Prabha

I am sure from a previous post that you were using SYNCSORT rather than DFSORT. As this post seems to have mysteriously disappeared would you please be so kind as to post the JES SYSOUT element from the code below
Code:
//SORTSTEP EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
ABC
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT     FIELDS=COPY
It is important that we do know the product and release level being used as the solution may vary.
Back to top
View user's profile Send private message
Prabha
Warnings : 2

New User


Joined: 05 Dec 2005
Posts: 79

PostPosted: Tue Nov 02, 2010 8:06 pm
Reply with quote

ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R10 - 10:34 ON TUE NOV 02, 2010 -
V1R10 - 10:34 ON TUE NO
SORT FIELDS=COPY
ICE201I G RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE751I 0 C5-K51707 C6-K51707 C7-K54603 C8-K51707 E9-K51707 C9-BASE E5-K51707 E7-K51707
ICE193I 0 ICEAM1 INVOCATION ENVIRONMENT IN EFFECT - ICEAM1 ENVIRONMENT SELECTED
ICE252I 1 PARMLIB OPTIONS WERE MERGED WITH INSTALLATION MODULE DEFAULTS
ICE088I 0 TST5932L.SORTSTEP. , INPUT LRECL = 80, BLKSIZE = 80, TYPE = FB
ICE093I 0 MAIN STORAGE = (MAX,6291456,6278238)
ICE156I 0 MAIN STORAGE ABOVE 16MB = (6200798,6200798)
ICE127I 0 OPTIONS: OVFLO=RC4 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC16,VLSCMP=N,SZERO=Y,
ICE128I 0 OPTIONS: SIZE=6291456,MAXLIM=2097512,MINLIM=512000,EQUALS=N,LIST=Y,ERE
ICE129I 0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=SHORT,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT=
ICE130I 0 OPTIONS: RESALL=4096,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=Y,OUTREL=Y,CKPT=
ICE131I 0 OPTIONS: TMAXLIM=6291456,ARESALL=0,ARESINV=0,OVERRGN=65536,CINV=Y,CFW=
ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE ,EXITC
ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=MAX ,ODMAXBF=0,SOLRF=Y,VLLONG=N,VSAMI
ICE235I 0 OPTIONS: NULLOUT=RC0
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTOUT
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTIN
ICE751I 1 EF-K49535 F0-K49038 E8-K51707
ICE090I 0 OUTPUT LRECL = 80, BLKSIZE = 80, TYPE = FB
ICE055I 0 INSERT 0, DELETE 0
ICE054I 0 RECORDS - IN: 1, OUT: 1
ICE052I 0 END OF DFSORT
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Nov 02, 2010 9:21 pm
Reply with quote

Prabha wrote:

Here earliest start date is 20100709. SImilarly same procedure to be applied for end date also. Here End date is 20103010.

If key has duplicates, then only we need to find earliest start date end latest end date.

date format in input file YYYYMMDD.


Prabha,

I am assuming that the date 20103010 is a typo with YYYYMMDD format.

The following DFSORT JCL will give you the desired results. Since your dates are in YYYYMMDD format you can treat them as numbers to get min and max dates.

Code:

//STEP0100 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SORTIN   DD *                             
AAA4567892010090920101010YYY                 
BBB4567892010070920102010YYY                 
CCC4567892010080920103010YYY                 
AAA5567892010090920101010YYY                 
BBB6567892010090920101010YYY                 
CCC7567892010090920101010YYY                 
CCC7567892010090920101010YYY                 
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                             
  SORT FIELDS=(4,6,CH,A)                     
  OUTFIL REMOVECC,NODETAIL,                 
  SECTIONS=(4,6,                             
  TRAILER3=(1,9,MIN=(10,8,ZD,M11,LENGTH=8), 
                MAX=(18,8,ZD,M11,LENGTH=8), 
            26,3))                           
//*
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Alternative of JoinKeys in SORT DFSORT/ICETOOL 2
No new posts Sorting date into YYYYMMDD, and creat... DFSORT/ICETOOL 13
No new posts Sort SMF records? SYNCSORT 6
No new posts To Sort detail records in a file with... SYNCSORT 5
No new posts Simplify SORT CARD to combine INREC a... DFSORT/ICETOOL 6
Search our Forums:


Back to Top