Variable length output fields



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Variable length output fields

Postby stevexff » Wed Nov 10, 2010 8:32 pm

This is my first post on this forum, so my greetings to you all.

I'm processing an unloaded DB2 table, in which all the VARCHARS have been padded to their full length, but still have the length field in the first two bytes. So my input record looks like:

rdwfixedfixedfixedllvarchardatapaddedwithx'40'llvarchardatapaddedwithx'40'fixedfixed

So my input fields are all in fixed positions, which is easy enough to process. What I want to do is reformat the output record so that it loses the padding from the VARCHAR fields, so I end up with something considerably shorter, looking like:

rdwfixedfixedfixedllvarchardatallvarchardatafixedfixed

All the information needed to do the reformatting is in the input record, and although I've RTFM'd I can't see a way to get DFSORT to produce the output I want. Does anybody know how to make it produce variable length output fields (kind of like parse, but in reverse I guess).

TIA

Steve
Steve
stevexff
 
Posts: 56
Joined: Wed Nov 10, 2010 7:48 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Variable length output fields

Postby skolusu » Thu Nov 11, 2010 5:42 am

Steve,

The best option is used CHAR function along with IFNULL function on all the varchar columns so that you will have a fixed length output without the special indicators. Parsing would be difficult as you can have embedded spaces in between and every varchar field will have a variable length.

for ex:
CHAR(IFNULL(varchar_col,' '))
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Variable length output fields

Postby stevexff » Thu Nov 11, 2010 5:00 pm

Thanks, but I don't want an alternative solution, because the input file format is a given; its creation is not under my control. I have to sort these records in any case, so if I can do the reformat in the same step that would be a bonus. What I need to know is can DFSORT read the input I've got and produce the output I want, or should I look elsewhere to another tool like SAS, SELCOPY or even COBOL?
Steve
stevexff
 
Posts: 56
Joined: Wed Nov 10, 2010 7:48 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Variable length output fields

Postby stevexff » Fri Nov 12, 2010 7:42 pm

OK, I can't find anything in the manual that does remotely like what I want, with the possible exception of an E35 exit. I can write one fairly easily, but can anyone please answer the following before I dust off the assembler skills?

1. I already have some INREC processing going on that does IFTHEN OVERLAY processing on my input records. From the flowchart, it looks like this processing will complete before the record gets passed to my E35. Is this correct?

2. I have some OUTFIL BUILD too - does the E35 completely replace this, or does the OUTFIL BUILD get done before the E35 is called?

Thanks
Steve
stevexff
 
Posts: 56
Joined: Wed Nov 10, 2010 7:48 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Variable length output fields

Postby Frank Yaeger » Fri Nov 12, 2010 11:32 pm

1. Yes, INREC is processed before the E35. The reformatted INREC records are passed to the E35.

2. OUTFIL is processed after the E35. The records returned from the E35 are passed to OUTFIL.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Variable length output fields

Postby stevexff » Sat Nov 13, 2010 1:22 pm

Thanks, Frank

In that case is there an exit point after OUTFIL where I can modify the record? Unless there is an alternative way to produce variable length fields in the output it looks like I will be using some other utility for this... :(
Steve
stevexff
 
Posts: 56
Joined: Wed Nov 10, 2010 7:48 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Variable length output fields

Postby Frank Yaeger » Mon Nov 15, 2010 10:03 pm

is there an exit point after OUTFIL where I can modify the record?


No, you would have to have OUTFIL use a temporary data set and then use the temporary data set as input for another pass.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Variable length output fields

Postby stevexff » Tue Nov 16, 2010 6:33 pm

OK, that sounds like it would work - I'll give it a try and post back with the results. May not be today though... :)

Thanks, Frank
Steve
stevexff
 
Posts: 56
Joined: Wed Nov 10, 2010 7:48 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Variable length output fields

Postby stevexff » Fri Nov 19, 2010 1:22 pm

I'd assumed that I would be able to read the input file, process the INREC, write the OUTFIL to a temporary work dataset and then COPY it back with an E35 to shorten the VARCHARs all in one job step. As I can't, then it didn't make sense to use SORT to do the copy and then write an E35 exit to do the reformatting - in this case SORT would only be doing the I/O for me (which might have made sense if I'd had squillions of records - SORT uses EXCP so it might make a performance difference), so I wimped out and used a different utility after my existing SORT which did the job in about ten lines of code.
Steve
stevexff
 
Posts: 56
Joined: Wed Nov 10, 2010 7:48 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Variable length output fields

Postby Frank Yaeger » Sat Nov 20, 2010 12:17 am

Well, DFSORT has a lot of function, but it DOES NOT have every possible function (no utility does).
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Next

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post