View previous topic :: View next topic
|
Author |
Message |
dilip_bangalore
New User
Joined: 29 Sep 2011 Posts: 27 Location: India
|
|
|
|
Hi,
Please let me know if there is any way to pass dynamic values in sort card in jcl to read records that are created in the last 1 year.
So every month I run the job, only 1 year data will be considered..
Thanks in advance.
Kind regards,
Dilip |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
What "dynamic value" do you want?
If you put a value in a file and use a small sort step to generate a SYMNAMES file with a symbol with a constant value, from your file, would that do you? There are examples here if you can do the searching. |
|
Back to top |
|
|
dilip_bangalore
New User
Joined: 29 Sep 2011 Posts: 27 Location: India
|
|
|
|
Hi Bill,
By dynamic value I mean instead of hard coding the date in include cond, the date would be generated based on current date. So that past 1 year data is read read from the file. So that every time I run the job on last 1 year data is read from the file from the current date.
Thanks. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
use the <substitution>/<build> facilities of Your scheduler
or if You detail better what You want , it might be possible to use the date processing facilities of DFSORT/SYNCSORT.
what sort product are You using ?
SYNCSORT ==> WER... messages
DFSORT ==> ICE... messages
in any case post the output of
Code: |
****** ***************************** Top of Data ******************************
000001 //<appropriate jobcard>
000002 //*
000003 //*
000004 //S EXEC PGM=SORT
000005 //SYSOUT DD SYSOUT=*
000006 //SORTIN DD *
000007 DUMMY
000008 //SORTOUT DD SYSOUT=*,
000009 // DCB=(RECFM=FB,LRECL=80)
000010 //SYSIN DD *
000011 OPTION COPY
****** **************************** Bottom of Data ****************************
|
so we can see the level of the sort product You are using
and post a solution compatible with Your <sort> product level
Code'd :-) |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
deleted by dbz, repeat of enrico's post (well, not quite, but sorta) |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
It'd be nice if you show the sample input records and the expected output from it. Along with RECFM, LRECL of input & output.
And what SORT product are you using, as Enrico has asked for? |
|
Back to top |
|
|
dilip_bangalore
New User
Joined: 29 Sep 2011 Posts: 27 Location: India
|
|
|
|
We use SYNCSORT product.
Please see the below include cond.
INCLUDE COND= (43,6,PD,GE,&$SY&$PM010000)
I am trying to replace the field &$SY&$PM010000 with 1108300000, so that past 1 year data is considered from that input file and it changes to 1109300000, when I run next month.
I remember we pass values for this before job card for the & paramaters is in include code. |
|
Back to top |
|
|
hailashwin
New User
Joined: 16 Oct 2008 Posts: 74 Location: Boston
|
|
|
|
Considering that the LRECL of the input file is 80, your step should look something like this..
Code: |
//STEP003 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
DYNAM1,'1108300000'
//SORTIN DD * <-- INPUT FILE
//SORTOUT DD DSN= <-- OUTPUT FILE
//SYSIN DD *
SORT FIELDS=COPY
INREC OVERLAY=(81:DYNAM1)
OUTREC OVERLAY=(91:81,10,SFF,TO=PD,LENGTH=6)
OUTFIL BUILD=(1,80),INCLUDE=(43,6,PD,GT,91,6,PD)
|
And you can have the symname coded as a file and have the value changed when needed and then the job run. And if you can get the value in the symname file itself as a PD, then you can do away with the OUTREC statement in the sysin card.
Thanks,
Ashwin. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If the date contains the digits needed for the comparison, the symbol can be used directly on the INCLUDE, and no need for the INREC, OUTREC or BUILD. You'd need to take the "'"s off for a numeric constant. |
|
Back to top |
|
|
hailashwin
New User
Joined: 16 Oct 2008 Posts: 74 Location: Boston
|
|
|
|
Thanks Bill, I did not know it was this simple.
I was having trouble getting a numeric value on the include statement. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Well, you got to a work-around, so shows initiative.
However, when something doesn't work that you think should, it is always worth checking in the manuals. |
|
Back to top |
|
|
dilip_bangalore
New User
Joined: 29 Sep 2011 Posts: 27 Location: India
|
|
|
|
Hi ashwin / Bill,
I do not want to change any file or any value in symnames and run the job. I am trying to use some parameters which will consider the current date of the system and then do some math to create exactly 1 year past date. This way there is no need to do any manipulations before each run.
Please do let me know if we got any such logics in sort product..
Thanks for your valuable inputs. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Why would you want to do that?
It means, when it runs, it has to run before midnight, else the calculation will be wrong.
It means you can't re-run it on a different day.
It means for any type of testing you have to override the system date.
Whereas, if you have a proper business-date/data-date (tipping hat to Phr... er.. Phil there) file then you don't have to worry about anything (except getting some good code to make it run smoothly).
You want to flail about with random "one year less than when I ran" values, feel completely free to consult your Syncsort documentation. Search the forum. Search the web. |
|
Back to top |
|
|
dilip_bangalore
New User
Joined: 29 Sep 2011 Posts: 27 Location: India
|
|
|
|
Yes Bill, thats your solution certainly ensures smooth run..
But I would have to schedule this job to run every month at a particular time.. No adhoc run would be made in production. This way we can try to avoid those fails. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You can get the current date from the system using your sort product.
You can also subtract 1 year from this.
Use these 2 values to set the SYMNAMES.
It is all automagic and there will be no manual intervention.
You may need to consider how to handle the situation where the run is NOT for Today. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
dilip_bangalore wrote: |
Yes Bill, thats your solution certainly ensures smooth run..
But I would have to schedule this job to run every month at a particular time.. No adhoc run would be made in production. This way we can try to avoid those fails. |
How do you do your testing? How do you do a re-run? What happens if the batch is very late and your data is not available until the "next" day?
OK, forgetting the business/data date file, go for the simple generation/maintenance of a SYMNAMES file.
Otherwise, you change one lot of manual intervention, simply getting the correct date onto a file of some type, every time the job is shceduled, for another, which is messing-about in an unusual situation. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
No adhoc run would be made in production. This way we can try to avoid those fails.
|
|
|
Back to top |
|
|
|