Re: Productivity




"Frank Swarbrick" <Frank.Swarbrick@xxxxxxxxxxxxxx> wrote in message
news:4vlbkiF1bf56sU1@xxxxxxxxxxxxxxxxxxxxx
Pete Dashwood<dashwood@xxxxxxxxxxxxxxxxxxxxxxxxx> 12/28/06 4:34 PM >>>

"Frank Swarbrick" <Frank.Swarbrick@xxxxxxxxxxxxxx> wrote in message
news:4vimr5F1cedo7U1@xxxxxxxxxxxxxxxxxxxxx
Pete Dashwood<dashwood@xxxxxxxxxxxxxxxxxxxxxxxxx> 12/27/06 5:59 PM >>>

"Frank Swarbrick" <Frank.Swarbrick@xxxxxxxxxxxxxx> wrote in message
news:4vfl66F1as7a4U1@xxxxxxxxxxxxxxxxxxxxx
Pete Dashwood<dashwood@xxxxxxxxxxxxxxxxxxxxxxxxx> 12/27/06 3:40 AM >>>
"Frank Swarbrick" <infocat@xxxxxxxxxxxxx> wrote in message
I am certainly *not* against using all of the power that COBOL provides.

I
only recently used DECLARATIVES recently to handle file I/O errors.
It's
actually quite nice, not having to check the status after each I/O.
Should
be a bit more powerful to be *really* useful, but I'd be happy to see
others
understand and use it. My manager at first was against my use of this,
but
I convinced him by pointing out that it's an "implicit perform" rather
than
an "implicit goto".

Yes, DECLARATIVES can be very useful. In the old days, before disks, we
used
them all the time to handle tape errors... :-)

It's still useful to handle "file out of space" conditions. (Somethat
that
never happens in the world of tape processing!)

I've also recently been using UNSTRING, which I hadn't made a lot of use

of
in the past. Below is something I was working on the other day. I had
hoped to be able to get it in to a single "UNSTRING", but I ended up
with
two and I'm fairly happy with it. Essentially, it parses some input
where
fields are delimited by '|' (MSG-FIELD-DELIMITER), and for each field
there
can be both a parm name and a parm value delimited by '='

Do you mean it looks like this: |name=value=| or |name=value| ?

The latter.

(MSG-FIELD-SEPARATOR), or just a parm name (no '='). Each perform of
300-PARSE-INPUT-DATA should result in the parsing of one field, putting
the
parm name into INPUT-STRING-ID and the parm value (if present) into
INPUT-STRING-PARM. If the field is a "null" field (essentially '||')
then
the flag END-OF-REQUEST should be set.

If you can clarify the use of = as requested above, I believe I can do
this
with a single UNSTRING.

Here's an example:
userId=FJS¦location=AURO¦function=filmRequest¦acctNumber=1234567890¦userExte
nsion=1403¦routing=branch¦routeLoc=K-MISS¦routeAttn=Joe¦comments=Comments
Go
Here¦type=debit¦date=121306¦amount=100.00¦sequenceNbr=12345678¦¦type=credit¦
date=051406¦amount=900.00¦sequenceNbr=11122233¦¦type=ATM¦date=010106¦amount=
123.45¦¦type=chargeback¦date=010106¦amount=500.00¦¦type=statement¦date=03290
6¦amount=1000.00¦

In this case there are none with just the parm name and not the parm
value.
In fact so far we have no cases like that, but I'm trying to "think ahead"
just in case we do want to allow for that. So, just so we have a better
example, let me change the above to this (I removed the "type=", leaving
just the value (which would now be considered the "string ID" rather than
the "string parm"):
userId=FJS¦location=AURO¦function=filmRequest¦acctNumber=1234567890¦userExte
nsion=1403¦routing=branch¦routeLoc=K-MISS¦routeAttn=Joe¦comments=Comments
Go
Here¦debit¦date=121306¦amount=100.00¦sequenceNbr=12345678¦¦credit¦date=05140
6¦amount=900.00¦sequenceNbr=11122233¦¦ATM¦date=010106¦amount=123.45¦¦chargeb
ack¦date=010106¦amount=500.00¦¦statement¦date=032906¦amount=1000.00¦

So the result should be:
INPUT-STRING-ID=userId
INPUT-STRING-PARM=FJS

INPUT-STRING-ID=location
INPUT-STRING-PARM=AURO

INPUT-STRING-ID=function
INPUT-STRING-PARM=filmRequest

INPUT-STRING-ID=acctNumber
INPUT-STRING-PARM=1234567890

INPUT-STRING-ID=userExtension
INPUT-STRING-PARM=1403

INPUT-STRING-ID=routing
INPUT-STRING-PARM=branch

INPUT-STRING-ID=routeLoc
INPUT-STRING-PARM=K-MISS

INPUT-STRING-ID=routeAttn
INPUT-STRING-PARM=Joe

INPUT-STRING-ID=comments
INPUT-STRING-PARM=Comments Go Here

INPUT-STRING-ID=debit
INPUT-STRING-PARM=

INPUT-STRING-ID=date
INPUT-STRING-PARM=121306

INPUT-STRING-ID=amount
INPUT-STRING-PARM=100.00

INPUT-STRING-ID=sequenceNbr
INPUT-STRING-PARM=12345678

INPUT-STRING-ID=
INPUT-STRING-PARM=

INPUT-STRING-ID=credit
INPUT-STRING-PARM=

INPUT-STRING-ID=date
INPUT-STRING-PARM=051406

INPUT-STRING-ID=amount
INPUT-STRING-PARM=900.00

INPUT-STRING-ID=sequenceNbr
INPUT-STRING-PARM=11122233

INPUT-STRING-ID=
INPUT-STRING-PARM=

INPUT-STRING-ID=ATM
INPUT-STRING-PARM=

INPUT-STRING-ID=date
INPUT-STRING-PARM=010106

INPUT-STRING-ID=amount
INPUT-STRING-PARM=123.45

INPUT-STRING-ID=
INPUT-STRING-PARM=

INPUT-STRING-ID=chargeback
INPUT-STRING-PARM=

INPUT-STRING-ID=date
INPUT-STRING-PARM=010106

INPUT-STRING-ID=amount
INPUT-STRING-PARM=500.00

INPUT-STRING-ID=
INPUT-STRING-PARM=

INPUT-STRING-ID=statement
INPUT-STRING-PARM=

INPUT-STRING-ID=date
INPUT-STRING-PARM=032906

INPUT-STRING-ID=amount
INPUT-STRING-PARM=1000.00

Having said that, what you have posted is pretty good, especially for an
early attempt :-)

Well, it's not like I just came up with it all at once. :-) I tried a
few
things and that was the one that worked.

I think I would unstring ALL of the parameters into a name/value array
during initialization, rather than go back to the arguments during
processing, but that is just me...

We are doing this, just not within this paragraph. After each
300-PARSE-INPUT-DATA is done there's a validation routine, and if the parm
is valid then INPUT-STRING-ID and INPUT-STRING-PARM are placed into just
such an array. That array is then passed to the appropriate sub-program
(depending on the value of the "function" parameter) for further
processing.

Post some example parameter strings so we can be sure we are on the same
wavelength and I'll post what my solution would be. There are many ways to

do this; I'm not saying mine is the best, but it would use a single
UNSTRING.

See above. I am preparing myself to be amazed. :-)

OK, that is excellent. It is a rainy Saturday here (so much for Summer :-))
so I'll make that my entertainment for the day (it will be good to write
some COBOL again :-)). I'll post fully functioning code later today.

Whether it will be "amazing" or not may depend on how much Jack Daniel's
gets consumed... :-)

Pete.



.