Group level move vs sub-group level move. 
Author Message
 Group level move vs sub-group level move.

Hi,
            I am facing editing problem in cobol.In my cobol program I have two
area in working storage as follows:

01 W-COMPUTE-AREA.
   05 FILLER              PIC X(10).
   05 W-COMPUTE-DATA-1    PIC 9(12)V9(02).
   05 W-COMPUTE-DATA-2    PIC 9(12)V9(02).
   05 W-COMPUTE-DATA-3    PIC 9(12)V9(02).
   05 W-COMPUTE-DATA-4    PIC 9(12)V9(02).
   05 W-COMPUTE-DATA-5    PIC 9(12)V9(02).

01 W-EDIT-AREA.
   05 FILLER              PIC X(10).
   05 W-EDIT-DATA-1       PIC $$$$$$$$$$$9.99.
   05 W-EDIT-DATA-2       PIC $$$$$$$$$$$9.99.
   05 W-EDIT-DATA-3       PIC $$$$$$$$$$$9.99.
   05 W-EDIT-DATA-4       PIC $$$$$$$$$$$9.99.
   05 W-EDIT-DATA-5       PIC $$$$$$$$$$$9.99.

      In PROCEDURE DIVISION  if I am moving group level variable
            (like
              MOVE W-COMPUTE-AREA TO W-EDIT-AREA.
             )
      I am not getting the field edited in W-EDIT-AREA for example

 W-COMPUTE-DATA-1 has value 000000000012.05 then
 W-EDIT-DATA-1    has value 00000000001205

     whereas if I am moving sub-group level variable individually
             ( like
                   MOVE W-COMPUTE-DATA-1 TO W-EDIT-DATA-1.
                   MOVE W-COMPUTE-DATA-2 TO W-EDIT-DATA-2.
                   MOVE W-COMPUTE-DATA-3 TO W-EDIT-DATA-3.
                   MOVE W-COMPUTE-DATA-4 TO W-EDIT-DATA-4.
                   MOVE W-COMPUTE-DATA-5 TO W-EDIT-DATA-5.
             )
  then I am getting the edited data for example

 W-COMPUTE-DATA-1 has value 000000000012.05 then
 W-EDIT-DATA-1    has value          $12.05                  

                 I am not getting why this is happening?
Thanks in advance.

shyam



Mon, 15 Nov 2004 21:46:07 GMT  
 Group level move vs sub-group level move.
I think that it has to do with the fact that a move is either a numeric move
or a alphanumeric one. It's the reciveing field that decide wich and in this
case group level makes it a alpanumeric move and sub level makes it a
numeric move.

COJ
--Sorry for spelling and gramar, being ESL--


Quote:
> Hi,
>             I am facing editing problem in cobol.In my cobol program I
have two
> area in working storage as follows:

> 01 W-COMPUTE-AREA.
>    05 FILLER              PIC X(10).
>    05 W-COMPUTE-DATA-1    PIC 9(12)V9(02).
>    05 W-COMPUTE-DATA-2    PIC 9(12)V9(02).
>    05 W-COMPUTE-DATA-3    PIC 9(12)V9(02).
>    05 W-COMPUTE-DATA-4    PIC 9(12)V9(02).
>    05 W-COMPUTE-DATA-5    PIC 9(12)V9(02).

> 01 W-EDIT-AREA.
>    05 FILLER              PIC X(10).
>    05 W-EDIT-DATA-1       PIC $$$$$$$$$$$9.99.
>    05 W-EDIT-DATA-2       PIC $$$$$$$$$$$9.99.
>    05 W-EDIT-DATA-3       PIC $$$$$$$$$$$9.99.
>    05 W-EDIT-DATA-4       PIC $$$$$$$$$$$9.99.
>    05 W-EDIT-DATA-5       PIC $$$$$$$$$$$9.99.

>       In PROCEDURE DIVISION  if I am moving group level variable
>             (like
>               MOVE W-COMPUTE-AREA TO W-EDIT-AREA.
>              )
>       I am not getting the field edited in W-EDIT-AREA for example

>  W-COMPUTE-DATA-1 has value 000000000012.05 then
>  W-EDIT-DATA-1    has value 00000000001205

