DFSORT: get the Yesterday date

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
simo78
Member
Posts: 35
Joined: Tue Aug 11, 2009 12:20 am
Location: Munich

DFSORT: get the Yesterday date

Post by simo78 » Fri Nov 09, 2012 4:43 pm

Hi,

is it possibile with DFSORT to get the Yesterday date
in format DD.MM.YYMM?

Can you plese help on this.

Thanks

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Fri Nov 09, 2012 4:51 pm

YYMM?

Yes. Whenever you need a format which is not directly supported, you just need to rearrange the data from the closest format that you can find. Have a look at the manual for date processing.

simo78
Member
Posts: 35
Joined: Tue Aug 11, 2009 12:20 am
Location: Munich

Post by simo78 » Fri Nov 09, 2012 5:26 pm

Hi William,

sorry I meant:

DD.MM.YY

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Fri Nov 09, 2012 5:51 pm

Well, same thing. Have a look at the date formats in the manual. If not an exact one, there will be one which you can use then "change" to look exactly how you want.

Look at the Smart Tricks, google for date and DFSORT, search here, etc.

simo78
Member
Posts: 35
Joined: Tue Aug 11, 2009 12:20 am
Location: Munich

DFSORT: get the Yesterday date

Post by simo78 » Tue Nov 13, 2012 1:15 pm

Hi again,
I looked at the Smart Tricks, seached and I got what I want:

Code: Select all

//STEP0    EXEC PGM=SORT                                          
//SYSOUT   DD SYSOUT=*                                            
//SORTIN   DD *                                                   
DUMMY                                                             
//SORTOUT  DD DSN=&&TMP1,DISP=(,PASS)                             
//SYSIN    DD *                                                   
  OUTREC BUILD=(DATE1)                                            
//*                                                               
//STEP1    EXEC PGM=SORT                                          
//SYSOUT   DD SYSOUT=*                                            
//SORTIN   DD DSN=*.STEP0.SORTOUT,DISP=(OLD,DELETE)               
//SORTOUT  DD SYSOUT=*                                            
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                                
  INREC OVERLAY=(1,8,Y4T,ADDDAYS,-1,TOGREG=Y2T(.))
My question is: is it possible to do this in one step?

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Tue Nov 13, 2012 3:43 pm

Try with this:

Code: Select all

  INREC OVERLAY=(1:DATE1,1:1,8,Y4T,ADDDAYS,-1,TOGREG=Y2T(.))

simo78
Member
Posts: 35
Joined: Tue Aug 11, 2009 12:20 am
Location: Munich

DFSORT: get the Yesterday date

Post by simo78 » Tue Nov 13, 2012 4:29 pm

THANKS A LOT!

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others