compile subroutine gl_acct_srl_valid(ConvType, DataIo, Branch, ReturnedValue)
begin condition
pre:
post:
end condition
declare function msg, fieldcount, get_property

$insert msg_equates
$insert popup_equates
$INSERT LOGICAL

equ valid$         to 0    ;* successful
equ invalid_msg$   to 1    ;* bad data       -   print error message window
equ invalid_conv$  to 2    ;* bad conversion -          "         "
equ invalid_nomsg$ to 3    ;* bad but do not print the error message window
equ CrLf$          to char(13):char(10)

PopupId = 'LSL2**GL_ACCTS_SRL'
ReturnedValue = DataIo       
status() = Valid$
begin case
   case ConvType = 'ICONV'
       GlAcctInfo = xlate( 'SYSREPOSPOPUPS', PopupId, pdisplay$, 'X' )
       * build array of codes only
       GlCodes = ''
       GlCnt = fieldcount( GlAcctInfo, @vm )
       for i = 1 to GlCnt
           GlCodes := GlAcctInfo<1,i,1>:@fm
       next i
       GlCodes[-1,1] = ''
       locate DataIo in GlCodes using @fm setting Fpos else
           MsgInfo = ''
           MsgInfo<mtext$> = quote( DataIo ):' is not a valid SRL General Ledger Account.'
           MsgInfo<micon$> = '!'
           Void = msg( '', MsgInfo )
           status() = invalid_nomsg$
       end
   case ConvType = 'OCONV'
      * no output
      ReturnedValue = DataIo
   case otherwise$
      ReturnedValue = ''
      status() = invalid_conv$
end case
return