>      whereas if I am moving sub-group level variable individually
>              ( like
>                    MOVE W-COMPUTE-DATA-1 TO W-EDIT-DATA-1.
>                    MOVE W-COMPUTE-DATA-2 TO W-EDIT-DATA-2.
>                    MOVE W-COMPUTE-DATA-3 TO W-EDIT-DATA-3.
>                    MOVE W-COMPUTE-DATA-4 TO W-EDIT-DATA-4.
>                    MOVE W-COMPUTE-DATA-5 TO W-EDIT-DATA-5.
>              )
>   then I am getting the edited data for example

>  W-COMPUTE-DATA-1 has value 000000000012.05 then
>  W-EDIT-DATA-1    has value          $12.05

>                  I am not getting why this is happening?
> Thanks in advance.

> shyam



Mon, 15 Nov 2004 21:58:05 GMT  
 Group level move vs sub-group level move.


Quote:
> Hi,
>             I am facing editing problem in cobol.In my cobol program I
have two
> area in working storage as follows:

> 01 W-COMPUTE-AREA.
>    05 FILLER              PIC X(10).
>    05 W-COMPUTE-DATA-1    PIC 9(12)V9(02).
>    05 W-COMPUTE-DATA-2    PIC 9(12)V9(02).
>    05 W-COMPUTE-DATA-3    PIC 9(12)V9(02).
>    05 W-COMPUTE-DATA-4    PIC 9(12)V9(02).
>    05 W-COMPUTE-DATA-5    PIC 9(12)V9(02).

> 01 W-EDIT-AREA.
>    05 FILLER              PIC X(10).
>    05 W-EDIT-DATA-1       PIC $$$$$$$$$$$9.99.
>    05 W-EDIT-DATA-2       PIC $$$$$$$$$$$9.99.
>    05 W-EDIT-DATA-3       PIC $$$$$$$$$$$9.99.
>    05 W-EDIT-DATA-4       PIC $$$$$$$$$$$9.99.
>    05 W-EDIT-DATA-5       PIC $$$$$$$$$$$9.99.

>       In PROCEDURE DIVISION  if I am moving group level variable
>             (like
>               MOVE W-COMPUTE-AREA TO W-EDIT-AREA.
>              )
>       I am not getting the field edited in W-EDIT-AREA for example

>  W-COMPUTE-DATA-1 has value 000000000012.05 then
>  W-EDIT-DATA-1    has value 00000000001205

>      whereas if I am moving sub-group level variable individually
>              ( like
>                    MOVE W-COMPUTE-DATA-1 TO W-EDIT-DATA-1.
>                    MOVE W-COMPUTE-DATA-2 TO W-EDIT-DATA-2.
>                    MOVE W-COMPUTE-DATA-3 TO W-EDIT-DATA-3.
>                    MOVE W-COMPUTE-DATA-4 TO W-EDIT-DATA-4.
>                    MOVE W-COMPUTE-DATA-5 TO W-EDIT-DATA-5.
>              )
>   then I am getting the edited data for example

>  W-COMPUTE-DATA-1 has value 000000000012.05 then
>  W-EDIT-DATA-1    has value          $12.05

>                  I am not getting why this is happening?
> Thanks in advance.

Group moves are treated as elementary alphnumeric moves. The entire sending
group is copied without change to the receiving group. It matters not what
the PIC definitions of the sending or receiving surbordinate fields contain
(other than the implied length).

In your case, a MOVE W-COMPUTE-AREA TO W-EDIT-AREA proceeds as if you had
defined:

01  W-COMPUTE-AREA  PIC X(80).
01  W-EDIT-AREA  PIC X(85).

Note your receiving field is five bytes bigger than the sending field, so
the move blank-fills the last five bytes.

So, yes, you have to do it the hard way.

Hint: You can define W-EDIT-x as PIC $(11)9.99.



Mon, 15 Nov 2004 22:07:57 GMT  
 Group level move vs sub-group level move.


Quote:
> Hi,
>             I am facing editing problem in cobol.In my cobol program I
have two
> area in working storage as follows:

