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

Previous Month range in sort Card


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 1702
Location: Australia

PostPosted: Thu Aug 07, 2008 3:24 pm
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: 1702
Location: Australia

PostPosted: Thu Aug 07, 2008 6:14 pm
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
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: 1702
Location: Australia

PostPosted: Fri Aug 08, 2008 11:24 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts To get the count of rows for every 1 ... DB2 3
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top