View previous topic :: View next topic
Author
Message
Bettie HoTong New User Joined: 26 Feb 2007Posts: 3 Location: North Carolina
I am trying to convert the last 6 bytes of the 25 byte record to TT.TTT format
Input:
Code:
381426G6612101HZN9R
050632AY412101HZ8WZ2.9
57586CKH712101H0NCF2.005
773754FC512101H03VP3.85
413627AX812101H2Q7R19.596
93974CQ7812101H238T4
Output:
Code:
381426G6612101HZN9R00.000
050632AY412101HZ8WZ00.029
57586CKH712101H0NCF02.005
773754FC512101H03VP00.385
413627AX812101H2Q7R19.596
93974CQ7812101H238T00.004
These are my sort cards:
Code:
SORT FIELDS=COPY
OUTREC FIELDS=(1,19,20,6,UFF,EDIT=(TT.TTT))
Please help me, I have read the manuals, gone trough all the examples, and cannot find a similar problem.
Many Thanks!!
Back to top
vasanthz Global Moderator Joined: 28 Aug 2007Posts: 1742 Location: Tirupur, India
The sort cards,
Code:
SORT FIELDS=COPY
OUTREC FIELDS=(1,19,20,6,UFF,EDIT=(TT.TTT))
produces the output you have shown.
So what is the issue? Are you expecting some other output or is the job failing?
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
Bettie HoTong wrote:
I am trying to convert the last 6 bytes of the 25 byte record to TT.TTT format
Input:
Code:
381426G6612101HZN9R
050632AY412101HZ8WZ2.9
57586CKH712101H0NCF2.005
773754FC512101H03VP3.85
413627AX812101H2Q7R19.596
93974CQ7812101H238T4
Output:
Code:
381426G6612101HZN9R00.000
050632AY412101HZ8WZ00.029
57586CKH712101H0NCF02.005
773754FC512101H03VP00.385
413627AX812101H2Q7R19.596
93974CQ7812101H238T00.004
These are my sort cards:
SORT FIELDS=COPY
OUTREC FIELDS=(1,19,20,6,UFF,EDIT=(TT.TTT))
Please help me, I have read the manuals, gone trough all the examples, and cannot find a similar problem.
Many Thanks!!
Is the following what you would like to see?
Code:
381426G6612101HZN9R00.000
050632AY412101HZ8WZ02.900
57586CKH712101H0NCF02.005
773754FC512101H03VP03.850
413627AX812101H2Q7R19.596
93974CQ7812101H238T04.000
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Bettie,
The DFSORT control statements you show give the output you say you want.
Are you showing the expected output incorrectly (see Bill's post)? If so, you need to show me the exact output you want.
Does your input file have RECFM=FB or RECFM=VB? If RECFM=VB, then we would need to account for the 4-byte RDW in each record.
At any rate, I can't answer your question until you give me accurate information about your requirement.
Back to top
Bettie HoTong New User Joined: 26 Feb 2007Posts: 3 Location: North Carolina
All , thanks for replying!
Bill,
The output you are showing is what I need.
As you see, the 2.9 became 0.029 , I was expecting 02.900. And the 4 became 00.004 instead of 04.000.
This is FB file.
So, what am I missing ?
Thanks again for your help!
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
It's a bit more complicated than you think.
If all of your values were normalized to dd.ddd, then your control statements would work. But you have unnormalized values of d.ddd, d.d, d.ddd, dd.dd, etc, so you have to handle the various unnormalized forms.
For example, if you have b2.9bb (b for blank), UFF treats that as 29, but you want it treated as 02900. So you have to be more clever.
Here's a DFSORT job that will give you what you want:
Code:
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
381426G6612101HZN9R
050632AY412101HZ8WZ2.9
57586CKH712101H0NCF2.005
773754FC512101H03VP3.85
413627AX812101H2Q7R19.596
93974CQ7812101H238T4
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
PARSE=(%01=(ABSPOS=20,ENDBEFR=C'.',FIXLEN=2),
%02=(FIXLEN=3)),
BUILD=(1,19,20:%01,UFF,EDIT=(TT),C'.',%02)),
IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=23,IN=C' ',OUT=C'0'))
Back to top
Bettie HoTong New User Joined: 26 Feb 2007Posts: 3 Location: North Carolina
Frank
Thanks so much!!! I will try it.
Bettie
Back to top
Please enable JavaScript!