How to convert A00073 value to 9973 in progress 4gl

前端 未结 5 1860
日久生厌
日久生厌 2021-01-29 04:37

i have column having multiple value like A0045 ,A00065 . i want to convert it 9945, 9965. Need to remove all 0 and character value and add 99 before that value.. Please help..

5条回答
  •  野的像风
    2021-01-29 05:31

    This can be done in many ways. Here is one way (may not be the best). As I don't have a database, I created a temp table.

    def temp-table tt 
        field val as char.
    
    create tt.
    tt.val = "A0045".
    
    create tt.
    tt.val = "A00065".
    
    for each tt:
        run filter_zero(input-output val).
        val = replace(val,"A","99").
        DISP val.
    end.
    
    procedure filter_zero:
        define input-output parameter val  as character.
    
        // remvoe all zeroes 
        repeat while val matches("*0*"): 
            val = replace(val,"0","").
        end.
    
    end procedure.
    

提交回复
热议问题