MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Date Format Conversion

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Siddheart22
Beginner


Joined: 11 Apr 2005
Posts: 42
Topics: 19
Location: India

PostPosted: Fri Jun 10, 2005 5:09 pm    Post subject: Date Format Conversion Reply with quote

Hi all,

I have a date field in the input file as:
01 IN-DATE-FORMAT PIC S9(07)V COMP-3.

The seven digits of the date field are:
Digit Description
1 Century (1 means 20th Century, 0 means 19th Century)
2-3 Year (00-99)
4-5 Month (01-12)
6-7 Day (01-31)

Now, I want to convert this date field to a 10 byte date field which should have the following format:
01 OUT-DATE-FORMAT.
10 CCYY PIC X(04).
10 FILLER PIC X(01) VALUE '-'
10 MM PIC X(02).
10 FILLER PIC X(01) VALUE '-'
10 DD PIC X(02).

Is it possible to use SORT utility to achieve the above?

Thanks,
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Jun 10, 2005 6:03 pm    Post subject: Reply with quote

You can use the following DFSORT job to do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
* Convert X'cyymmdds' to C'cyymmdd'
  INREC FIELDS=(1,4,PD,TO=ZD)
* Convert C'cyymmdd' to C'ccyy-mm-dd'
  OUTREC FIELDS=(1,1,CHANGE=(2,C'1',C'20',C'0',C'19'),NOMATCH=(C'**'),
     2,2,C'-',4,2,C'-',6,2)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group