Hi Team
My requirement is to do the following:
1. Take one long sequential record from mainframe file..
2. Read one character at a time, if > ASCII 127, ignore, else keep.
3. Extract each sequence of contiguous ASCII characters as a separate word.
4. Reconstruct all the words into a sentence with spaces in between and write the output.
5. The final output will be a dataset of lines with only ASCII words.
Is it possible to achieve this using DFSORT?
Thank You
Regards
Prasanna G.
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
ifstream infile;
ofstream outfile;
string inline, outline;
. . . . . . . . . .
while ( getline( infile, inline) ) {
outline = "";
int len = inline.length();
for ( int i = 0, j = 0; i < len; ) {
while( i < len && inline[i] < 0x80 ) i++;
for (j = i; j < len && inline[j] >= 0x80; ) j++ ;
if (i < len)
outline += inline.substr( i, j - i + 1 ) + " " ;
}
if (outline.length() > 0)
outfile << outline << endl;
}
. . . . . . . . . .