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 columns

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

New User


Joined: 12 Dec 2007
Posts: 8
Location: Florida

PostPosted: Thu Dec 13, 2007 9:57 pm    Post subject: Reformatting columns
Reply with quote

Hi,

I have a input file that looks like

12345678901234567890123456789012 - column positions
TX 1000.000036509/19/20075.449Aaa
TX 1000.000036003/12/2003 5.6Aaa
TX 1000.000036003/12/2003 6.31Aaa
TX 1000.000036006/17/2003 6.3Aaa
TX 1000.000036007/02/20036.445Aa2
TX 1000.000036009/26/2003 5.75Aaa

I want to format the field(5 char) starting at column 26, so that the result looks like

12345678901234567890123456789012 - column positions
TX 1000.000036509/19/20075.449Aaa
TX 1000.000036003/12/20035.600Aaa
TX 1000.000036003/12/20036.310Aaa
TX 1000.000036006/17/20036.300Aaa
TX 1000.000036007/02/20036.445Aa2
TX 1000.000036009/26/20035.750Aaa

For clarity, here's the input file without colors:

Code:

12345678901234567890123456789012 - column positions
TX   1000.000036509/19/20075.449Aaa
TX   1000.000036003/12/2003  5.6Aaa
TX   1000.000036003/12/2003 6.31Aaa
TX   1000.000036006/17/2003  6.3Aaa
TX   1000.000036007/02/20036.445Aa2
TX   1000.000036009/26/2003 5.75Aaa


Please let me know how can i do this.

Thanks,
Neelu Joshi
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 Dec 13, 2007 11:33 pm    Post subject:
Reply with quote

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

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
TX   1000.000036509/19/20075.449Aaa
TX   1000.000036003/12/2003  5.6Aaa
TX   1000.000036003/12/2003 6.31Aaa
TX   1000.000036006/17/2003  6.3Aaa
TX   1000.000036007/02/20036.445Aa2
TX   1000.000036009/26/2003 5.75Aaa
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  ALTSEQ CODE=(40F0)
  INREC OVERLAY=(28:28,5,JFY=(SHIFT=LEFT),
    28:28,5,TRAN=ALTSEQ)
