Example 1 Sub stringing a Field

LANSA for i

Example 1: Sub-stringing a Field

Break real field CHTACC (alpha 8 - chart of accounts) down into 3 virtual fields called COMPNO (alpha 2 - company number), DIVNUM (alpha 2 - division number) and COSTCT (alpha 4 - cost center).

Step 1 - Define the Virtual Fields

 

 

     Seq    Name__________ Description______________________

      10    COMPNO         Company number

      20    DIVNUM         Division number

      30    COSTCT         Cost centre

 

 

Step 2 - Input RPG Section "Calculations After Input From File"

C*

C* VC_USING FIELDS(CHTACC COMPNO DIVNUM COSTCT)

C*

C                     MOVELCHTACC    COMPNO

C                     MOVELCHTACC    CHAR04  4

C                     MOVE CHAR04    DIVNUM

C                     MOVE CHTACC    COSTCT

Note the use of "work" field CHAR04. It is not referred to in the VC_USING command as it not part of the file definition.