IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Reformatting Problem


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Vineet

New User


Joined: 14 Sep 2005
Posts: 20

PostPosted: Wed Sep 10, 2008 8:49 pm
Reply with quote

Hi,

I am having a Problem. I am reading a file & from File getting Date & one more field.Problem is:

1.Let say Date is 8/Sep/2008 then it is coming as 9/8/2008 & if Date is say 10/Sep/2008 then coming as 9/10/2008 & If Date is 12/Oct/2008
then date is appearing as 10/12/2008.

My Requirement:
I want to reformat the Date as MM/DD/YYYY i.e. If Month is Sept then it should appear as 09, if date is 8 should appear as 08. If Date is coming as 12/10/2008 then this should not be disturbed. My Constraint is I don't have to write COBOL Pgm. I am Using SORT not able to get the desired result.

2. Having one field, if it is having value as single digit then say '2' need to Reformat this to '02'. If value is 10 then this should not be disturbed. Field Length is 2 & I am getting said Record from File.

For the above stated problems I am writing the Record to Other File & before writing i want to Format the File.


Thanks
Kind Rgds

Vineet Anand
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Sep 10, 2008 9:21 pm
Reply with quote

Hello,

Which sort product is used on your system?

If you are not sure, run any sort and the product information will be at/near the top of the informational output.

If your system uses DFSORT, this topic will be moved to the DFSORT part of the forum. If some other sort (i.e. Syncsort), it will remain in this part of the forum.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Sep 11, 2008 12:12 pm
Reply with quote

I think your input file needs lil reformatting.
Can you paste sample input and desired output in code window that will help to answer better.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Sep 11, 2008 7:29 pm
Reply with quote

Hello,

Quote:
I think your input file needs lil reformatting.
Yes, that is what was requested. . .

Please re-read the original post.

One-digit month or day values need to be made two-digit so that all of the dates (m/dd/yyyy, mm/d/yyyy, m/d/yyyy) are 10 bytes long mm/dd/yyyy in the output.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Sep 12, 2008 4:26 pm
Reply with quote

Check if below JCL helps you
Corrections are welcome..
Code:

//SORTIN DD *                             
3/13/2008                                 
3/03/2008                                 
30/4/2008                                 
30/4/2008                                 
1/4/2008                                 
03/04/2008                               
03/04/2008                               
/*                                       
//SYSIN    DD    *                       
  SORT FIELDS=COPY                       
  INREC IFTHEN=(WHEN=(2,1,CH,EQ,C'/'),   
                 BUILD=(1:C'0',2:1,9)),
        IFTHEN=(WHEN=(5,1,CH,EQ,C'/'),   
                 BUILD=(1,3,4:C'0',5:4,6))
  OUTREC IFTHEN=(WHEN=(5,1,CH,EQ,C'/'),   
                 BUILD=(1,3,4:C'0',5:4,6))
/*

Output will be
Code:

03/13/2008 
03/03/2008 
30/04/2008 
30/04/2008 
01/04/2008 
03/04/2008 
03/04/2008 
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Sep 12, 2008 7:53 pm
Reply with quote

Hello,

Looks good - thanks for posting icon_smile.gif

Maybe Vineet will send an update confirming your code works for their requirement. . .
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Sep 17, 2008 11:23 pm
Reply with quote

Vineet,

You can use a DFSORT job like this 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
  INREC PARSE=(%01=(ENDBEFR=C'/',FIXLEN=2),
               %02=(ENDBEFR=C'/',FIXLEN=2),
               %03=(FIXLEN=4)),
  BUILD=(%01,UFF,EDIT=(TT),C'/',
         %02,UFF,EDIT=(TT),C'/',
         %03)
/*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts z/vm installation problem All Other Mainframe Topics 0
No new posts Job scheduling problem. JCL & VSAM 9
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Need to add field to copybook, proble... COBOL Programming 14
Search our Forums:

Back to Top