/*
Back to top
View user's profile Send private message
NeeluJoshi

New User


Joined: 12 Dec 2007
Posts: 8
Location: Florida

PostPosted: Fri Dec 14, 2007 12:43 am    Post subject:
Reply with quote

Thanks a lot for help.

That works if I want to pad zeroes towards one side. What if I have something like (2 digits before decimal)

12345678901234567890123456789012 - column positions
TX 1000.000036509/19/20075.449Aaa
TX 1000.000036003/12/2003 15.6Aaa
TX 1000.000036003/12/2003 6.31Aaa
TX 1000.000036006/17/2003 26.3Aaa
TX 1000.000036007/02/20036.445Aa2
TX 1000.000036009/26/2003 5.75Aaa
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 Dec 14, 2007 1:48 am    Post subject:
Reply with quote

You seem to be mixing apples and oranges now.

Your 5-character input field has:

Code:

5.449
 15.6


How do you get a "normalized" 5-character output field from that?

Code:

5.449
15.60


certainly wouldn't line up the decimal point like your original example did.

Exactly what type of values can you have in that 5 character input field and what output values would you expect? I'd rather not solve this for you for each new variation you choose to dole out.

And please use code tags rather than colors so we can see what the data really looks like.
Back to top
View user's profile Send private message
NeeluJoshi

New User


Joined: 12 Dec 2007
Posts: 8
Location: Florida

PostPosted: Fri Dec 14, 2007 2:30 am    Post subject:
Reply with quote

I am sorry if I have got you confused with the input values and sizes.

What I have really got is a file that will have an input field (float). The output needed is of format 9(2)V9(3). It is ok to add another (6th) character to output.

Currently, the file with me does not have 2 digits before decimal in this field. But I have been told that there is a possibility of having 1 or 2 digits before decimal and 1, 2 or 3 digits after decimal in this field. So basically I need to allign the decimal in the field to one location with padding zeroes in left and right.

I used colors/columns in order to specify which field i m exactly talking about. But here is the code if you are more comfortable with this.

Code:

1000.000036509/19/20075.449Aaa  AAA  AAA     
1000.000036003/12/2003  5.6Aaa  AAA  AAA     
1000.000036003/12/2003 6.31Aaa  AAA           
1000.000036006/17/2003  6.3Aaa  AAA  AAA     
1000.000036007/02/20036.445Aa2  AA           
1000.000036009/26/2003 5.75Aaa  AAA  AAA     
1000.000036009/26/2003  6.2Aaa  AAA  AAA     
1000.000036010/07/2003  6.0Aaa  AAA  AAA     
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 Dec 14, 2007 3:03 am    Post subject:
Reply with quote

That new input doesn't help much as it looks like your original input which I already gave you the solution for.

Show me an example of the input records with all of the variations you can have (1 or 2 digits before decimal and 1, 2 or 3 digits after decimal) and what you expect for output.
Back to top
View user's profile Send private message
NeeluJoshi

New User


Joined: 12 Dec 2007
Posts: 8
Location: Florida

PostPosted: Fri Dec 14, 2007 3:24 am    Post subject:
Reply with quote

I dont think you read my last post properly, I do not have any input values like that, but this field might have such values.

The file given as input to me is a temporary file generated from various sort steps and we definitely have possibility to increase file length in input for this field to 6. Also, this is a file that comes daily to us and the input values can have 99.999 kind of values. Currently I DO NOT have a CODE snippet for this.

That is the reason that I am asking to pad zeroes on left as well as on right. and that is the reason that I gave you examples in color format.

I am expecting the input to look like

99.999
9
9.9

and output to look like

99.999
09.000
09.900

I could not be more precise in expected input and output values. It would be great if you could help me on such anticipated values. I can do this easily through program but I am looking for a solution using DFSORT/ICETOOL. I want to know if it is possible.
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 Dec 14, 2007 4:30 am    Post subject:
Reply with quote

Quote:
I dont think you read my last post properly, I do not have any input values like that, but this field might have such values.


Yes, I did read your last post properly. What you're saying is that you don't know what the values might look like exactly, but you expect me to somehow figure it out. icon_rolleyes.gif

An example of the anticipated values was what I wanted. Sure I could have tried to guess at what you wanted, but I'm kind of busy (I have this job as a developer) so I don't see why you shouldn't do more work to get what you want rather than expecting me to do all of the work of figuring out what you want plus the solution. You may have thought you were clear, but there was some doubt in my mind as to what you wanted, so I felt it wasn't unreasonable for you to clarify the doubts.

As an example of my doubts, based on what you said previously, I would not have guessed that you could have a 1 digit value without a decimal point like the 9 that you show. I guess you could also have a 2 digit value without a decimal point.

I'm still not sure that I (or you) know all of the possible variations you're looking at, but I'll take a shot at it anyway. You can use a DFSORT job like the following. For simplicity, I assumed the 6 character field you want to reformat is in positions 2-7 and that your input file has RECFM=FB and LRECL=80. I picked some example values that might or might not cover all of the variations. If they don't, then YOU need to show me an example of a variation that doesn't give the right output value.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
A12.345B
A7     B
A26    B
A5.449 B
A  15.6B
A 6.31 B
A  26.3B
A6.445 B
A 5.75 B
A 5.1  B
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  ALTSEQ CODE=(40F0)
  INREC IFOUTLEN=80,
    IFTHEN=(WHEN=INIT,OVERLAY=(81:2,6)),
    IFTHEN=(WHEN=INIT,
      PARSE=(%01=(ABSPOS=81,STARTAT=NONBLANK,ENDBEFR=C'.',
        FIXLEN=2),
        %02=(FIXLEN=3)),
      OVERLAY=(2:%01,UFF,EDIT=(TT),4:C'.',
        5:%02,TRAN=ALTSEQ))
/*


For the example SORTIN records, the SORTOUT records would be:

Code:

A12.345B 
A07.000B 
A26.000B 
A05.449B 
A15.600B 
A06.310B 
A26.300B 
A06.445B 
A05.750B 
A05.100B 
Back to top
View user's profile Send private message
NeeluJoshi

New User


Joined: 12 Dec 2007
Posts: 8
Location: Florida

PostPosted: Fri Dec 14, 2007 9:40 pm    Post subject:
Reply with quote

Thanks that works,

I appreciate your help.
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 unload data from table with lob columns farhad_evan DB2 1 Sat Apr 22, 2017 1:32 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Combine columns without breaking words Indrajit_57 SYNCSORT 1 Sat Mar 19, 2016 9:33 am
No new posts Reformatting field, error while using... dheeraj.ramchandani DFSORT/ICETOOL 7 Thu Nov 05, 2015 8:30 pm


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