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
 

 

Passing dynamic values in SORT card using JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
dilip_bangalore

New User


Joined: 29 Sep 2011
Posts: 27
Location: India

PostPosted: Wed Aug 29, 2012 2:38 pm    Post subject: Passing dynamic values in SORT card using JCL
Reply with quote

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

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Wed Aug 29, 2012 2:45 pm    Post subject: Reply to: Passing dynamic values in SORT card using JCL
Reply with quote

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

New User


Joined: 29 Sep 2011
Posts: 27
Location: India

PostPosted: Wed Aug 29, 2012 2:49 pm    Post subject: Passing dynamic values in SORT card using JCL
Reply with quote

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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Aug 29, 2012 2:54 pm    Post subject: Reply to: Passing dynamic values in SORT card using JCL
Reply with quote

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Aug 29, 2012 2:58 pm    Post subject:
Reply with quote

deleted by dbz, repeat of enrico's post (well, not quite, but sorta)
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Aug 29, 2012 3:08 pm    Post subject:
Reply with quote

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

New User


Joined: 29 Sep 2011
Posts: 27
Location: India

PostPosted: Wed Aug 29, 2012 3:10 pm    Post subject: Passing dynamic values in SORT card using JCL
Reply with quote

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

New User


Joined: 16 Oct 2008
Posts: 73
Location: Boston

PostPosted: Wed Aug 29, 2012 5:05 pm    Post subject:
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Wed Aug 29, 2012 5:33 pm    Post subject: Reply to: Passing dynamic values in SORT card using JCL
Reply with quote

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

New User


Joined: 16 Oct 2008
Posts: 73
Location: Boston

PostPosted: Wed Aug 29, 2012 6:12 pm    Post subject:
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Wed Aug 29, 2012 6:40 pm    Post subject: Reply to: Passing dynamic values in SORT card using JCL
Reply with quote

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

New User


Joined: 29 Sep 2011
Posts: 27
Location: India

PostPosted: Wed Aug 29, 2012 8:27 pm    Post subject: ┬áPassing dynamic values in SORT card using JCL
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Wed Aug 29, 2012 8:35 pm    Post subject: Reply to: Passing dynamic values in SORT card using JCL
Reply with quote

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

New User


Joined: 29 Sep 2011
Posts: 27
Location: India

PostPosted: Wed Aug 29, 2012 9:01 pm    Post subject: Passing dynamic values in SORT card using JCL
Reply with quote

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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Aug 29, 2012 9:03 pm    Post subject:
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Wed Aug 29, 2012 9:12 pm    Post subject: Re: Passing dynamic values in SORT card using JCL
Reply with quote

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Aug 29, 2012 9:15 pm    Post subject:
Reply with quote

Quote:
No adhoc run would be made in production. This way we can try to avoid those fails.


2014.gif 36_11_6.gif 12.gif 36_11_6.gif 2020.gif
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am


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