Hi,
Need help on trimming cobol string using INSPECT or PERFORM.
I have a string in this format with delimeters: (01)SSN(02)MobileNumber(03)DateApplied(04)DateApproved
The only required field is the SSN, others can be blank. So, if I only have SSN and Date Applied, string would be (01)SSN(02)...........(03)DateApplied(04) ............
Note: The (......) represents the spaces.
What I need is to trim the fields with blank value so that I will have something like this: 01)SSN(03)DateApplied.
TIA!
MOVE 1 TO OUTPUT-LOC
PERFORM
VARYING INPUT-LOC FROM 1 BY 1
UNTIL INPUT-LOC > LENGTH OF <input string>
IF <input string> (INPUT-LOC : 1) NE SPACE
MOVE <input string> (INPUT-LOC : 1)
TO <output-string> (OUTPUT-LOC : 1)
ADD 1 TO OUTPUT-LOC
END-IF
END-PERFORM