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____
Out put required is –
ABC ABC DEF FGH
ABC DFG GHJK SHAG FHGJ
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?
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.
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.
Joined: 18 Jul 2007 Posts: 2150 Location: At my coffee table
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?