Ü  XFOOT (sum-up the array element)

·         Lookup: It is used to look for an element in the array.

·         Sorta: It is used to sort the array element

·         Xfoot: It is used to sum-up the array element.

 

Example


Columns . . . :    1 100                                      Browse
SEU==>
FMT D  .....DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords++++++++++++++++++++++++++
*************** Beginning of data *******************************************
0001.00      darr2             s              3P 0 dim(5) ctdata perrcd(1)
0002.00      dn                s              2p 0 inz(1)
0003.00      C     n             do        5
0004.00      C     arr2(n)       dsply
0005.00      C                   eval      n=n+1
0006.00      C                   enddo
0007.00      C                   sorta     arr2
0008.00      C                   eval      n=1
0009.00      C     n             do        5
0010.00      C     arr2(n)       dsply
0011.00      C                   eval      n=n+1
0012.00      C                   enddo
0013.00      C     204           lookup    arr2                                   81
0014.00      C                   if        *in81=*on
0015.00      C     'found'       dsply
0016.00      C                   endif
0017.00      C                   xfoot     arr2          sum               4 0
0018.00      C     sum           dsply
0019.00      c                   seton                                        lr
0020.00 ** CTDATA arr2
0021.00 201
0022.00 205
0023.00 203
0024.00 202
0025.00 204
****************** End of data ************************************************

 

 

OUTPUT

 

DSPLY  201   

DSPLY  205   

DSPLY  203   

DSPLY  202   

DSPLY  204   

DSPLY  201   

DSPLY  202   

DSPLY  203   

DSPLY  204   

DSPLY  205   

DSPLY  found 

DSPLY  1015  

 

 











User Comments:



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