|
View previous topic :: View next topic
|
| Author |
Message |
Suganya87
New User
Joined: 09 May 2016 Posts: 12 Location: India
|
|
|
|
| Code: |
//SYMNAMES DD *
CURDATE,S'&YR4.-&MON.-18'
PREDATE,S'&LYR4.-&LMON-17'
/*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN= dsn name
//SORTOUT DD DSN=dsn name1,
// DISP=(NEW,DELETE,DELETE),
// SPACE=(CYL,(10,05)),MGMTCLAS=LUSE180,
// DCB=(RECFM=FB,LRECL=58,BLKSIZE=5800)
//SYSIN DD *
INCLUDE COND=(001,10,CH,GE,CURDATE,&,
001,10,CH,LE,PREDATE,PM)
SORT FIELDS=(1,04,CH,A)
END
/*
|
My requirement is to get the details from 17 of previous month to 18th of current month . Can you please help me how to get previous month details in SYMNAMES.
Edited typo in topic title. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| If you don't already have a "calendar file" (dates you need for your system) to generate from, then just generate the symbols you need in a prior step, so you can "calculate" the start of your range. |
|
| Back to top |
|
 |
Suganya87
New User
Joined: 09 May 2016 Posts: 12 Location: India
|
|
|
|
Hi bill,
I got the calendar dates from CURDATE using "SYMNAMES" but am not sure how to calculate the previous month date (PREDATE) PREDATE,S'&LYR4.-&LMON-17'
using "SYMNAME" . Can you please let me know how to achieve the same.
Thanks |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| There are date functions. Those may be the simplest ways to work out month-and-year of previous month. Apply those to your source-date, hard-code the 17/18 (so that it works) and generate the symbols with the values you need for the run. |
|
| Back to top |
|
 |
Suganya87
New User
Joined: 09 May 2016 Posts: 12 Location: India
|
|
|
|
| Can you please post me the date function code, because I tried it with different function, nothing is working out . Please help me on this . |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| We can best help if you show what you tried and the results of that. Input and expected output, and what you got, including error messages (with codes). |
|
| Back to top |
|
 |
dneufarth
Active User

Joined: 27 Apr 2005 Posts: 420 Location: Inside the SPEW (Southwest Ohio, USA)
|
|
|
|
What about rerun situations for prior periods or testing scenario.
Always needed eventually.
Always like the run date seeded in a dataset or calendaring dataset as mentioned previously. |
|
| Back to top |
|
 |
John Del
New User

Joined: 27 Apr 2012 Posts: 42 Location: NY
|
|
|
|
| dneufarth wrote: |
What about rerun situations for prior periods or testing scenario.
Always needed eventually.
Always like the run date seeded in a dataset or calendaring dataset as mentioned previously. |
Agreed.
When implementing sort parameters with include/omit date dependencies, I like to use symbolic parameters that can be manually configured via set/proc statements (JPn) overrides when needed. Whether this particular solution is meant for production or not, sooner or later you will come across a situation that you'll benefit by building in the JPn feature.
Don't quote me on this as I am not a Syncsort user but I think newer Syncsort releases now support JPn symbolic parameters.
My recommendation for the OP would be to see what release of Syncsort they have, consult the documentation and if available, consider a solution that leverages symbolic parameters.
J |
|
| Back to top |
|
 |
mistah kurtz
Active User
Joined: 28 Jan 2012 Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
|
|
|
|
| I'm using SYNCSORT FOR Z/OS 1.4.2.0R. It supports JPn symbolic parameters. |
|
| Back to top |
|
 |
John Del
New User

Joined: 27 Apr 2012 Posts: 42 Location: NY
|
|
|
|
| mistah kurtz wrote: |
| I'm using SYNCSORT FOR Z/OS 1.4.2.0R. It supports JPn symbolic parameters. |
In that case, here is an option for the OP to consider if they also have JPn support in their Syncsort version. I use a variation of this all the time (DFSORT) to convert Gregorian parm dates to Julian dates for comparison.
| Code: |
// SET BEGDATE='20160101',ENDDATE='20160330'
//*SET BEGDATE='CCYYMMDD',ENDDATE='CCYYMMDD'
//********************************************************
//* GENERATE SYMBOLICS FOR BEGIN & END DATE PARMS
//********************************************************
//STEP0010 EXEC PGM=SORT,PARM=('JP0"&BEGDATE"','JP1"&ENDDATE"')
//SYMNAMES DD DISP=SHR,DSN=&SYMBLIB(SYMCONST)
// DD *
BEG-DAY,'17'
END-DAY,'18'
//SYMNOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD *
CCYYMMDD MMDDCCYY CCYYDDD
//DATEPARM DD DSN=&&S,DISP=(,PASS,DELETE),UNIT=SYSDA,SPACE=(TRK,(1,1))
//DATEPARX DD SYSOUT=*
//SYSIN DD *
OPTION COPY,STOPAFT=1
* EDIT TO SEE IF THERE IS A PARM DATE OVERRIDE,
* OTHERWISE USE CURRENT DATE FOR DEFAULT
INREC IFOUTLEN=80,
IFTHEN=(WHEN=(1,8,CH,NE,JP0),
OVERLAY=(01:JP0,01:01,8,Y4T,TOGREG=Y4T(-),
11:JP1,11:11,8,Y4T,TOGREG=Y4T(-)),HIT=NEXT),
IFTHEN=(WHEN=(1,8,CH,EQ,JP0),
OVERLAY=(01:DATE2-1,BEG-DAY,01:01,8,Y4T,TOGREG=Y4T(-),
11:DATE2,END-DAY,11:11,8,Y4T,TOGREG=Y4T(-)))
* BUILD THE SYMBOLICS USED BY SUBSEQUENT SORT STEPS
*
OUTFIL FNAMES=(DATEPARM,DATEPARX),
BUILD=(C'BEG-DATE,C',Q,01,10,Q,80:X,/,
C'END-DATE,C',Q,11,10,Q,80:X)
/* |
J |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|