View previous topic :: View next topic |
Author |
Message |
newcobol Beginner
Joined: 20 Apr 2006 Posts: 88 Topics: 22
|
Posted: Fri Jul 25, 2014 11:08 am Post subject: Outrec fields |
|
|
i have input file with several fields. i am doing a sortsum, then i want to skip one of the fields when getting my output.
when using the outrec fields, do i have to write out every field that i want in the output, or can i cover a range to avoid this.
for example input file is 500. policy number is in position 3 to 11
can i put
outrec fields = (1,2,
14,387)
some of the fields in bytes 14 thru 500 are zd, pd, bi.
i was told this would outrec fields would create a file 489 long by skipping policy number. |
|
Back to top |
|
|
William Collins Supermod
Joined: 03 Jun 2012 Posts: 437 Topics: 0
|
Posted: Fri Jul 25, 2014 11:13 am Post subject: |
|
|
Don't use OUTREC FIELDS. Use OUTREC BUILD. Or even INREC BUILD (probably).
Code: | INREC BUILD=(1,2,14,387) |
Will give you the first two bytes of the current record, then from byte 14 for a length of 387 (it does not matter how the fields are actually defined "underneath" all that).
That'll give you a new current record of 389 bytes. This is short of some bytes, but I'm sure you can fix that.
So, yes, you can drop parts of a record without having to detailed definitions of other parts of the record. |
|
Back to top |
|
|
newcobol Beginner
Joined: 20 Apr 2006 Posts: 88 Topics: 22
|
Posted: Fri Jul 25, 2014 11:54 am Post subject: |
|
|
ok, prior to reading ur response, i ran it, and it got code 0. i reran it with 14,487, not 14,387(my mistake there). it seems to have worked. it wrote out all the fields except for policy number and created a 489 byte output file. why did u say not to use outrec fields? any info appreciated |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Fri Jul 25, 2014 12:07 pm Post subject: |
|
|
newcobol wrote: | why did u say not to use outrec fields? any info appreciated |
There is nothing wrong with using FIELDS. It is just FIELDS was the early syntax and now the BUILD and OVERLAY give you much more flexibility and understandability than FIELDS. _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
|
|