For Programmers: Free Programming Magazines  


Home > Archive > Cobol > August 2004 > Qualification is matter of COBOL Theology was Re: Dumb Question Time:









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 Qualification is matter of COBOL Theology was Re: Dumb Question Time:
Clark F. Morris, Jr.

2004-08-27, 3:55 am

Peter E. C. Dashwood wrote:
> Paul,
>
> if you have a large number of these qualified moves it might be worth
> setting a PFK or keystroke combination with SPF to produce " OF
> A-RECORD" etc. At least that way it's one key depression...


I have wanted to be able to code A-FILE.FIELD-1 instead of FIELD-1 OF
A-FILE for at least 20 - 30 years. This would extend to include
A-FILE.B-RECORD.C-GROUP.FIELD-1 instead of
FIELD-1 OF C-GROUP OF B-RECORD OF A-FILE. The notation is consistent
with other languages and unambiguous. The only case for it not working
is if a site uses pure numeric section and paragraph names, something
still allowed even if it makes no sense. Since I have never used
qualified paragraph names, I am willing to live with using the "." means
of qualification only for data division items. COPY REPLACING LEADING
is an improvement that allows us to easily reuse the descriptions where
the field names have a common prefix but at the expense of not being
able to use MOVE CORRESPONDING and ADD CORRESPONDING.
[color=darkred]
> Of course it is a pain to have to re-program the key for each new
> record...
>
> What about some global edits to change the names to something unique,
> like A-REC-ITEM1, A-REC-ITEM2 etc.? If these are record layouts from
> COPY books you could set this up at the time you COPY them in; REPLACE
> the level number so: COPY A-RECORD REPLACING ' 03 ' BY ' 03 A-REC-'
> etc.
>
> If it isn't a copy book, a quick cut and paste might do the
> trick...(this can be modified to work for a COPY book as well, but it
> is a bit more effort..)
>
>
> 01 A-RECORD.
> 12 ITEM1 PIC ...
> ...
> 12 ITEM53 PIC ...
>
> Copy the above and paste it as a redefinition...
>
> 01 A-RECORD.
> 12 ITEM1 PIC ...
> ...
> 12 ITEM53 PIC ...
> 01 FILLER REDEFINES A-RECORD.
> 12 ITEM1 PIC ...
> ...
> 12 ITEM53 PIC ...
>
> Edit the redefinition...
>
> 01 A-RECORD.
> 12 ITEM1 PIC ...
> ...
> 12 ITEM53 PIC ...
> 01 FILLER REDEFINES A-RECORD.
> 12 $A-ITEM1 PIC ...
> ...
> 12 $A-ITEM53 PIC ...
>
> Do the same for the other records...
>
> 01 B-RECORD.
> 12 ITEM1 PIC ...
> ...
> 12 ITEM53 PIC ...
> 01 FILLER REDEFINES B-RECORD.
> 12 $B-ITEM1 PIC ...
> ...
> 12 $B-ITEM53 PIC ...
>
> Now make your amendments using the redefined fields without
> qualification...
>
>
> MOVE 'A' to $A-ITEM1
> MOVE 123 TO $C-ITEM23
> MOVE $A-ITEM2 TO $B-ITEM2
> ...
>
> When you are through, run global edits to replace $A with 'A-REC', $B
> with 'B-REC' and so on.
>
> The main advantage of doing this is that any existing qualified
> references will still work OK, and you are gradually 'migrating' the
> programs to the point where they don't require qualification.
>
> The obvious downside is that if the ORIGINAL is modified, the
> REDEFINITION must be also (that's why it isn't such a good idea for
> COPY books, unless you can modify the COPY book original.)
>
> I'm not claiming that any of the above are "elegant" solutions, but
> looking at them may stimulate you to something appropriate for the
> environment you are working in.
>
> Visual Basic has the USING facility almost exactly as you posted.
>
> I agree it would be a useful facility to see in COBOL. These days I
> make sure record layouts are unique, but you are dealing with other
> people's code...
>
> Pete.
>
> "PAUL RAULERSON" <pkraulerson@verizon.net> wrote in message news:<XS5Cc.23889$a61.17636@nwrddc01.gnilink.net>...
>







Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com