Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Dumb Question Time: Qualification of data items
I am not sure if I am mixing COBOL and Assembler, or Ada (or some other
language) up,
but isn't there a way to qualify a set of data items within a block
statement?

Something like:

USING A-RECORD
MOVE 'A' TO ITEM-1
MOVE 2   TO ITEM-2
END-USING

USING B-RECORD
MOVE 'B' TO ITEM-1
MOVE 3   TO ITEM-2
END-USING

RATHER THAN

MOVE 'A' TO ITEM-1 OF A-RECORD
MOVE 2   TO ITEM-2 OF A-RECORD
MOVE 'B' TO ITEM-1 OF B-RECORD
MOVE 3   TO ITEM-2 OF B-RECORD

I swear, I thought this existed at least in IBM COBOL somewhere,
but I can not find anything like this at all in the reference manuals.

-Paul





Report this thread to moderator Post Follow-up to this message
Old Post
PAUL RAULERSON
06-25-04 11:50 PM


Re: Dumb Question Time: Qualification of data items
In article <XS5Cc.23889$a61.17636@nwrddc01.gnilink.net>,
"PAUL RAULERSON" <pkraulerson@verizon.net> wrote:

> I am not sure if I am mixing COBOL and Assembler, or Ada (or some other
> language) up,
> but isn't there a way to qualify a set of data items within a block
> statement?
>
> Something like:
>
>     USING A-RECORD
>        MOVE 'A' TO ITEM-1
>        MOVE 2   TO ITEM-2
>        END-USING
>
>     USING B-RECORD
>         MOVE 'B' TO ITEM-1
>         MOVE 3   TO ITEM-2
>         END-USING
>
>   RATHER THAN
>
>        MOVE 'A' TO ITEM-1 OF A-RECORD
>        MOVE 2   TO ITEM-2 OF A-RECORD
>        MOVE 'B' TO ITEM-1 OF B-RECORD
>        MOVE 3   TO ITEM-2 OF B-RECORD
>
> I swear, I thought this existed at least in IBM COBOL somewhere,
> but I can not find anything like this at all in the reference manuals.
>
> -Paul
>

I think you might be mixing in the ADA.  But wasn't it called "WITH
record DO" or is that the Pascal word?

The new assembler supports this something similar -- you can label a
DSECT and then refer to the label.fieldname to resolve an offset rather
than do an explicit using.

I wish there were such a notation for Cobol, as it would be a very 
time saving feature.

Report this thread to moderator Post Follow-up to this message
Old Post
Joe Zitzelberger
06-25-04 11:50 PM


Re: Dumb Question Time: Qualification of data items
Thanks Joe - I sure wish it were there too. I could fix some really annoying
code I did not write much easier.
I love the new Assembler syntax. I have to check with the Dignus guys to
make sure we can use it. :)

-Paul


"Joe Zitzelberger" <joe_zitzelberger@nospam.com> wrote in message
news:joe_zitzelberger-B1DE6D.22344322062004@corp.supernews.com...
> In article <XS5Cc.23889$a61.17636@nwrddc01.gnilink.net>,
>  "PAUL RAULERSON" <pkraulerson@verizon.net> wrote:
> 
>
> I think you might be mixing in the ADA.  But wasn't it called "WITH
> record DO" or is that the Pascal word?
>
> The new assembler supports this something similar -- you can label a
> DSECT and then refer to the label.fieldname to resolve an offset rather
> than do an explicit using.
>
> I wish there were such a notation for Cobol, as it would be a very 
> time saving feature.



Report this thread to moderator Post Follow-up to this message
Old Post
PAUL RAULERSON
06-25-04 11:50 PM


Re: Dumb Question Time: Qualification of data items
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...

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@nwr
ddc01.gnilink.net>...
> I am not sure if I am mixing COBOL and Assembler, or Ada (or some other
> language) up,
> but isn't there a way to qualify a set of data items within a block
> statement?
>
> Something like:
>
>     USING A-RECORD
>        MOVE 'A' TO ITEM-1
>        MOVE 2   TO ITEM-2
>        END-USING
>
>     USING B-RECORD
>         MOVE 'B' TO ITEM-1
>         MOVE 3   TO ITEM-2
>         END-USING
>
>   RATHER THAN
>
>        MOVE 'A' TO ITEM-1 OF A-RECORD
>        MOVE 2   TO ITEM-2 OF A-RECORD
>        MOVE 'B' TO ITEM-1 OF B-RECORD
>        MOVE 3   TO ITEM-2 OF B-RECORD
>
> I swear, I thought this existed at least in IBM COBOL somewhere,
> but I can not find anything like this at all in the reference manuals.
>
> -Paul

Report this thread to moderator Post Follow-up to this message
Old Post
Peter E. C. Dashwood
06-25-04 11:50 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 08:14 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.