> 01 W-COMPUTE-AREA.
>    05 FILLER              PIC X(10).
>    05 W-COMPUTE-DATA-1    PIC 9(12)V9(02).
>    05 W-COMPUTE-DATA-2    PIC 9(12)V9(02).
>    05 W-COMPUTE-DATA-3    PIC 9(12)V9(02).
>    05 W-COMPUTE-DATA-4    PIC 9(12)V9(02).
>    05 W-COMPUTE-DATA-5    PIC 9(12)V9(02).

> 01 W-EDIT-AREA.
>    05 FILLER              PIC X(10).
>    05 W-EDIT-DATA-1       PIC $$$$$$$$$$$9.99.
>    05 W-EDIT-DATA-2       PIC $$$$$$$$$$$9.99.
>    05 W-EDIT-DATA-3       PIC $$$$$$$$$$$9.99.
>    05 W-EDIT-DATA-4       PIC $$$$$$$$$$$9.99.
>    05 W-EDIT-DATA-5       PIC $$$$$$$$$$$9.99.

>       In PROCEDURE DIVISION  if I am moving group level variable
>             (like
>               MOVE W-COMPUTE-AREA TO W-EDIT-AREA.
>              )
>       I am not getting the field edited in W-EDIT-AREA for example

>  W-COMPUTE-DATA-1 has value 000000000012.05 then
>  W-EDIT-DATA-1    has value 00000000001205

>      whereas if I am moving sub-group level variable individually
>              ( like
>                    MOVE W-COMPUTE-DATA-1 TO W-EDIT-DATA-1.
>                    MOVE W-COMPUTE-DATA-2 TO W-EDIT-DATA-2.
>                    MOVE W-COMPUTE-DATA-3 TO W-EDIT-DATA-3.
>                    MOVE W-COMPUTE-DATA-4 TO W-EDIT-DATA-4.
>                    MOVE W-COMPUTE-DATA-5 TO W-EDIT-DATA-5.
>              )
>   then I am getting the edited data for example

>  W-COMPUTE-DATA-1 has value 000000000012.05 then
>  W-EDIT-DATA-1    has value          $12.05

>                  I am not getting why this is happening?
> Thanks in advance.

That is what is suppose to happen, so your program is working correctly.

The 01 level data names are not edited fields.  They can be considered as
X(80) fields ... the 80 is the total of the data fields in them.  The group
move is a move from one X(80) field to another. The individual moves are
moves of numeric data to edit fields, and will trigger the data conversion.



Mon, 15 Nov 2004 22:17:47 GMT  
 Group level move vs sub-group level move.
You may need to rename some variables, but MOVE CORRESPONDING might be
promising....

MCM


Quote:



> > Hi,
> >             I am facing editing problem in cobol.In my cobol program I
> have two
> > area in working storage as follows:

> > 01 W-COMPUTE-AREA.
> >    05 FILLER              PIC X(10).
> >    05 W-COMPUTE-DATA-1    PIC 9(12)V9(02).
> >    05 W-COMPUTE-DATA-2    PIC 9(12)V9(02).
> >    05 W-COMPUTE-DATA-3    PIC 9(12)V9(02).
> >    05 W-COMPUTE-DATA-4    PIC 9(12)V9(02).
> >    05 W-COMPUTE-DATA-5    PIC 9(12)V9(02).

> > 01 W-EDIT-AREA.
> >    05 FILLER              PIC X(10).
> >    05 W-EDIT-DATA-1       PIC $$$$$$$$$$$9.99.
> >    05 W-EDIT-DATA-2       PIC $$$$$$$$$$$9.99.
> >    05 W-EDIT-DATA-3       PIC $$$$$$$$$$$9.99.
> >    05 W-EDIT-DATA-4       PIC $$$$$$$$$$$9.99.
> >    05 W-EDIT-DATA-5       PIC $$$$$$$$$$$9.99.

> >       In PROCEDURE DIVISION  if I am moving group level variable
> >             (like
> >               MOVE W-COMPUTE-AREA TO W-EDIT-AREA.
> >              )
> >       I am not getting the field edited in W-EDIT-AREA for example

> >  W-COMPUTE-DATA-1 has value 000000000012.05 then
> >  W-EDIT-DATA-1    has value 00000000001205

