× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Joe,

Let's start with the last question first.  It's answer affects the others.

> And finally, in a blinding burst of newbieness, say I have two 01-level
> fields, both with lots of 05 and 10 subfields.  FIELDA is 100
> characters, FIELDB is 75.  If I MOVE FIELDA TO FIELDB, does this move
> the first 75 bytes (positions 1-75) of FIELDA to FIELDB, or the last 75
> (positions 26-100)?

With COBOL, the move depends on the type of data being moved.  In your
example, character fields are moved left to right with data truncated when
the end of the target field is reached.  So if you have:

01 Fields-to-move.
   05 FieldA  pic X(36) Value "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
   05 FieldB  Pic X(10) Value spaces.

If you do a

  Move FieldA to FieldB

FieldB will end up with "ABCDEFGHIJ" as it's contents.  Please note that
moving from a group, in this case Fields-to-move" to any field is counted
as a character move, even if some of the sub-fields are numbers.  This can
get you into trouble if you are not careful.

A numeric move is from the assumed decimal place out, with numbers being
truncated at the end of the receiving field.

Thus:

01 Numbers-to-Move.
   05 FieldC  Pic 9(5V99) value 12345.67.
   05 FieldD  Pic 9(3v9)  value zero.

if you do a;

    Move Field C to FieldD

FieldD should contain 345.6

Note that moving from shorter fields to longer will result in padding
spaces for character fields, and zeros for numeric fields.

That was the easy part.

For data structures, and I **believe** for the informational structures,
COBOL treats them as character moves.  If the structure is not big enough
to handle all the data, it gets truncated.  If it is too big, it pads with
spaces (note the move to a group or data structure is a character move). 
I **believe** that the ACCEPT is like a character move to the data
structure, following all  the rules.

Thus, the structure is fixed in length and definition, but if you don't
include all the sub-fields, the information is truncated when the end of
the data structure is reached.  The names of the fields in the structure
can be anything you wish.   For the sake of maintaining the software, I
hope they are understandable.

HTH

Jim Essinger
Senior Programmer/Analyst
Student Loan Fund of Idaho
PO Box 730
Fruitland,  ID 83619
208-452-4058



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.