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
 

 

How to generate Past Datecharacter string in format mm/dd/yy

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

New User


Joined: 24 Aug 2006
Posts: 4

PostPosted: Thu Sep 14, 2006 6:21 pm    Post subject: How to generate Past Datecharacter string in format mm/dd/yy
Reply with quote

How to generate a Past date character string in the format mm/dd/yy relative to the current date in SORT?

Eg: Date1(/)-d will generate a past date of format yyyy/mm/dd.
Requirement is to get it in the format mm/dd/yy
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Sep 14, 2006 9:09 pm    Post subject:
Reply with quote

Quote:
Date1(/)-d will generate a past date of format yyyy/mm/dd. Requirement is to get it in the format mm/dd/yy


You can use DATE1-d to get C'yyyymmdd' and then reformat that to 'mm/dd/yy'. For example:

Code:

    OPTION COPY                           
    INREC BUILD=(DATE1-12)               
    OUTREC BUILD=(5,2,C'/',7,2,C'/',3,2) 


The exact DFSORT control statements you need depends on exactly what you're trying to do with the date.
Back to top
View user's profile Send private message
kanag

New User


Joined: 24 Aug 2006
Posts: 4

PostPosted: Thu Sep 14, 2006 11:31 pm    Post subject: Re: How to generate Past Datecharacter string in format mm/d
Reply with quote

Hi Frank,

Thanks for your reply. I need to OMIT records by comparing the date field (which is of format (mm/dd/yy) in the records with the current date. Since OMIT/ INCLUDE happens before reformating happens, I have to go for two JOB steps.

I step: Reformat the Date field.
II step: OMIT/INCLUDE the records using DATE1-d and again change the date format to original.

Can this be done in a single JOB step?
Can "&Date-d" used for this?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Sep 15, 2006 12:45 am    Post subject:
Reply with quote

Yes, you can do it in one pass with DFSORT. For example, let's say your input file is RECFM=FB and LRECL=80 and you want to compare a 'mm/dd/yy' date in positions 1-8 of your input records to the current date - 12. You could use the following DFSORT job. You can change it appropriately for other situations.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(91:DATE1-12)),
        IFTHEN=(WHEN=INIT,OVERLAY=(81:95,2,C'/',97,2,C'/',93,2))
  OUTFIL INCLUDE=(1,8,CH,EQ,81,8,CH),
    BUILD=(1,80)
/*
Back to top
View user's profile Send private message
kanag

New User


Joined: 24 Aug 2006
Posts: 4

PostPosted: Fri Sep 15, 2006 4:22 pm    Post subject: Re: How to generate Past Datecharacter string in format mm/d
Reply with quote

Hi Frank,
I am getting syntax error at
INREC IFTHEN=(WHEN=INIT,OVERLAY=(91:DATE1-12)),

Why does this happen?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Sep 15, 2006 10:07 pm    Post subject:
Reply with quote

If you're using DFSORT (ICExxxs messages), you need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DATE1-12. If you see 'ICE201I E' in //SYSOUT, you have the PTF. Otherwise, you need to ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/

If you're using DFSORT with the April, 2006 PTF and you get a syntax error for DATE1-12, show the //SYSOUT messages.
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 How to pick only YYMMDD from DATE1P (... atulbaviskar SYNCSORT 7 Wed Mar 22, 2017 11:39 am
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm


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