> >      whereas if I am moving sub-group level variable individually
> >              ( like
> >                    MOVE W-COMPUTE-DATA-1 TO W-EDIT-DATA-1.
> >                    MOVE W-COMPUTE-DATA-2 TO W-EDIT-DATA-2.
> >                    MOVE W-COMPUTE-DATA-3 TO W-EDIT-DATA-3.
> >                    MOVE W-COMPUTE-DATA-4 TO W-EDIT-DATA-4.
> >                    MOVE W-COMPUTE-DATA-5 TO W-EDIT-DATA-5.
> >              )
> >   then I am getting the edited data for example

> >  W-COMPUTE-DATA-1 has value 000000000012.05 then
> >  W-EDIT-DATA-1    has value          $12.05

> >                  I am not getting why this is happening?
> > Thanks in advance.

> That is what is suppose to happen, so your program is working correctly.

> The 01 level data names are not edited fields.  They can be considered as
> X(80) fields ... the 80 is the total of the data fields in them.  The
group
> move is a move from one X(80) field to another. The individual moves are
> moves of numeric data to edit fields, and will trigger the data
conversion.



Mon, 15 Nov 2004 23:34:18 GMT  
 Group level move vs sub-group level move.

enlightened us:

Quote:



>> Hi,
>>             I am facing editing problem in cobol.In my cobol program I
>have two
>> area in working storage as follows:

>> 01 W-COMPUTE-AREA.
>>    05 FILLER              PIC X(10).
>>    05 W-COMPUTE-DATA-1    PIC 9(12)V9(02).
>>    05 W-COMPUTE-DATA-2    PIC 9(12)V9(02).
>>    05 W-COMPUTE-DATA-3    PIC 9(12)V9(02).
>>    05 W-COMPUTE-DATA-4    PIC 9(12)V9(02).
>>    05 W-COMPUTE-DATA-5    PIC 9(12)V9(02).

>> 01 W-EDIT-AREA.
>>    05 FILLER              PIC X(10).
>>    05 W-EDIT-DATA-1       PIC $$$$$$$$$$$9.99.
>>    05 W-EDIT-DATA-2       PIC $$$$$$$$$$$9.99.
>>    05 W-EDIT-DATA-3       PIC $$$$$$$$$$$9.99.
>>    05 W-EDIT-DATA-4       PIC $$$$$$$$$$$9.99.
>>    05 W-EDIT-DATA-5       PIC $$$$$$$$$$$9.99.

>>       In PROCEDURE DIVISION  if I am moving group level variable
>>             (like
>>               MOVE W-COMPUTE-AREA TO W-EDIT-AREA.
>>              )
>>       I am not getting the field edited in W-EDIT-AREA for example

>>  W-COMPUTE-DATA-1 has value 000000000012.05 then
>>  W-EDIT-DATA-1    has value 00000000001205

>>      whereas if I am moving sub-group level variable individually
>>              ( like
>>                    MOVE W-COMPUTE-DATA-1 TO W-EDIT-DATA-1.
>>                    MOVE W-COMPUTE-DATA-2 TO W-EDIT-DATA-2.
>>                    MOVE W-COMPUTE-DATA-3 TO W-EDIT-DATA-3.
>>                    MOVE W-COMPUTE-DATA-4 TO W-EDIT-DATA-4.
>>                    MOVE W-COMPUTE-DATA-5 TO W-EDIT-DATA-5.
>>              )
>>   then I am getting the edited data for example

>>  W-COMPUTE-DATA-1 has value 000000000012.05 then
>>  W-EDIT-DATA-1    has value          $12.05

>>                  I am not getting why this is happening?
>> Thanks in advance.

>Group moves are treated as elementary alphnumeric moves. The entire sending
>group is copied without change to the receiving group. It matters not what
>the PIC definitions of the sending or receiving surbordinate fields contain
>(other than the implied length).

>In your case, a MOVE W-COMPUTE-AREA TO W-EDIT-AREA proceeds as if you had
>defined:

>01  W-COMPUTE-AREA  PIC X(80).
>01  W-EDIT-AREA  PIC X(85).

>Note your receiving field is five bytes bigger than the sending field, so
>the move blank-fills the last five bytes.

>So, yes, you have to do it the hard way.

>Hint: You can define W-EDIT-x as PIC $(11)9.99.

To add on to what Jerry has written, here's another way to make the
task a little easier (if this change is allowed):

Change you data descriptions to:

