Software development, photography, jokes, ....

Sites by me

 
tas-logoTransportation Administration System
snoezelkussen-logo-kleinstSnoezelen Pillows for Dementia
ikzoekeenbegeleider-logoBegeleiders voor gehandicapten
Laat uw hond het jaarlijkse vuurwerk overwinnen
Betuweroute en Kunst
logo 50x50Hey Vos! Je eigen naam@vos.net emailadres?
Kunst in huis? Nicole Karrèr maakt echt bijzonder mooie dingen
nettylogo2Kunst in huis? Netty Franssen maakt ook bijzonder mooie dingen
Professionele opvang bij Gastouderbureau
Kind-Zijn
Salarisadministratie en belastingadvies bij
De Zaak Loont
Zutphense Bomenstichting

Hosting Favorites

 
ANU Internet Services
XelMedia .internet services
register.com
GoDaddy.com

Blogroll

 
Bomenstichting
MacFreak
Google Translate
PHP
MySQL
jQuery
jQuery UI
codecademy
YourHead Stacks API
Favicon Generator. For real.
Check HTTPS problems



Marc's Place

 

FN_E$DCP - Decompose ?-separated data

Inclusion in RPG source

C /COPY E$LIB/SRC(ILE),FN_E$DCP

Invocation

EXSR E$DCP

Input Parameters

@DCP (a256)
Field to contain data to decompose.
 
@DCC (a1)
Decomposition character. The character that separates the values from each-other.

Output Parameters

@DCR (a256)
Field which contains one column of decomposed data, after each subsequent call to E$DCP.

What it does

The routine walks through a text string which holds columns with data, separated by a certain character, mostly a TAB or a SEMI-COLON. This character can be set in the input parameter @DCC (DeComposition Character). If @DCC is blank at the time of the call, the routine defaults to a COLON.
 
Example strings with data:
  • 'asdasd;sdsdf;sadfsd;23432;324;;;123;qss'
  • 'asdasd:sdsdf:sadfsd:23432:324:::123:qss'
  • 'asdasd,sdsdf,sadfsd,23432,324,,,123,qss'
 
With each call, the next column is processed and returned in the field @DCR (DeComposition Result).

Examples

 * If you know how many columns your DBDATA has:
 *                                                          
C                     MOVEL';'       @DCC
C                     MOVELDBDATA    @DCP      P
C                     EXSR E$DCP
C                     MOVEL@DCR      DBCOL1    P
C                     EXSR E$DCP
C                     MOVEL@DCR      DBCOL2    P
 * A number, right align it in the alphanumeric field
C                     EXSR E$DCP                
C                     MOVEL@DCR      @ALR      P
C                     EXSR E$ALR                
C                     MOVE @ALR      DBNUM3
 *                                                          
 * If you don't know in advance how many columns to process,
 * you can test the internal column counter @DX if it has
 * reached zero. This counter counts the number of columns
 * to process at the first call. When it has reached zero,
 * you're done:              
 *
 * Create a TAB character
C                     MOVEL*BLANKS   TAB     1              
C                     BITOF'01234567'TAB 
C                     BITON'57'      TAB 
 * and use it as the separation character
C                     MOVELTAB       @DCC               
 *
C                     MOVELDBDATA    @DCP      P        
C                     EXSR E$DCP
C                     MOVEL@DCR      DBCOL1    P        
C           @DX       CABEQ*ZEROS    TAG99
C                     EXSR E$DCP
C                     MOVEL@DCR      DBCOL2    P
C           @DX       CABEQ*ZEROS    TAG99
C                     EXSR E$DCP
C                     MOVEL@DCR      DBCOL3    P
C                     ...
*
 
Go to download page
© 1997- Marc Vos (and others)   -   Privacy Statement   -    Contact Me