Comparing packed date fields with current date

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

Moderators: Frank Yaeger, Moderator Group

Post Reply
Rajeshk.sakthivel
Member
Posts: 6
Joined: Wed Mar 16, 2011 8:20 pm
Location: London

Comparing packed date fields with current date

Post by Rajeshk.sakthivel » Wed Oct 05, 2011 8:14 pm

Hi,

I have the following problem,

In my input file the fields 1-4 contains date stored as a packed field.

P'0011273C'

YYDDD format

I want to select all the records where the value in this field is equal to the current date.

Thanks for your help in advance.

Thanks.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Wed Oct 05, 2011 9:58 pm

You can use DFSORT control statements like the following:

Code: Select all

  OPTION COPY,Y2PAST=1990                       
  INCLUDE COND=(2,3,Y2U,EQ,Y'DATE3')            
Note that we are ignoring the X'00' in the first byte since it has no relevance to the P'yyddd' date.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

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