View previous topic :: View next topic
|
Author |
Message |
lalitha.rayala5
New User
Joined: 25 Aug 2010 Posts: 10 Location: Bangalore, India
|
|
|
|
Actaully there is a job which runs yearly once. The program which runs in this job will delete some records from database for the year passed from the input file. Input file is hardcoded manually once. So I want to change the jcl in such a way that it should be able to increment the year each time it runs successfully in the input file passed. Please let me know how to do this. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
You will need to learn to say exactly what it is that you want to achieve here.
Do you want a job (NOT a JCL) to change the data in a file, or do you want a job to change something within the JCL of another job to show a different year.
Once we actually know what it is that you want, we will be better placed to try and help you. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Change the program code so if no year is input, it uses the current (or previous -- whatever works for your job) year based on the system date.
JCL executes programs -- and that is all it does. You cannot create JCL to automatically increment a variable in a file because JCL cannot do that. You could do that with a job scheduler, or you can change the program, but as you stated your request it cannot be done. |
|
Back to top |
|
|
lalitha.rayala5
New User
Joined: 25 Aug 2010 Posts: 10 Location: Bangalore, India
|
|
|
|
I want a job (say suppose job12345) which increments the year in one of its input file each time it runs (I mean input file to one of its programs which runs in job12345) Hope this is clear. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
OK, that is now clear.
Depending on the information in the input file, could this be accomplished by using a schedular variable, or is the input data complex.
If the input data is a simple date then a schedular variable is the easiest way to go. Else a program to run in a previous step if the data is more complex. |
|
Back to top |
|
|
lalitha.rayala5
New User
Joined: 25 Aug 2010 Posts: 10 Location: Bangalore, India
|
|
|
|
Robert,
I hope we can do it using OUTREC. But dont know the correct syntax to do that . Let me know if I am wrong. |
|
Back to top |
|
|
lalitha.rayala5
New User
Joined: 25 Aug 2010 Posts: 10 Location: Bangalore, India
|
|
|
|
Data in input file is 2001123120030101
expected ouput is 2002123120040101 (which should increment 2001 and 2003 from input)
I am using syntax as below
Code: |
//SYSIN DD *
OPTION COPY
OUTREC FIELDS=(1:1,4,ZD,ADD,+1,LENGTH=4,5:5,4,9:(9,4,ZD,ADD,+1),
LENGTH=4,13:13,4) |
Output i am getting from the above syntax is 002 1231004 0101. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
A quick REXX jobbie - Briefly tested
Code: |
/* REXX *** INCREMENT DATES */
"EXECIO 1 DISKR DDname ( FINIS"
PULL REC
REC = OVERLAY(SUBSTR(REC,1,4)+1,REC,1)
REC = OVERLAY(SUBSTR(REC,9,4)+1,REC,9)
PUSH REC
"EXECIO 1 DISKW DDname ( FINIS" |
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Lalitha,
Your editting is wrong for what you want. You are using the M0 edit mask by default which isn't what you want. You can use these DFSORT control statements:
Code: |
OPTION COPY
OUTREC OVERLAY=(1:1,4,ZD,ADD,+1,EDIT=(TTTT),
9:9,4,ZD,ADD,+1,EDIT=(TTTT))
|
|
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
With PTF UK90025 for z/OS DFSORT V1R10 and PTF UK90026 for z/OS DFSORT V1R12(Oct, 2010), DFSORT now supports date arithmetic which can add/subtract days, months or years to a given date like shown below.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----
2001123120030101
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC OVERLAY=(1,8,Y4T,ADDYEARS,+1,TOGREG=Y4T,
9,8,Y4T,ADDYEARS,+1,TOGREG=Y4T)
//* |
The output from the above is
For complete details of date arithmetic functions and other new functions see "User Guide for DFSORT PTFs UK90025 and UK90026" paper (sortugph.pdf) at:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242 |
|
Back to top |
|
|
|