IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Passing dynamic values in SORT card using JCL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Aug 29, 2012 2:45 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Wed Aug 29, 2012 2:54 pm
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
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

Superior Member


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

PostPosted: Wed Aug 29, 2012 3:08 pm
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
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: 74
Location: Boston

PostPosted: Wed Aug 29, 2012 5:05 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Aug 29, 2012 5:33 pm
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: 74
Location: Boston

PostPosted: Wed Aug 29, 2012 6:12 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Aug 29, 2012 6:40 pm
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Aug 29, 2012 8:35 pm
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
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

Moderator Emeritus


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

PostPosted: Wed Aug 29, 2012 9:03 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Aug 29, 2012 9:12 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
Search our Forums:

Back to Top