Joined: 11 Apr 2005 Posts: 42 Topics: 19 Location: India
Posted: Mon Apr 11, 2005 9:59 am Post subject: OUTREC
Hello,
Following is the problem I am facing.
I have a variable length file from which I have to extract some records and create an output file of Fixed length.
Also, there is a two byte field in the input file on position 63 (considering the 4 bytes for RDW) which is in a time field HHMM (HH - Hours, MM - Minutes) format.
I need to convert this two byte field into four bytes numeric field HHMM.
In the OUTFIL FNAMES I am converting the Variable length input file to Fixed length.
When I run this sort step, I get an output which contains the same two byte field in the HHMM format, following this field is two bytes of junk, and following it is four bytes data which looks like the numeric form of HHMM in four bytes, but still the last byte (4th byte) is junk.
Please advise on how should I accomplish this conversion of a two byte HHMM field to a four byte HHMM number field. I do not want the two byte HHMM in output again.
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Mon Apr 11, 2005 10:12 am Post subject:
Siddheart22,
what is the format of the field at pos 63 ? is it comp or comp-3? Moreover your OUTREC is copying the first 62 bytes from 5 which means you alreay included the HHMM field in your outrec as you mentioned that HHMM field is at pos 63 considering the RDW.
Joined: 11 Apr 2005 Posts: 42 Topics: 19 Location: India
Posted: Mon Apr 11, 2005 10:26 am Post subject: OUTREC
Thanks for an impromptu response.
Also, thanks for advising on the OUTREC portion, I have corrected that and now it looks like:
OUTFIL FNAMES=FB1,VTOF,OUTREC=(5,58,63,2,PD,TO=ZD,LENGTH=4,65,100)
And the output is now, the HHMM field in four bytes, I would cut paste a sample of the output record (with HEX ON) for your reference:
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Apr 11, 2005 10:34 am Post subject:
The problem is that X'1724' is not a valid PD value since the 4 is treated as a sign. You can convert your 2-byte value to a 3-byte PD value multiplied by 10 by adding X'0C' after the 2-byte value. Then you can divide by 10 to get 'hhmm'.
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 11 Apr 2005 Posts: 42 Topics: 19 Location: India
Posted: Mon Apr 11, 2005 11:02 am Post subject: OUTREC
Firstly I should pay my gratitude for having this interface where one can not just get his/her queries resolved, but your elaborate answers helps one understand really well. Should say its an excellent portal for Query Resolution and Learning Center!
Coming back to this query,
I tried your sort card and it works.
But, since, the output field I am expecting should be HHMM all numberic (like 9(04)) but for X'1724' field the output is coming as X'F1F7F2C4' now this C4 causes the output to look as 172D whereas expected is 1724.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Apr 11, 2005 2:15 pm Post subject:
Quote:
But, since, the output field I am expecting should be HHMM all numberic (like 9(04)) but for X'1724' field the output is coming as X'F1F7F2C4' now this C4 causes the output to look as 172D whereas expected is 1724.
If that's the case then you're using Syncsort, not DFSORT. Syncsort sets a C sign for TO=ZD conversion. DFSORT sets an F sign. If you were using DFSORT, my job with TO=ZD would give you what you want. With Syncsort, it doesn't. Of course, as Kolusu pointed out EDIT=(TTTT) will also do what you want for both DFSORT and Syncsort. So will M11,LENGTH=4. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum