View previous topic :: View next topic
|
Author |
Message |
NeeluJoshi
New User
Joined: 12 Dec 2007 Posts: 8 Location: Florida
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
NeeluJoshi
New User
Joined: 12 Dec 2007 Posts: 8 Location: Florida
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You seem to be mixing apples and oranges now.
Your 5-character input field has:
How do you get a "normalized" 5-character output field from that?
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 |
|
|
NeeluJoshi
New User
Joined: 12 Dec 2007 Posts: 8 Location: Florida
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
NeeluJoshi
New User
Joined: 12 Dec 2007 Posts: 8 Location: Florida
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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.
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 |
|
|
NeeluJoshi
New User
Joined: 12 Dec 2007 Posts: 8 Location: Florida
|
|
|
|
Thanks that works,
I appreciate your help. |
|
Back to top |
|
|
|