View previous topic :: View next topic
|
Author |
Message |
pshongal
New User
Joined: 14 Jun 2012 Posts: 96 Location: India
|
|
|
|
Hi Friends,
I have a file unloaded from DB. It contains create time stamp in it.
I need to compare this timestamp with static timestamp (2013-08-27-00.00.00.000000) and write two files with records created after the static timestamp and before the timestamp.
Please help to understand how can I do it using Sort. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You want one OUTFIL with INCLUDE= for one of the conditions on your timestamp.
You want another OUTFIL with either SAVE, OMIT= or INCLUDE= depending on whether you can stand the chance of an exact hit on your value or not. |
|
Back to top |
|
|
pshongal
New User
Joined: 14 Jun 2012 Posts: 96 Location: India
|
|
|
|
I tested it as below.
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
2000-08-31-17.28.43.6341012013-08-27-00.00.00.000000
2000-12-22-12.00.40.1153662013-08-27-00.00.00.000000
2013-09-05-23.49.13.0361782013-08-27-00.00.00.000000
2013-08-28-16.19.10.9933222013-08-27-00.00.00.000000
2013-08-29-15.48.58.2846922013-08-27-00.00.00.000000
2013-07-18-21.52.02.2495542013-08-27-00.00.00.000000
2013-01-22-13.03.57.0813732013-08-27-00.00.00.000000
2013-10-10-07.38.37.5258382013-08-27-00.00.00.000000
2001-01-26-12.15.35.2091982013-08-27-00.00.00.000000
2013-08-30-16.13.47.7891362013-08-27-00.00.00.000000
/*
//OUT1 DD DSN=HLQ.TIMESORT.OUT1,
// DISP=(NEW,CATLG,DELETE),
// RECFM=FB,
// UNIT=SYSDA,
// DATACLAS=HUGE
//OUT2 DD DSN=HLQ.TIMESORT.OUT2,
// DISP=(NEW,CATLG,DELETE),
// RECFM=FB,
// UNIT=SYSDA,
// DATACLAS=HUGE
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=OUT1,INCLUDE=(1,26,UFF,GT,27,26,UFF)
OUTFIL FNAMES=OUT2,SAVE
/*
But here, I need to append the static timestamp in my file before sort. Can I do it without appending the value, is it possible to code it directly in Include? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Yes. You can include it as a literal. Or you can make a symbol/SYMNAME. Or use the JPn from the PARM. |
|
Back to top |
|
|
pshongal
New User
Joined: 14 Jun 2012 Posts: 96 Location: India
|
|
|
|
Below didnot work. All records were written to OUT2.
OPTION COPY
OUTFIL FNAMES=OUT1,
INCLUDE=(1,26,UFF,GE,2013-08-27-00.00.00.000000)
OUTFIL FNAMES=OUT2,SAVE
What is wrong in the card? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Change UFF to CH and put C' at the left of your timestamp and ' at the right, to make it a character literal. |
|
Back to top |
|
|
pshongal
New User
Joined: 14 Jun 2012 Posts: 96 Location: India
|
|
|
|
Thanks a lot Bill. It worked. |
|
Back to top |
|
|
|