Please advise, 1), Why header is overlaid with some value (1,464.53)
2) For 0.00 value in amount field, the sign is attached as -0.00. But it should be 0.00
I'm with
Code:
ICE201I H RECORD TYPE IS F - DATA STARTS IN POSITION 1
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
"Header and trailer records will only be affected by the SKIPREC option and
OUTFIL statements. SKIPREC=n will remove the first n indd records, so the first
header record will be the n+1 indd record. OUTFIL statements will process the
header and trailer records in the normal way."
You can SUB from +0, quicker than MUL :-)
You can do all on the same statement, probably.
Have you checked EDIT for any special possible treatment of zero values?
If you need a "quick and dirty" to get it going (it is Friday) you could FINDREP to change -0.00 to blank0.00
"Header and trailer records will only be affected by the SKIPREC option and
OUTFIL statements. SKIPREC=n will remove the first n indd records, so the first
header record will be the n+1 indd record. OUTFIL statements will process the
header and trailer records in the normal way."
I think DATASORT of ICETOOL can be used to sort the records between header(s) and trailer(s). Not sure, what I'm missing here.
Bill Woodger wrote:
Have you checked EDIT for any special possible treatment of zero values?
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Thinking about it, by algebra, a minus times a plus is a minus. Says so in the 370-etc POP as well.
I think I read you can't get a "negative zero" in Cobol any more. Since I never MULTIPLY BY -1 in Cobol, maybe why I'd never seen so many "negative zeros" (only ever saw one, from another person's program) :-) There are some references in the DFSORT manual.
Do you need to SORT the file? With an IFTHEN to exclude the header, you can just do the adjustment in an ordinary Sort step, without ICETOOL.
Gnanas N,
Are you saying you got the desired output just by using +0,SUB,1,25,SFF,TO=ZD,LENGTH=25 in stead of 1,25,SFF,MUL,-1,TO=ZD,LENGTH=25 OR did you make any other changes?
Quote:
Please advise, 1), Why header is overlaid with some value (1,464.53)
This is not "some value". Type AMOUNT and do HEX ON.
Regardless, why not qualify your header or detail records and do multiplication/subtraction only for detail records?
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
Hi sqlcode1,
sqlcode1 wrote:
Gnanas N,
Are you saying you got the desired output just by using +0,SUB,1,25,SFF,TO=ZD,LENGTH=25 in stead of 1,25,SFF,MUL,-1,TO=ZD,LENGTH=25 OR did you make any other changes?
Yes. +0,SUB,1,25,SFF,TO=ZD,LENGTH=25 worked out; no other changes.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Gnanas N wrote:
Please advise, 1), Why header is overlaid with some value (1,464.53)
Gnanas N,
Datasort works on the INPUT phase and you have 2 edit mask on both INREC and OUTFIL. Datasort does NOT control editing on the OUTFIL. And the numbers you see on your first record is because ZD format edit format will ignore the zone and hence that number. As SQLCODE mentioned set your hex on and see the contents. ex:
Code:
AMOUNT
CDDEDE
146453
Now the question is why do you need to convert the number to ZD ? You are NOT summing or doing any thing with that conversion.
2) For 0.00 value in amount field, the sign is attached as -0.00. But it should be 0.00
As bill mentioned Subtracting from zero is easier to handle negative zero values. if you insist on multiplication with -1 then you can use the following control cards.