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
 

 

Previous Month range in sort Card

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

New User


Joined: 18 Mar 2007
Posts: 44
Location: New Jersey,USA

PostPosted: Thu Aug 07, 2008 2:08 pm    Post subject: Previous Month range in sort Card
Reply with quote

Hi ,
Is There any method to determine the Previous Month Range in Sort ,
ie , i need to obtain the Records from my input file whose transactions were posted in the last one month alone...
Ex..
If Current RUn date is 07-August 2008
Then i should extract records with dates for the previous month which is 01-July-2008 to 31-july-2008 and not as 07-july-2208 till current date!!!
similarly if current run date is March , then i should extract records for the Feb Month..which means 01-02-2008 to 29-02-2008...

All this Dynamically...

More importantly is knowing the Range od the previuos month rather than the day in the previous month....

Thanks ....
Back to top
View user's profile Send private message

gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Thu Aug 07, 2008 3:24 pm    Post subject:
Reply with quote

Hi,

can you show the record layout ?


Gerry
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Thu Aug 07, 2008 6:14 pm    Post subject:
Reply with quote

If you select the month and year, it will cover all the days for that month.


Gerry
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Aug 08, 2008 2:56 am    Post subject: Reply to: Previous Month range in sort Card
Reply with quote

VIGNRSH,

The following DFSORT JCL will give you the desired results. I assumed that your input is FB and 80 bytes in length. I assumed that your input is DD-MM-CCYY format.

Using INREC we add last month first date using Date2-1 (ccyymmdd) and current date(ccyymmdd) using Date1 and reformat the input file date to CCYYMMDD and now using an include cond on outfil we pick the date range records


Code:

//STEP0100 EXEC PGM=ICEMAN                           
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD *                                     
01-04-2007                                           
01-07-2008                                           
02-07-2008                                           
03-07-2008                                           
04-07-2008                                           
05-07-2008                                           
01-08-2008                                           
02-08-2008                                           
03-08-2008                                           
04-08-2008                                           
12-08-2008                                           
//SORTOUT  DD SYSOUT=*                               
//SYSIN    DD *                                     
  SORT FIELDS=COPY                                   
  INREC OVERLAY=(81:DATE2-1,C'01',DATE1,7,4,4,2,1,2)
  OUTFIL BUILD=(01,80),                             
  INCLUDE=(97,8,ZD,GE,81,8,ZD,AND,97,8,ZD,LE,89,8,ZD)
/*
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Aug 08, 2008 11:24 am    Post subject:
Reply with quote

Here is another way and I think it's simpler, build the SYSIN paramter first and input it into step2
Code:
//STEP1    EXEC  PGM=ICEMAN                                       
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                   
REC                                                               
/*                                                               
//SORTOUT  DD DSN=&&C1,DISP=(,PASS,DELETE),UNIT=SYSDA,           
//            SPACE=(TRK,(1))                                     
//SYSIN    DD    *                                               
  OPTION COPY                                                     
  OUTREC OVERLAY=(81:DATE2-1,                                     
                  01:C'  INCLUDE COND=(3,8,CH,EQ,C''',           
                  C'-',85,2,C'-',81,4,C''')')                     
 OUTFIL BUILD=(01,80)                                             
/*                                                               
//STEP2    EXEC PGM=ICEMAN                                       
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                   
01-04-2007                                                       
01-07-2008                                                       
02-07-2008                                             
03-07-2008                                             
04-07-2008                                             
05-07-2008                                             
01-08-2008                                             
02-08-2008                                             
03-08-2008                                             
04-08-2008                                             
12-08-2008                                             
/*                                                     
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                     
/*                                                     
//         DD DSN=&&C1,DISP=(OLD,DELETE)               



Gerry
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 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
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 How to get previous month in SYMNAMES Suganya87 SYNCSORT 9 Fri Oct 28, 2016 1:37 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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