In the first case you asked for an eight byte field, thus there would be
nothing to pad. In the second case, you would also get no pad if the
first word on the line is eight or more bytes.
Consider also the case of the beginning of the record containing blanks.
On 04/23/2015 02:53 PM, Gentry, Steve wrote:
". . . any time that you invest in learning something new . . ."
Agreed. I also spent part of yesterday working with the LOOKUP stage and am a
little more comfortable with that.
I also discovered the following:
'| specs 1.8 1',
'| pad 8 .'
Does not give the same results as:
'| specs w1 1' ,
'| pad 8 .' ,
Whereas the latter would do the padding as I intended, the first did not. This
is significant when using LOOKUP.
To me, both incantations are the same but to PIPE's they are different.
Steve
"Knowledge is good." - Faber College motto
-----Original Message-----
From: CMSTSO Pipelines Discussion List [mailto:[email protected]] On
Behalf Of Rob van der Heij
Sent: Wednesday, April 22, 2015 5:24 PM
To: [email protected]
Subject: Re: [CMS-PIPELINES] SPEC and PAD
Jokes aside, I believe something like "spec" is still pretty concise. You
normally don't have to know it all to make use of it. I've used the structured data and
407 support quite a lot, but a lot can be learned when you need it. Things get easier
once you realize that any time that you invest in learning something new will pay off
very quick.
On 22 April 2015 at 21:43, Gentry, Steve <
[email protected]> wrote:
" SPEC can do anything. You only have to find out how :-)"
Which reinforces my belief, that once you master specs you can run
with the big dogs . . or, in "pipe" speak . .
. . once you master specs you can run with the big plumbers
I'm starting to get tired of carrying the tools. 8-)
-----Original Message-----
From: CMSTSO Pipelines Discussion List
[mailto:[email protected]]
On Behalf Of John P. Hartmann
Sent: Wednesday, April 22, 2015 3:37 PM
To: [email protected]
Subject: Re: SPEC and PAD
On 04/22/2015 09:08 PM, Gentry, Steve wrote:
I've found that SPEC has a PAD option/function.
Correct.
From what I've read it is used to pad a field with a leading character.
Not quite. It is the character inserted between fields, and also the
one used to pad out an output field that is larger than the actual input source.
I have a word, in a stream, that can be up to 8 characters long,
however, if it isn't 8 characters, I'd like to append a dot/period to
complete the 8 characters. I can use the PAD stage and in the grand
scheme of things the time is insignificant.
You can do that with pad, but you might have to turn it off again:
... | spec pad . 1.3 7.5 | ...
Will get you lots more dots than you want. Here the idiom is
... | spec // 7 pad . 1.3 7.5 | ...
This pads out with blanks to column 7. Then you can get the pad you
want and then you can turn it off again to write another field somewhere else.
Rather fiddly:
... | spec // 7 pad . 1.3 7.5 centre pad blank 4.3 10.5 centre| ...
However, I was wondering if the PAD function in the SPEC stage can
do
such a thing.
SPEC can do anything. You only have to find out how :-)
Thanks,
Steve