Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Arithmatic in JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
lalitha.rayala5

New User


Joined: 25 Aug 2010
Posts: 10
Location: Bangalore, India

PostPosted: Fri Oct 22, 2010 3:53 pm    Post subject: Arithmatic in JCL
Reply with quote

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
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Oct 22, 2010 4:01 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8118
Location: East Dubuque, Illinois, USA

PostPosted: Fri Oct 22, 2010 4:03 pm    Post subject:
Reply with quote

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
View user's profile Send private message
lalitha.rayala5

New User


Joined: 25 Aug 2010
Posts: 10
Location: Bangalore, India

PostPosted: Fri Oct 22, 2010 4:10 pm    Post subject: Reply to: Arithmatic in JCL
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Oct 22, 2010 4:14 pm    Post subject:
Reply with quote

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
View user's profile Send private message
lalitha.rayala5

New User


Joined: 25 Aug 2010
Posts: 10
Location: Bangalore, India

PostPosted: Fri Oct 22, 2010 4:15 pm    Post subject: Reply to: Arithmatic in JCL
Reply with quote

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
View user's profile Send private message
lalitha.rayala5

New User


Joined: 25 Aug 2010
Posts: 10
Location: Bangalore, India

PostPosted: Fri Oct 22, 2010 4:38 pm    Post subject: Reply to: Arithmatic in JCL
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Oct 22, 2010 5:04 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Oct 22, 2010 10:48 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Oct 26, 2010 5:01 am    Post subject:
Reply with quote

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
Code:

2002123120040101



For complete details of date arithmetic functions and other new functions see "User Guide for DFSORT PTFs UK90025 and UK90026" paper (sortugph.pdf) at:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Getting spaces in between while doing... useit DFSORT/ICETOOL 11 Wed Sep 28, 2011 4:31 pm
No new posts S0C7 ABEND when no arithmatic statment Terry Heinze ABENDS & Debugging 26 Sun Dec 07, 2008 12:30 am
No new posts Is it possible to do arithmatic opera... siva102 DFSORT/ICETOOL 5 Tue Jun 24, 2008 12:12 pm
No new posts Edited numeric variable cannot be use... sameet83 COBOL Programming 7 Thu Dec 07, 2006 2:28 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us