How to convert a fone file to a delimited file using Reformat
The attached spec PHONELAYOUT.QPX builds a QFF file that can be used to convert a phone file to a delimited file using Reformat.
''Set the following define to 10,50, or 99 depending upon how many histories you save in your phone file. Setting this higher will just create more variables.>Define @MaxHistory 10Use this define if you are doing international dialing and want to pick up more than 10 digits in the phone number.'>Define @InternationalUse this define if you want to have the status codes print as text. I.E. Have 101 print as No AnswerIf you use this option, you should find the define in the spec and make sure the text on the response coees matches your definitions. There is a Mentor spec at the bottom of the run that will convert your fonestat file to a recode table that can be brought in there.>Define @StatusCodesAsTextUse this define if you want to break the call back time down into smaller pieces like year, month, day, hour, & minute rather than 1 long string.'>Define @BrkUpCBTimeThe following two defines are used to determine how to handle the call history information. First define puts out each history as it own data field. Second one breaks each history into its component parts (date,time,status,intid, etc) Use neither to get no history information or use both to get both formats.>Define @HistoryFull>Define @HistoryPartsYou can add your own variables in the text area in the !!!! section.''************************************************************************************>PurgeSame>AllowIndent>FillDefineInQuotes>EchoDefines~Prep Compile Specs[Phonelayout,16000,CaseID=1.10,MaxQuestionSize=1000000]>IfDefine @International{ Phone_Number: 1.19 !NUM } ''Phone number>Else{ Phone_Number: 1.10 !NUM } ''Phone number{ Area_Code: 1.3 !NUM } ''Phone number area code{ Prefix: 4.3 !NUM } ''Phone number prefix{ Suffix: 7.3 !NUM } ''Phone number suffix>Endif{ Special_Type: 22.1 !NUM } ''Special interviewer type (1-9){ Time_Zone: 23.2 !NUM } ''Time zone (01-24 or A5-X5){ CaseIDEx: 25.6 !VAR } ''First 6 characters of existing case mode ID>IfDefine @BrkUpCBTime{CallBack_Year: 31.2 !VAR } '' Year next call scheduled for{CallBack_Month: 33.2 !VAR } '' Month next call scheduled for{CallBack_Day: 35.2 !VAR } '' Day next call scheduled for{CallBack_Hour: 37.2 !VAR } '' Hour next call scheduled for{CallBack_Min: 39.2 !VAR } '' Minute next call scheduled for{CallBack_DayOfWk: 41.1 !VAR } '' Day of week next call scheduled for{CallBack_J_Date: 42.3 !VAR } '' Julian date next call scheduled for>Else{ Callback_Time: 31.12 !VAR } ''Callback time (yyyymmddhhmm){ Callback_Info: 43.4 !VAR } ''Callback Time Info (jjjd)>Endif{ Replicate: 47.3 !NUM } ''Replicate number (001-999)''!!!!! You can add your own variables here to have the text area broken into meaningful variables rather than 9 100 column chucks>Repeat $A=0051,0151,...,4851; $B=01,...,49{FoneTextArea$B: $A.100 !VAR } ''Text Area $B>Endrepeat{ Time_On_Number: 5000.5 !NUM } ''Total time in seconds on number{ Attempts_Made: 5005.5 !NUM } ''Number of attempts to number{ Previous_Stack: 5010.5 !NUM } ''Previos stack came from (last call){ Bucket: 5015.5 !NUM } ''Time zone bucket (0-9; -1 if not in grid){ Stack_Number: 5020.5 !NUM } ''Current calling stack number is in{ Hidden_Stack: 5025.5 !NUM } ''Stack number was in when last hidden{ History_Note_Len: 5038.3 !NUM } ''Length of call history field{ Phone_Text_Len: 5041.3 !NUM } ''Length of phone text area{ In_Error_Stack: 5044.1 !NUM } ''Whether in "error" stack (1=yes){ Approx_Timed: 5045.1 !NUM } ''Whether was 'Approximate time' call{ Phonefileversion: 5046.2 !NUM } ''Phone file version{ Resume_File: 5048.8 !VAR } ''Name of file to resume if suspended{ Suspended: 5057.1 !NUM } ''Whether suspended (1=yes){ Phone_Says: 5058.5 !NUM } ''Whether used existing caseid from 25.10{ Num_Writes: 5063.5 !NUM } ''Number of times phone file written to{ Num_History: 5068.5 !NUM } ''Number of call history slots in phone file{ Attempt_0: 5073.2 !NUM } ''Number of attempts with no day part{ Attempt_1: 5075.2 !NUM } ''Number of attempts daypart 1 (morning){ Attempt_2: 5077.2 !NUM } ''Number of attempts daypart 2 (afternoon){ Attempt_3: 5079.2 !NUM } ''Number of attempts daypart 3 (evening){ Caseid10: 5081.10 !VAR } ''Case ID of completed interview>IfDef @International{ Old_Phone_Num: 5091.19 !VAR } ''Old phone number,if changed>Else{ Old_Phone_Num: 5091.10 !VAR } ''Old phone number,if changed>Endif{ Day_Light_Time: 5110.1 !NUM } ''Whether number using Daylight time flag>IfDef @StatusCodesAsText{ Final_Status: 5111.3 ''!NUM } ''Final status of resolved calls (1-99)!FLD&fonestat.rcd999 }>Else{ Final_Status: 5111.3 !NUM } ''Final status of resolved calls (1-99)>Endif{ Calls_Made: 5114.3 !NUM } ''Number of calls made{ Last_History: 5117.3 !NUM } ''Last call history slot used{ Phonenum_Ch: 5120.1 !NUM } ''Whether changed phone number (1=yes){ State_Code: 5121.2 !VAR } ''U.S. State code (AL-WY){ New_Phone: 5123.3 !NUM } ''# of times changed phone number{ History_Cleared: 5126.3 !NUM } ''# of times removed histories (w/ phone_zap){ Market_Number: 5129.3 !NUM } ''Market number (0-9650){ Dnc_Flag: 5132.3 !NUM } ''Whether number marked as "do not contact"{ Record_Number: 5144.7 !NUM } ''Relative position of this record{ Owner_Mode: 5151.1 !NUM } ''Whether using "interviewer ownership" mode{ Owner_Changed: 5152.1 !NUM } ''Whether interviewer ownership changed{ Owner: 5153.4 !VAR } ''Interviewer ID of interviewer who owns number{ Old_Owner: 5157.4 !VAR } ''Interviewer ID of previous number owner{ Stack_Name: 5161.15 !VAR } ''Stack name of stack currently in{ Country_Code: 5176.3 !NUM } ''Country code (1=U.S/Canada,or > 1){ Raw_File_Name: 5179.8 !VAR } ''Name of file loaded from (first 8 characters){ Time_Added: 5187.12 !VAR } ''Time added to phone file (yyyymmddhhmm){ Short_Mkt_Name: 5199.8 !VAR } ''First 8 characters of market name{ Market_Weight: 5207.2 !NUM } ''Market weight{ Timezone_Weight: 5209.2 !NUM } ''Time zone weight{ Upintheair: 5211.1 !NUM } ''Whether number is checked out (at interviewer){ Prev_Market: 5214.3 !NUM } ''Previous market number{ Market_Changes: 5217.3 !NUM } ''Number of times market was changed{ Phone_File_Type: 5220.2 !NUM } ''User Specified Phone file type{ Studyname: 5222.30 !VAR } ''Name of study{ Time_Added_To_Stack: 5252.18 !VAR } ''Time added to last stack yyyymmddhhmmssdjjj{ Named_Hide: 5270.30 !VAR } ''Name of group hidden with "named hide"{ Market_Name: 5300.20 !VAR } ''Name of market{ Last_Operations: 5320.16 !VAR } ''8 2-digit codes showing last 8 operation{ Callbacktime_A: 5336.16 !VAR } ''Callback time of last call yyyymmddhhmmdjjj{ Suspend_Label: 5352.30 !VAR } ''Label of question suspended at{ Blow_Number: 5382.5 !VAR } ''Number of "blow" if had Survent blow{ Special_From: 5387.5 !VAR } ''Stack came from when moved to "Special" stack>If "@MaxHistory" = "10">Define @DollarB 7000>Define @DollarC 7003>Define @DollarD 7006>Define @DollarE 7010>Define @DollarF 7018>Define @DollarG 7024>Define @DollarH 7028>Define @DollarI 7034>Endif>If "@MaxHistory" = "50">Define @DollarB 11000>Define @DollarC 11003>Define @DollarD 11006>Define @DollarE 11010>Define @DollarF 11018>Define @DollarG 11024>Define @DollarH 11028>Define @DollarI 11034>Endif>If "@MaxHistory" = "99">Define @DollarB 15900>Define @DollarC 15903>Define @DollarD 15906>Define @DollarE 15910>Define @DollarF 15918>Define @DollarG 15924>Define @DollarH 15928>Define @DollarI 15934>Endif>Repeat $A=LAST,01,02,...,@MaxHistory; $B=6000,6100,...,@DollarB; & $C=6003,6103,...,@DollarC; $D=6006,6106,...,@DollarD; & $E=6010,6110,...,@DollarE; $F=6018,6118,...,@DollarF; & $G=6024,6124,...,@DollarG; $H=6028,6128,...,@DollarH; $I=6034,6134,...,@DollarI>IfDefine @HistoryFull{ Call_$A: $B.100 !VAR } ''Call history of last call>Endif>IfDefine @HistoryParts{ Call_Num_$A: $B.3 !NUM } '' Call number of nth call>IfDef @StatusCodesAsText{ Status_$A: $C.3 '' Status of nth call!FLD[SameAs Final_Status]}>Else{ Status_$A: $C.3 !NUM } '' Status of nth call>Endif{ Intv_$A: $D.4 !VAR } '' interviewer id on nth call{ Call_Time_$A: $E.14 !VAR } '' Date/Time of call yyyymmddhhmmss{ Date_$A: $E.8 !VAR } '' Date of nth call (yyyymmdd){ Time_$A: $F.6 !VAR } '' Time of nth call (hhmmss){ Call_Info_$A: $G.4 !VAR } '' Day of Week and Julian Date of nth call (djjj){ Call_Secs_$A: $H.5 !VAR } '' Time on call in seconds{ Call_Note_$A: $I.64 !VAR } '' Interviewer call note>Endif>EndRepeat~End~CommentMentor spec file that turns the fonestat file into a useable recode list.~in fonestat ascii=200~out fonestat.rcd ascii~def proc= make_recode:'Check to make sure every record has the right format, otherwise quitIf [1.3#1-999] and [4#":"] Else Error [1.80$] Halt "got an unknown record"EndifModify [1.3*Z] = [1.3] ''zero fill status codeBlank [4] ''Remove ":" from fonestat fileModify [5.100$] = Strip([5.100$]) ''Remove any leading spaces in the labelIf [5.100^b] Modify [5.10$] = "Status " Join [1.3$] ''Put status ### for any code with no textEndifWrite }~exc proc=make_recode~End