Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to get the previous month records alone......?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
sabarikanth

New User


Joined: 07 Jun 2010
Posts: 59
Location: coimbatore

PostPosted: Sat Apr 23, 2011 5:46 am    Post subject: How to get the previous month records alone......?
Reply with quote

Hi

Input:
Code:

 ----+----1----+----2----+----3----+----4----+----5----+----6
 |001002404                    00002             12/01/11 | 
 |123456789                    00002             01/05/10 | 
 |001002404                    00002             05/31/09 | 
 |123456789                    00002             12/15/10 | 
 |123456789                    00002             03/22/11 | 
 |123456789                    00002             04/22/11 | 


i'm checking the date in input(49th position-mm/dd/yy) with the current date(yymmdd).
Input record length 62
output record length 150

i could use SYNCSORT Z/OS 1.3.1.0.....

1.I need the records of the previous month ie if current month is march of 2011 then i need records of feb 2011.
2. If current month is jan of 2011 then i need dec 2010 records.

i used code like this,

Code:

//SORT1 EXEC PGM=SORT                             
//SORTIN  DD DSN=INPUT.FILE,DISP=SHR               
//SORTOUT DD DSN=OUTPUT.FILE1,DISP=SHR             
//SYSOUT  DD SYSOUT=*                             
//SYSIN   DD *                                     
 SORT FIELDS=COPY                                 
 OUTREC IFTHEN=(WHEN=INIT,                         
        OVERLAY=(60:&DATENS=(YMD))),               
        IFTHEN=(WHEN=(60,2,CH,EQ,55,2,CH),         
        OVERLAY=(60:62,2,ZD,SUB,+1,EDIT=(TTTTTT)))
/*                                                 
//SORT3 EXEC PGM=SORT                             
//SORTIN  DD DSN=OUTPUT.FILE1,DISP=SHR             
//SORTOUT DD DSN=OUTPUT.FILE2,DISP=SHR             
//SYSOUT  DD SYSOUT=*                             
//SYSIN   DD *                                     
 SORT FIELDS=COPY                                 
 OUTREC FIELDS=(1,59)                             
 INCLUDE COND=(49,2,CH,EQ,64,2,CH)                 
/*                                                                                               


i could get the answer for my first point. But how to get the answer for my second point.
Is ter any simpler way that i could use instead of the above code.....?
output i got
Code:

 ----+----1----+----2----+----3----+----4----+----5----+----
 |123456789                    00002             03/22/11 |


let me know if you need further informations.

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

Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2285
Location: @my desk

PostPosted: Mon Apr 25, 2011 3:02 pm    Post subject:
Reply with quote

The below Syncsort 1.3.2 sort does what you're trying to achieve.
Code:
//STEP01A  EXEC PGM=SORT                           
//SORTIN   DD  DSN= Input file   FB/LRECL=62       
//SYSOUT   DD  SYSOUT=*                           
//SORTOUT  DD  DSN= Output file  FB/LRECL=62       
//SYSIN    DD  *                                   
  OPTION COPY                                     
  INREC OVERLAY=(63:DATE2-1,55,2,49,2)             
  OUTFIL INCLUDE=(65,4,CH,EQ,69,4,CH),BUILD=(1,62)
Back to top
View user's profile Send private message
sabarikanth

New User


Joined: 07 Jun 2010
Posts: 59
Location: coimbatore

PostPosted: Mon Apr 25, 2011 11:58 pm    Post subject: Reply to: How to get the previous month records alone......?
Reply with quote

Thanks Arun. it works....!!!

But i have a doubt. whether this code works when there is a year change...?

If suppose year changes from 2011 to 2012. Whether this code picks 2011's december's records....?

Thanks,
Sab.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2285
Location: @my desk

PostPosted: Tue Apr 26, 2011 12:44 am    Post subject:
Reply with quote

Quote:
If suppose year changes from 2011 to 2012
You could wait a few more months to find this out yourself icon_lol.gif

DATE2 gives you the current year/month in CCYYMM format and subtracting 1 from it gives you the previous month nomatter which month you're in currently. I have already run a test by setting current date somewhere in Jan 2011 and found it to be working fine.
Back to top
View user's profile Send private message
sabarikanth

New User


Joined: 07 Jun 2010
Posts: 59
Location: coimbatore

PostPosted: Tue Apr 26, 2011 12:49 am    Post subject: Reply to: How to get the previous month records alone......?
Reply with quote

Quote:
You could wait a few more months to find this out yourself
.

its too long. icon_eek.gif

Thanks Arun....!!
Greatly appreciated.... icon_biggrin.gif

Regards,
Sab.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2285
Location: @my desk

PostPosted: Tue Apr 26, 2011 1:10 am    Post subject:
Reply with quote

You're welcome icon_smile.gif
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts it is possible output a SET value fro... Martylin JCL & VSAM 5 Fri Sep 22, 2017 7:08 am
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us