View previous topic :: View next topic
|
Author |
Message |
manoopatil
New User
Joined: 07 Dec 2003 Posts: 56 Location: Montreal
|
|
|
|
Hi,
I need to extend the file with rec. length 490 to add 2 new fields in the end with picture clause as PIC S9(07)V99. The output file should have the record length as 508 with two new fields initialized to zero.
Can someone please suggest the Control Statement for SYNCSORT to accomplish this?
Thank you
-Manohar |
|
Back to top |
|
|
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 183 Location: hyderabad
|
|
|
|
manoopatil,
I think,you want to add 18 zeroes at the end of the input record.
Code: |
sort fields=copy
outrec fields=(1,490,c'000000000',c'000000000')
|
The above card shoud give the desired output.
Thanks
Krishy |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
sril.krishy wrote: |
manoopatil,
I think,you want to add 18 zeroes at the end of the input record.
Code: |
sort fields=copy
outrec fields=(1,490,c'000000000',c'000000000')
|
The above card shoud give the desired output.
Thanks
Krishy |
Since when are PIC 9(07)V99 and PIC S9(07)V99 the same? |
|
Back to top |
|
|
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 183 Location: hyderabad
|
|
|
|
Sorry!it's a mistake! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Given that the new fields appear to be amounts or quantities and that they are zeros, the posted code should work. . .
It should be noted that this inserts data with an "implied positive" value due to the "F" sign (rather than an explicit positive ("C" sign) or an explicit negative ("D" sign). |
|
Back to top |
|
|
manoopatil
New User
Joined: 07 Dec 2003 Posts: 56 Location: Montreal
|
|
|
|
Thanks you Krishy,
However picture clause for new fields is - PIC S9(07)V99 which is not Alphabetic or Alphanumeric. Will that cause an issue when the program try to read these fields initialized to zeroes but having picture clause PIC S9(07)V99
Thank you
-Manohar |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
To repeat:
Quote: |
Given that the new fields appear to be amounts or quantities and that they are zeros, the posted code should work. . . |
Did you try this? If not, why not? That is why we test. . .
Quote: |
However picture clause for new fields is - PIC S9(07)V99 |
Suggest you read about which values are valid for a field with this picture. You can read about this in the COBOL Language Reference available via the "IBM Manuals" link at the top of the page. . .
You need to learn about signed values (the s9 means signed). They will be with you as long as you work with computers. |
|
Back to top |
|
|
manoopatil
New User
Joined: 07 Dec 2003 Posts: 56 Location: Montreal
|
|
|
|
Hi Dick,
Thanks for the advice. I did try krishy's suggestion and it did work.
Additionally I also tried following alternate solution and that also works.
Code: |
sort fields=copy
outrec fields=(1,490,c'00000000{',c'00000000{') |
Thank you everybody for posting your suggestions
Regards
-Manohar |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Good to hear it is working - thank you for letting us know
d |
|
Back to top |
|
|
|