Thanks. I didn't know you could do that with SPECS. SPECS would seem to be a good topic at a VM conference or workshop. "You can do a lot of things with SPECS" (paraphrasing Forrest Gump). Steve
-----Original Message----- From: CMSTSO Pipelines Discussion List [mailto:[email protected]] On Behalf Of Hobart Spitz Sent: Tuesday, August 26, 2014 4:37 PM To: [email protected] Subject: Re: variable length fields How about something like ... | specs substr 5-* of w1 1 substr 3-* of w2 15.10 right | ... ? w2 does an implicit strip... On Tue, Aug 26, 2014 at 12:46 PM, Gentry, Steve < [email protected]> wrote: > I've run a db2 select within a pipe and I get two words back. Both words > have a length field in front of it, in hex. The length of the length > field in the first word is 4 bytes long. The length of the length > field for the second word is 2 bytes long. > So, this is sort of how it looks: > """"THIS_IS_FIELD_A ""13000 > """"THIS_IS_FIELD_B ""4577 > > Word 2 is a numeric field. > I want the output to look like this and because word 2 is numeric, I > want to right justify it. > THIS_IS_FIELD_A 13000 > THIS_IS_FILED_B 4577 > > I can do a SPLIT but because the two length fields are 4 and 2 , I > can't do a SPECS 5-* 1 ( or SPECS 3-* 1 ). Then there is the issue > of JOINing them and getting the formatting (see above) correct. I > don't really care about the length fields (unless, of course, it helps > with the overall solution). > I can do this by writing a REXX STAGE but I prefer to do it all in PIPES. > I'm sure it can be done in pipes and probably with specs but I can't > come up with a solution. > Does anybody have a suggestion? > Thanks, > Steve > -- OREXXMan
