Home > Archive > Cobol > January 2007 > TYPEDEF and RENAMES (was Re: Productivity)
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
TYPEDEF and RENAMES (was Re: Productivity)
|
|
| Rick Smith 2007-01-10, 7:55 am |
|
"Frank Swarbrick" <Frank.Swarbrick@efirstbank.com> wrote in message
news:50fnlaF1esfutU1@mid.individual.net...
[snip]
> And how about with TYPEDEFs? I was looking forward to having TYPEDEFs
until
> I realized it would require me to use the 'OF' clause way too often.
It may be possible to avoid using OF (or IN) by using
the 66 RENAMES.
> How about :
> 01 TRANSACTION TYPEDEF.
> 05 ACCT-NBR PIC 9(10).
> 05 TYPE PIC X.
Change to TYP since TYPE is a reserved word.
> 05 AMOUNT PIC S9(9)V99 COMP-3.
>
> 01 PREV-TRAN TYPE TRANSACTION.
66 PREV-TRAN-ACCT-NBR RENAMES ACCT-NBR.
66 PREV-TRAN-TYP RENAMES TYP.
66 PREV-TRAN-AMOUNT RENAMES AMOUNT.
> 01 TRAN TYPE TRANSACTION.
66 TRAN-ACCT-NBR RENAMES ACCT-NBR.
66 TRAN-TYP RENAMES TYP.
66 TRAN-AMOUNT RENAMES AMOUNT.
Replace the "." separator with "-" in the following.
> IF TRAN.ACCT-NBR = PREV-TRAN.ACCT-NBR
> CONTINUE
> ELSE
> PERFORM ACCT-BREAK
> MOVE TRAN TO PREV.TRAN
> MOVE ZERO TO TOTAL-TRAN-AMOUNT
> END-IF
> ADD TRAN.AMOUNT TO TOTAL-TRAN-AMOUNT
>
> Just thoughts on what I might do if I were in charge of such things. :-)
However 66 RENAMES can not be used with entries
subordinate to an OCCURS clause or an 88 condition-name.
TYPEDEFs may be used to maintain consistent USAGE
and PICTURE, yet, with 66 RENAMES, allow most
procedure division statements to avoid the use of OF or IN.
[I checked the above statements using Micro Focus 3.2.24
(where TYPEDEF is an extension) and by reading the FDIS
for COBOL 2002.]
| |
|
| In article <12q9hunqm74td8d@corp.supernews.com>,
Rick Smith <ricksmith@mfi.net> wrote:
>
>"Frank Swarbrick" <Frank.Swarbrick@efirstbank.com> wrote in message
>news:50fnlaF1esfutU1@mid.individual.net...
>[snip]
>until
>
>It may be possible to avoid using OF (or IN) by using
>the 66 RENAMES.
Ow OW Ow ow ow ow... one of mine own 'stylistic buttons' has been pushed;
if a 66 RENAMES is required I'd just as soon find another way to do
things.
(Instead of 'another way to do things' I originally wrote 'another
method'... but I'm coming to learn that 'method' may generate certain
technical associations which I do not wish to invoke... errrrr, bring
along.)
DD
|
|
|
|
|