I have the below code that loops through a list of flat file names and runs this code for each.
I'm trying to see if I have any errors with reading the flatfile with the metadata. For example from time to time a user will imput a delimiter causing a (FOC1271) and (FOC1049) error.
My issue is each time the &FOCERRNUM and &RETCODE show 0 for each run, giving the impression all is well when it's not.
-************** CODE START**********************
TABLE FILE STO_GET_FILENAME
PRINT
FOC_NAME
FOC_NAME_SAVE
ON TABLE HOLD AS STO_GET_FILENAME_USE
WHERE FOC_NAME CONTAINS '&CORRECT_PERIOD';
END
-RUN
-SET &NUMRECS = &LINES;
-*
-SET &I = 0;
-*
-STARTLOOP
-SET &I = &I + 1;
-READ STO_GET_FILENAME_USE NOCLOSE &LEVEL.&I.A25. &TYPE.&I.A25.
-*
-IF &IORETURN NE 0 GOTO ENDLOOP;
-*
-SET &TYPE_NEW = LJUST(25, &TYPE.&I, 'A25');
-SET &FOC_MAS_NAME = &TYPE.&I ;
-*
-SET &HOLD_LOOP = 'ON TABLE HOLD AS STO_ATT_LOG_LOOP FORMAT FOCUS INDEX HIT_STR';
-SET &FFILE_USE_1 = 'logs/' | &LEVEL.&I ;
-*
APP FI FF_ATT_LOG DISK &FFILE_USE_1
-*
TABLE FILE FF_ATT_LOG
PRINT
HIT_RPT
HIT_DTE
HIT_TME
HIT_DIV
HIT_REG
HIT_DST
HIT_STR
HIT_FLG
HIT_EID
&HOLD_LOOP
END
-SET &FOCERRMSG = FEXERR(&FOCERRNUM, 'A72');
-TYPE &FOCERRMSG
-TYPE FOCFOCEXEC: &FOCFOCEXEC
-TYPE FOCERRNUM: &FOCERRNUM
-TYPE RETCODE: &RETCODE
-TYPE ACCEPTS: &ACCEPTS
-TYPE FOCERRNUM: &FOCERRNUM
-TYPE Records: &RECORDS
-TYPE Lines: &LINES
-*-TYPE &FOCFEXNAME
-*-TYPE &FOCINCLUDE
-*-TYPE &FOCREL
-*-TYPE &FOCEXURL
-*-TYPE &READS
-*-TYPE &SETFILE
-RUN
-IF &I LT &NUMRECS GOTO STARTLOOP;
-ENDLOOP
-************** CODE END **********************
Loop one and two below look fine, but loop 3 is where it causes the error and doesn't return an error code?
-********** HTML OUTPUT START **************
TABLE FILE STO_GET_FILENAME
PRINT
FOC_NAME
FOC_NAME_SAVE
ON TABLE HOLD AS STO_GET_FILENAME_USE
WHERE FOC_NAME CONTAINS 'p1.txt';
END
-RUN
0 NUMBER OF RECORDS IN TABLE= 56 LINES= 56
-SET &NUMRECS = 56;
-*
-SET &I = 0;
-*
-STARTLOOP
-SET &I = 0 + 1;
-READ STO_GET_FILENAME_USE NOCLOSE &LEVEL1.A25. &TYPE1.A25.
-*
-IF 0 NE 0 GOTO ENDLOOP;
-*
-SET &TYPE_NEW = LJUST(25, att_rpt_log_10_p1 , 'A25');
-SET &FOC_MAS_NAME = att_rpt_log_10_p1 ;
-*-SET &SAVE_AS = 'AZ_IVR_' || &TYPE_NEW ;
-*-SET &TEST_HOLD1IVR_LOOP = 'ON TABLE HOLD AS ' | &SAVE_AS || ' FORMAT FOCUS INDEX STORE_NUMBER';
-*
-SET &HOLD_LOOP = 'ON TABLE HOLD AS STO_ATT_LOG_LOOP FORMAT FOCUS INDEX HIT_STR';
-SET &FFILE_USE_1 = 'logs/' | att_rpt_log_10_p1.txt ;
-*
APP FI FF_ATT_LOG DISK logs/att_rpt_log_10_p1.txt
-*
TABLE FILE FF_ATT_LOG
PRINT
HIT_RPT
HIT_DTE
HIT_TME
HIT_DIV
HIT_REG
HIT_DST
HIT_STR
HIT_FLG
HIT_EID
ON TABLE HOLD AS STO_ATT_LOG_LOOP FORMAT FOCUS INDEX HIT_STR
END
-SET &FOCERRMSG = FEXERR(0 , 'A72');
1
0 NUMBER OF RECORDS IN TABLE= 3284 LINES= 3284
0
-SET &FOCERRMSG = FEXERR(0 , 'A72');
-TYPE ERROR
ERROR
-TYPE FOCFOCEXEC: _dw_att_log.fex
FOCFOCEXEC: _dw_att_log.fex
-TYPE FOCERRNUM: 0
FOCERRNUM: 0
-TYPE RETCODE: 0
RETCODE: 0
-TYPE ACCEPTS: 3284
ACCEPTS: 3284
-TYPE FOCERRNUM: 0
FOCERRNUM: 0
-TYPE Records: 3284
Records: 3284
-TYPE Lines: 3284
Lines: 3284
-*-TYPE &FOCFEXNAME
-*-TYPE &FOCINCLUDE
-*-TYPE &FOCREL
-*-TYPE &FOCEXURL
-*-TYPE &READS
-*-TYPE &SETFILE
-RUN
-IF 1 LT 56 GOTO STARTLOOP;
-STARTLOOP
-SET &I = 1 + 1;
-READ STO_GET_FILENAME_USE NOCLOSE &LEVEL2.A25. &TYPE2.A25.
-*
-IF 0 NE 0 GOTO ENDLOOP;
-*
-SET &TYPE_NEW = LJUST(25, att_rpt_log_11_p1 , 'A25');
-SET &FOC_MAS_NAME = att_rpt_log_11_p1 ;
-*-SET &SAVE_AS = 'AZ_IVR_' || &TYPE_NEW ;
-*-SET &TEST_HOLD1IVR_LOOP = 'ON TABLE HOLD AS ' | &SAVE_AS || ' FORMAT FOCUS INDEX STORE_NUMBER';
-*
-SET &HOLD_LOOP = 'ON TABLE HOLD AS STO_ATT_LOG_LOOP FORMAT FOCUS INDEX HIT_STR';
-SET &FFILE_USE_1 = 'logs/' | att_rpt_log_11_p1.txt ;
-*
APP FI FF_ATT_LOG DISK logs/att_rpt_log_11_p1.txt
-*
TABLE FILE FF_ATT_LOG
PRINT
HIT_RPT
HIT_DTE
HIT_TME
HIT_DIV
HIT_REG
HIT_DST
HIT_STR
HIT_FLG
HIT_EID
ON TABLE HOLD AS STO_ATT_LOG_LOOP FORMAT FOCUS INDEX HIT_STR
END
-SET &FOCERRMSG = FEXERR(0 , 'A72');
1
0 NUMBER OF RECORDS IN TABLE= 3838 LINES= 3838
0
-SET &FOCERRMSG = FEXERR(0 , 'A72');
-TYPE ERROR
ERROR
-TYPE FOCFOCEXEC: _dw_att_log.fex
FOCFOCEXEC: _dw_att_log.fex
-TYPE FOCERRNUM: 0
FOCERRNUM: 0
-TYPE RETCODE: 0
RETCODE: 0
-TYPE ACCEPTS: 3838
ACCEPTS: 3838
-TYPE FOCERRNUM: 0
FOCERRNUM: 0
-TYPE Records: 3838
Records: 3838
-TYPE Lines: 3838
Lines: 3838
-*-TYPE &FOCFEXNAME
-*-TYPE &FOCINCLUDE
-*-TYPE &FOCREL
-*-TYPE &FOCEXURL
-*-TYPE &READS
-*-TYPE &SETFILE
-RUN
-IF 2 LT 56 GOTO STARTLOOP;
-STARTLOOP
-SET &I = 2 + 1;
-READ STO_GET_FILENAME_USE NOCLOSE &LEVEL3.A25. &TYPE3.A25.
-*
-IF 0 NE 0 GOTO ENDLOOP;
-*
-SET &TYPE_NEW = LJUST(25, att_rpt_log_12_p1 , 'A25');
-SET &FOC_MAS_NAME = att_rpt_log_12_p1 ;
-*-SET &SAVE_AS = 'AZ_IVR_' || &TYPE_NEW ;
-*-SET &TEST_HOLD1IVR_LOOP = 'ON TABLE HOLD AS ' | &SAVE_AS || ' FORMAT FOCUS INDEX STORE_NUMBER';
-*
-SET &HOLD_LOOP = 'ON TABLE HOLD AS STO_ATT_LOG_LOOP FORMAT FOCUS INDEX HIT_STR';
-SET &FFILE_USE_1 = 'logs/' | att_rpt_log_12_p1.txt ;
-*
APP FI FF_ATT_LOG DISK logs/att_rpt_log_12_p1.txt
-*
TABLE FILE FF_ATT_LOG
PRINT
HIT_RPT
HIT_DTE
HIT_TME
HIT_DIV
HIT_REG
HIT_DST
HIT_STR
HIT_FLG
HIT_EID
ON TABLE HOLD AS STO_ATT_LOG_LOOP FORMAT FOCUS INDEX HIT_STR
END
-SET &FOCERRMSG = FEXERR(0 , 'A72');
(FOC1271) DFIX: RECORD # 2440. FIELD 'HIT_FLG' (# 9) IS TRUNCATED.
ORIGINAL LEN = 6
(FOC1049) ERROR IN READING NEXT RECORD : ff_att_log
1
0 NUMBER OF RECORDS IN TABLE= 2439 LINES= 2439
0
-SET &FOCERRMSG = FEXERR(0 , 'A72');
-TYPE ERROR
ERROR
-TYPE FOCFOCEXEC: _dw_att_log.fex
FOCFOCEXEC: _dw_att_log.fex
-TYPE FOCERRNUM: 0
FOCERRNUM: 0
-TYPE RETCODE: 0
RETCODE: 0
-TYPE ACCEPTS: 2439
ACCEPTS: 2439
-TYPE FOCERRNUM: 0
FOCERRNUM: 0
-TYPE Records: 2439
Records: 2439
-TYPE Lines: 2439
Lines: 2439
-*-TYPE &FOCFEXNAME
-*-TYPE &FOCINCLUDE
-*-TYPE &FOCREL
-*-TYPE &FOCEXURL
-*-TYPE &READS
-*-TYPE &SETFILE
-RUN
-IF 3 LT 56 GOTO STARTLOOP;
-********** HTML OUTPUT END **************
Thanks,
Todd
7.6.8
UNIX
FOCUS,HTML,PDF,EXCEL.