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
 

 

How to get previous month in SYMNAMES

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
Suganya87

New User


Joined: 09 May 2016
Posts: 12
Location: India

PostPosted: Fri Oct 28, 2016 1:37 pm    Post subject: How to get previous month in SYMNAMES
Reply with quote

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

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Oct 28, 2016 5:51 pm    Post subject: Reply to: How to get previous month in SYSNAMES
Reply with quote

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

New User


Joined: 09 May 2016
Posts: 12
Location: India

PostPosted: Mon Oct 31, 2016 3:19 pm    Post subject:
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Mon Oct 31, 2016 4:21 pm    Post subject: Reply to: How to get previous month in SYMNAMES
Reply with quote

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

New User


Joined: 09 May 2016
Posts: 12
Location: India

PostPosted: Tue Nov 01, 2016 5:50 pm    Post subject: Reply to: How to get previous month in SYMNAMES
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Tue Nov 01, 2016 8:16 pm    Post subject: Reply to: How to get previous month in SYMNAMES
Reply with quote

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

Active User


Joined: 27 Apr 2005
Posts: 236
Location: Cincinnati OH USA

PostPosted: Wed Nov 02, 2016 2:06 am    Post subject:
Reply with quote

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

New User


Joined: 27 Apr 2012
Posts: 20
Location: NY

PostPosted: Wed Nov 02, 2016 7:25 pm    Post subject:
Reply with quote

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

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Thu Nov 03, 2016 6:04 pm    Post subject:
Reply with quote

I'm using SYNCSORT FOR Z/OS 1.4.2.0R. It supports JPn symbolic parameters.
Back to top
View user's profile Send private message
John Del

New User


Joined: 27 Apr 2012
Posts: 20
Location: NY

PostPosted: Thu Nov 03, 2016 11:07 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Retrieve current year or month using ... vnktrrd DFSORT/ICETOOL 15 Tue Mar 15, 2016 4:14 pm
No new posts Find list of all TSO users who used i... newroad CA Products 2 Fri Nov 06, 2015 12:01 am
No new posts Appending previous record SEQNUM valu... selvamsrinivasan85 DFSORT/ICETOOL 6 Fri Oct 16, 2015 2:09 pm


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