I am reformatting a utility report into a CSV file for loading into a database. After stripping out the non-essential information and inserting delimiting commas (using DFSORT) I have a file that looks like this.
The utility report writer does not repeat values in subsequent records hence the spaces in locations 1-3. How can I carry over the non-blank value into subsequent records during the same process? I want my output file to look like this.
You need to use the IFTHEN group technique. Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use INREC with SPLICE. If you don't have the April, 2006 PTF, you won't get the correct output, so ask your System Programmer to install the PTF (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:
Could you tell me what adjustments you made? I tried the solution but the unique non-blank records i.e
were missing from the output.
I've ended up extracting the non blanks to another outfile and then merging it back into OUT and deduplicating, but I think I've gone a long way for a short cut.
Oh my! I did not check for any missing records. Thank you for catching this. I made three changes.
1-the sample data I provided had the desired data starting in column one however it actually began in column two
2-Frank's solution assumed an 80 byte output record, mine is 25
3-added SQZ=(SHIFT=LEFT)) to left justify the 3rd column of data