Shiva wrote:
> That was a really good tip, Tone! Thanks a lot. Noted. :)
The general technique of going to OSS to use some of the tools there is a good one.
This particular suggestion is missing a step or two. ENFORM cannot, as far as I know, write a report to an Edit file, and this tip assumes the reports are in Edit files. You could send the reports to a spooler holding location, then use PERUSE to copy the spooler jobs to Edit files. Then you could combine them using paste. I imagine you would want to use -d " " rather than -d "," because an ENFORM report puts spaces between its columns, not commas. You might also need to put a space at the start of the lines of reports 2 and up so that you are sure the last column of one report and the first column of the next report have the normal separation.
Another approach which I don't remember seeing anyone mention would be this:
Write one report that using / in the target list to divide report into multiple lines per record.
Send the output to an unstructured disk file.
Copy that unstructured disk file in OSS to an OSS text file, adding a newline after each n*132 characters.
Use the OSS cut command to drop out the spaces that pad each section of the combined lines to 132 characters.
I have not actually tried this approach, but I am pretty sure it will work, unless ENFORM has a limit on the total length of a line it can handle, even when it is divided into multiple output lines.
Suppose the 70 fields in the original file would require around 700 bytes if they were displayed in a single line.
Write the ENFORM report to list all of the fields in a single LIST statement, but put a / in the target list at each point where the report line would exceed 132 columns. The / makes ENFORM put the following items on the next line of the report. You put commas around it, just as if it were a field name:
LIST field-1, field-2, ... field-k, /, field-m, ... field-s, /, field-t, ... ;
Suppose for this example, the field were spread out into 7 lines.
Unless any single field is longer than 132 characters, this approach will allow you to produce a single ENFORM report that contains all of the data, but each input record's values will occupy several 132-byte segments of the output file.
Make ENFORM put the report into an unstructured file.
Use this OSS command to convert the unstructured file to an OSS text file:
dd if=/G/vol/subvol/file ibs=924 cbs=924 conv=unblock | cut "1-127 133-255 265-366 397-509 529-615 661-794 793-" >new-report.txt
This assumes the unstructured file into which ENFORM wrote the report is named $vol.subvol.file. The /G/vol/subvol/file is the way to refer to a Guardian file from OSS. The /G must be a capital G. The rest may be upper or lower case.
The value 924 is 7 times 132, the total size the 7 lines of the report occupy (this would change depending on how many lines are needed to display each input record).
The ranges after the command "cut" say which columns of the combined report line contain data you want to keep in the final file. After the dd command combines the several 132-byte segments into one line, there will be sections of the line that contain the spaces that were at the end of each of the 132-byte segments. Each of the ranges should start at 1+n*132. The end value of each range should be the start value plus the number of characters that line of the report occupies, plus 1 (to make sure the first value on the next line has two spaces between it and the last value of the previous line). In the above example, the beginning of each range is correct, but I just made up the lengths of each line to keep. You can omit the end column of the last range. That will make it take the rest of the line, and the conv=unblock in the dd command will make it trim trailing spaces from the line before sending it to cut.
Computing the ranges will be a little tedious, but you only have to do it once for a given report.
The above example sends the final result to the file new-report.txt in the current working directory. You can change that name to whatever OSS file you like.