View previous topic :: View next topic
|
Author |
Message |
shell100
New User
Joined: 14 Apr 2006 Posts: 25 Location: Banglore,India
|
|
|
|
We have a case where input file records are having spaces at the end. Each record is of different length. Our requirement is to suppress the spaces at the end & write to the output file.
Let say Input file is having records like –
ABC ABC DEF FGH____
ABC DFG GHJK SHAG FHGJ____
FDSJKDHFKJS____
DKSAUDHKASD______
Out put required is –
ABC ABC DEF FGH
ABC DFG GHJK SHAG FHGJ
FDSJKDHFKJS
DKSAUDHKASD
Record length is defined at 580 bytes for output. Going by requirement it should have different record length for each record. We are not sure how many records would be there in the input file & hence can’t defined any specific layout for this. Can anyone suggest how this could be handled in cobol?
Thanks in advance |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Use the RECORD CONTAINS clause on the input FD to find out how long the record is; count back to find the first non-blank character and move the appropriate number of characters to the output FD 01 which also needs the RECORD CONTAINS clause. |
|
Back to top |
|
|
shell100
New User
Joined: 14 Apr 2006 Posts: 25 Location: Banglore,India
|
|
|
|
It would be great if you could elaborate little bit on the solution provided. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Elaborate in what way? I've given you the clauses to use (the manuals link at the top of the page will give you details if you're not familiar with them already), as well as the logic required. If there's anything you don't understand then give more details.
If you're wanting actual code, I'm willing to discuss my fee for it -- but otherwise this is a help forum, not a do-it-for-you forum. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
shell100 wrote: |
It would be great if you could elaborate little bit on the solution provided. |
It would be great if you could elaborate a bit on the requirement.
Records are variable length, not fixed?
The 580 is max length for output of the variable records?
The only thing you want suppressed is the trailing spaces at the end of the record?
There are no other fields in a record that need the spaces suppressed?
The suppressing of the trailing spaces will be accomplished by writing the output record with a shorter length than the input?
Is this thread related to Suppression of trailing spaces in given string? |
|
Back to top |
|
|
|