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
 

 

Reformatting Problem

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Vineet

New User


Joined: 14 Sep 2005
Posts: 18

PostPosted: Wed Sep 10, 2008 8:49 pm    Post subject: Reformatting Problem
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

Site Director


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

PostPosted: Wed Sep 10, 2008 9:21 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Thu Sep 11, 2008 7:29 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Fri Sep 12, 2008 7:53 pm    Post subject:
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 Moderator


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

PostPosted: Wed Sep 17, 2008 11:23 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm


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