Ü MOVE (Move)

·         The MOVE operation transfers characters from factor 2 to the result field.

·         Moving starts with the rightmost character of factor 2.

·         When moving Date, Time or Timestamp data, factor 1 must be blank unless either the source or the target is a character or numeric field.

·         If factor 2 is longer than the result field, the excess leftmost characters or digits of factor 2 are not moved.

·         If the result field is longer than factor 2, the excess leftmost characters or digits in the result field are unchanged, unless padding is specified.

·         If factor 2 is shorter than the length of the result field, a P specified in the operation extender position causes the result field to be padded on the left after the move occurs.

·         A MOVE operation does not change the length of a variable-length result field.

·         If the source or target is a character field, you may optionally indicate the separator following the format in factor 1. Only separators that are valid for that format are allowed.

 

Factor 1

Op-code

Factor 2

Result Field

Resulting Indicators

       HI                            LO                      EQ

Data attribute

MOVE

Source field 

Target field

 

 

 

 

 


Example

    I.        MOVE Operation with Date/Time

 


Columns . . . :    6  80               Browse                                AMINEM/QRPGLESRC
SEU==>                                                                                OP_MOVE
FMT D  DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++++
*************** Beginning of data ****************************************************
0001.00 DDATE0            S               D                                             130124
0002.00 DDATE1            S               D                                             130129
0003.00 DDATE2            S               D   DATFMT(*JIS)                              130129
0004.00 DDATE3            S               D   INZ(D'2001-01-12')                        130129
0005.00 DDATE3_CHAR       S             10                                              130129
0006.00 DTIME0            S               T   INZ(T'10.12.15')                          130129
0007.00 DTIME0_CHAR       S              8                                              130129
0008.00 C                   MOVE      *DATE         DATE0                               130129
0009.00 C     *MDY          MOVE      010112        DATE1                               130129
0010.00 C     *MDY/         MOVE      '01/01/12'    DATE2                               130129
0011.00 C                   MOVE      DATE3         DATE3_CHAR                          130129
0012.00 C                   MOVE      TIME0         TIME0_CHAR                          130129
0013.00 C     DATE0         DSPLY                                                       130124
0014.00 C     DATE1         DSPLY                                                       130124
0015.00 C     DATE2         DSPLY                                                       130129
0016.00 C     DATE3_CHAR    DSPLY                                                       130129
0017.00 C     TIME0_CHAR    DSPLY                                                       130129
0018.00 C                   SETON                                            LR         130124
****************** End of data *******************************************************

 

OUTPUT

DSPLY  2013-01-29

DSPLY  2012-01-01

DSPLY  2012-01-01

DSPLY  2001-01-12

DSPLY  10.12.15 

 


II.     MOVE Operation with Date/Time

 

 


Columns . . . :    6  80                        Browse                        AMINEM/QRPGLESRC
SEU==>                                                                                OP_MOVE1
FMT D  DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++++
*************** Beginning of data ****************************************************
0001.00 D A1              S              5A   INZ('AAAA') VARYING                       130129
0002.00 D A2              S             10A   INZ('AAAAAAAA') VARYING                   130129
0003.00 D A3              S             20A   INZ('AAAAAAAAAAAA') VARYING               130129
0004.00 D B1              S              5A   INZ('BBBBB')                              130129
0005.00 D B2              S             10A   INZ('BBBBBBBBBB')                         130129
0006.00 D B3              S             20A   INZ('BBBBBBBBBBBBBBBBBBBB')               130129
0007.00 D C1              S              5A   INZ('CCC') VARYING                        130129
0008.00 D C2              S             10A   INZ('CCCCCCC') VARYING                    130129
0009.00 D C3              S             20A   INZ('CCCCCCCCCCCCCCCCC') VARYING          130129
0010.00 C     A1            DSPLY                                                       130129
0011.00 C     A2            DSPLY                                                       130129
0012.00 C     A3            DSPLY                                                       130129
0013.00 C     B1            DSPLY                                                       130129
0014.00 C     B2            DSPLY                                                       130129
0015.00 C     B3            DSPLY                                                       130129
0016.00 C     C1            DSPLY                                                       130129
0017.00 C     C2            DSPLY                                                       130129
0018.00 C     C3            DSPLY                                                       130129
0019.00 C                   MOVE      A1            B2                                  130129
0020.00 C                   MOVE      A2            B3                                  130129
0021.00 C                   MOVE      A3            B1                                  130129
0022.00 C                   MOVE      B1            C3                                  130129
0023.00 C                   MOVE      B2            C1                                  130129
0024.00 C                   MOVE      B3            C2                                  130129
0025.00 C                   MOVE      C1            A3                                  130129
0026.00 C                   MOVE      C2            A1                                  130129
0027.00 C                   MOVE      C3            A2                                  130129
0028.00 C     A1            DSPLY                                                       130129
0029.00 C     A2            DSPLY                                                       130129
0030.00 C     A3            DSPLY                                                       130129
0031.00 C     B1            DSPLY                                                       130129
0032.00 C     B2            DSPLY                                                       130129
0033.00 C     B3            DSPLY                                                       130129
0034.00 C     C1            DSPLY                                                       130129
0035.00 C     C2            DSPLY                                                       130129
0036.00 C     C3            DSPLY                                                       130129
0037.00 C                   SETON                                            LR         130129
****************** End of data *******************************************************


OUTPUT

DSPLY  AAAA               

DSPLY  AAAAAAAA          

DSPLY  AAAAAAAAAAAA        

DSPLY  BBBBB                          

DSPLY  BBBBBBBBBB                     

DSPLY  BBBBBBBBBBBBBBBBBBBB           

DSPLY  CCC                            

DSPLY  CCCCCCC                        

DSPLY  CCCCCCCCCCCCCCCCC              

DSPLY  AAAA                        

DSPLY  CCCAAAAA                    

DSPLY  AAAAAAAAAAAA                

DSPLY  AAAAA                       

DSPLY  BBBBBBAAAA                  

DSPLY  BBBBBBBBBBBBAAAAAAAA        

DSPLY  AAA                         

DSPLY  AAAAAAA                     

DSPLY  CCCCCCCCCCCCAAAAA                    

 

 

 

 

*** As we know that Moving starts with the rightmost character of factor 2. So, we derive the result here on the basis of this fact, as shown below.

 

1.  MOVE      A1            B2  

MOVE pic 1

          Result:  B2= BBBBBBAAAA

 

 

 

2.  MOVE      A3            B1  

 MOVE pic 2

 

          Result:  B1= AAAAA

 

 

 

 

3.  MOVE      B3            C2  

 

MOVE pic 3

           Result:  C2= AAAAAAA

 

4.  MOVE      C3            A2  

 

MOVE pic 4

           Result:  A2= CCCAAAAA

 

 











User Comments:



Copyright © www.go4as400.com, 2013-2023. Copyright notice   Terms of services   Privacy policy