01 W-COMPUTE-AREA.
     05 FILLER              PIC X(10).
     05  W-COMPUTE-DATA-AREA.
           07 W-COMPUTE-DATA-1    PIC 9(12)V9(02).
           07 W-COMPUTE-DATA-2    PIC 9(12)V9(02).
           07 W-COMPUTE-DATA-3    PIC 9(12)V9(02).
           07 W-COMPUTE-DATA-4    PIC 9(12)V9(02).
           07 W-COMPUTE-DATA-5    PIC 9(12)V9(02).
     05  W-COMPUTE-DATA-TBL REDEFINES W-COMPUTE-DATA-AREA
           OCCURS 5 TIMES               PIC 9(12)V99.

01 W-EDIT-AREA.
     05 FILLER              PIC X(10).
     05  W-EDIT-DATA-AREA.
           07 W-EDIT-DATA-1       PIC $$$$$$$$$$$9.99.
           07 W-EDIT-DATA-2       PIC $$$$$$$$$$$9.99.
           07 W-EDIT-DATA-3       PIC $$$$$$$$$$$9.99.
           07 W-EDIT-DATA-4       PIC $$$$$$$$$$$9.99.
           07 W-EDIT-DATA-5       PIC $$$$$$$$$$$9.99.
      05  W-EDIT-DATA-TBL REDEFINES W-EDIT-DATA-AREA
            OCCURS 5 TIMES        PIC $(11)9.99.

Then add somewhere in Working Storage:

01  WS-SUBSCRIPT                 PIC S9999   VALUE +0  COMP.

Then in your procedure division where appropriate you can put the
following inline perform:

PERFORM VARYING WS-SUBSCRIPT FROM +1 BY +1
                   UNTIL WS-SUBSCRIPT GREATER THAN +5
                       MOVE W-COMPUTE-DATA-TBL (WS-SUBSCRIPT) TO
                                   W-EDIT-DATA-TBL (WS-SUBSCRIPT)
END-PERFORM.

Note:  This example assumes mainframe IBM Cobol or compatible
compiler.

Regards,

          ////
         (o o)
-oOO--(_)--OOo-

Blessed are the flexible for they shall not be bent out of shape.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Remove nospam to email me.

Steve



Tue, 16 Nov 2004 00:07:21 GMT  
 Group level move vs sub-group level move.

[much snippage]

Quote:
> 01 W-EDIT-AREA.
>      05 FILLER              PIC X(10).
>      05  W-EDIT-DATA-AREA.
>            07 W-EDIT-DATA-1       PIC $$$$$$$$$$$9.99.
>            07 W-EDIT-DATA-2       PIC $$$$$$$$$$$9.99.
>            07 W-EDIT-DATA-3       PIC $$$$$$$$$$$9.99.
>            07 W-EDIT-DATA-4       PIC $$$$$$$$$$$9.99.
>            07 W-EDIT-DATA-5       PIC $$$$$$$$$$$9.99.
>       05  W-EDIT-DATA-TBL REDEFINES W-EDIT-DATA-AREA
>             OCCURS 5 TIMES        PIC $(11)9.99.

> Then add somewhere in Working Storage:

> 01  WS-SUBSCRIPT                 PIC S9999   VALUE +0  COMP.

And one way to define somewhere is right there with the OCCURS, viz:

       05  W-EDIT-DATA-TBL REDEFINES W-EDIT-DATA-AREA
             OCCURS 5 TIMES  INDEXED BY WS-SUBSCRIPT
             PIC $(11)9.99.



Tue, 16 Nov 2004 21:45:10 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Sub level to level 77

2. Moving knowledge to mouse reflex level.

3. Move a frame between top-level windows

4. 01 Level vs. 77 Level

5. Puget Sound Smalltalk User Group website has moved

6. Moving Group field to single field?

7. X3D adopted by Moving Picture Experts Group (MPEG) for MPEG-4 standard

8. moving groups of text items on a canvas

9. USAGE POINTER at the group level

10. re.group vs re.groups

11. Rexx/PalmOS group on Yahoo (http://groups.yahoo.com/group/r-e-x-x_palmos/)

12. click the link for the best google group http://groups-beta.google.com/group/boysworld

 

 
Powered by phpBB® Forum Software