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 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 Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am
No new posts How to Generate JCL using Sort naveen katkuri DFSORT/ICETOOL 7 Tue Mar 13, 2018 3:50 pm
No new posts Find a string in PS file opened in br... mukkas CLIST & REXX 3 Sat Feb 24, 2018 2:15 pm
No new posts Unloading DB2 table in CSV format alo... grvtomar COBOL Programming 7 Sun Jan 28, 2018 2:05 am
No new posts XML Generate with Attribute & Ele... Log Thangavel COBOL Programming 5 Fri Jan 19, 2018 6:21 pm

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