I'm having trouble parsing a CSV from a text file and was wondering if you guys could assist me. So far I have the following,
The CSV file (DATA.txt) looks something like this, it will always have 15 fields all separated by a comma. Not all fields are mandatory so some will be filled and some are blank.
Seattle,Lastname,Firstname,DOB,SEX,etc,etc
Seattle,Lastname,Firstname,DOB,,etc,etc
Portland,Lastname,Firstname,DOB,SEX,,,etc
Portland,Lastname,Firstname,DOB,SEX,etc,etc
And here is my REXX Code
SOURCEFILE = "C:\DATA\DATA.TXT"
IF A=2 THEN DO COUNTER=1 TO LINES(SOURCEFILE)
PARSE VALUE LINEIN(SOURCEFILE) WITH CITY "," LAST_NAME "," FIRST_NAME "," MOM_NAME "," MIDDLE_NAME "," DAD_NAME "," DOB "," etc "," etc "," etc "," etc "," SEX "," etc "," etc
CALL SETCURSOR 4,23
CALL CREATEDATA
END
CREATEDATA:
CALL TYPE CITY
CALL PRESS TAB
CALL TYPE LAST_NAME
CALL PRESS TAB
CALL TYPE DATE(U)
CALL PRESS TAB
CALL TYPE FIRST_NAME
CALL PRESS TAB
CALL PRESS ENTER
RETURN
I'm not sure if I should be using ARG or VAR when parsing or if I wrote first two lines correctly. I know for fact that my CREATEDATA function works properly because I'm getting the "CITY" typed in but not the parsed value. Any help would be very much appreciated. Thank you!