I have an input file with variable length records less than 90. I want to convert this into a fixed length 111 record.
1. I need to read sequentially the entire record into one string variable that will contain the entire record.
2. I need to strip off the ending CrLf.
3. I need to change the variable length records into a fixed length UDT of 111.
4. I need the difference of the variable length and the fixed length to be spaces.
Here is the code I tried --> Failed, because the name field of the input record had a comma in them an the input statement stopped at the first comma. Is there a way to read sequentially the entire record ignoring the comma delimitation?
Detail As String * 111
EndOfLine As String * 2
Dim gCnvCHSEFTRec As CnvCHSEFTRec
Dim strInCHSEFTFileName As String
Dim strOutCHSEFTFileName As String
Dim lngCnvCHSEFTRecLen As Long
Dim strInRec As String
Dim strInRec2 As String
Dim strOutRec As String
Dim strSpacesRec As String
Dim intInRecLen As Integer
Dim intStartPtr As Integer
Dim intRemainLen As Integer
Const gIN_CHS_EFT_FILE_NBR As Integer = 1
Const gOUT_CHS_EFT_FILE_NBR As Integer = 2
strInCHSEFTFileName = "\\IN\EFTFILE.TXT"
strOutCHSEFTFileName = "\\OUT\EFTFILE.TXT"
Open strInCHSEFTFileName For Input As gIN_CHS_EFT_FILE_NBR
Open strOutCHSEFTFileName For Output As gOUT_CHS_EFT_FILE_NBR
Do Until EOF(gIN_CHS_EFT_FILE_NBR)
Input #gIN_CHS_EFT_FILE_NBR, strInRec
intInRecLen = Len(strInRec)
Mid(strInRec, intInRecLen - 2, 2) = ""
intStartPtr = intInRecLen + 1
gCnvCHSEFTRec.Detail = ""
strSpacesRec = gCnvCHSEFTRec.Detail
intRemainLen = Len(gCnvCHSEFTRec.Detail) - intInRecLen
gCnvCHSEFTRec.Detail = Mid(strInRec, 1, intInRecLen) + Mid(strSpacesRec, intStartPtr, intRemainLen)
gCnvCHSEFTRec.EndOfLine = vbCrLf
strOutRec = gCnvCHSEFTRec.Detail + gCnvCHSEFTRec.EndOfLine
Write #gOUT_CHS_EFT_FILE_NBR, strOutRec
Please show me what I need to do to correct my logic...