Cim load for 34.4.17.1 Label Master Maintenance
{mfdeclre.i}
DEFINE VARIABLE m_file_path AS CHARACTER FORMAT "x(50)" NO-UNDO INITIAL "/home/mfg/" .
DEFINE VARIABLE m_csv_file AS CHARACTER FORMAT "x(50)" NO-UNDO INITIAL "Demo1.csv".
DEFINE VARIABLE m_cim_file AS CHARACTER FORMAT "x(40)" NO-UNDO.
DEFINE VARIABLE m_out_file AS CHARACTER FORMAT "x(40)" NO-UNDO.
DEFINE VARIABLE m_cim_errline AS CHARACTER FORMAT "x(75)".
DEFINE VARIABLE m_cim_err AS CHARACTER NO-UNDO INITIAL NO.
DEFINE VARIABLE m_cim_errdesc AS CHARACTER NO-UNDO FORMAT "x(85)".
DEFINE TEMP-TABLE tt_label
FIELD tt_lang AS CHARACTER
FIELD tt_term AS CHARACTER FORMAT "x(80)"
FIELD tt_long AS CHARACTER FORMAT "x(80)"
FIELD tt_short AS CHARACTER FORMAT "x(80)"
FIELD tt_small AS CHARACTER FORMAT "x(80)"
FIELD tt_stack AS CHARACTER FORMAT "x(80)"
FIELD tt_desc AS CHARACTER FORMAT "x(80)"
FIELD tt_err AS CHARACTER FORMAT "x(50)"
FIELD tt_errdesc AS CHARACTER FORMAT "x(50)" .
FORM
m_file_path COLON 25 LABEL "Input/Output Path"
m_csv_file COLON 25 LABEL "CSV File Name"
WITH FRAME a SIDE-LABELS.
EMPTY TEMP-TABLE tt_label.
REPEAT:
UPDATE
m_file_path
m_csv_file
WITH FRAME a.
FOR EACH tt_label:
DELETE tt_label.
END.
INPUT FROM VALUE (m_file_path + m_csv_file).
REPEAT:
CREATE tt_label.
IMPORT DELIMITER "," tt_label.
END.
INPUT CLOSE.
FOR EACH tt_label :
m_cim_file = tt_term + tt_lang + ".cim". /*SG1*/ /*add tt_lang */
m_out_file = REPLACE(m_cim_file,"cim","out") NO-ERROR.
OUTPUT TO VALUE(m_file_path + m_cim_file).
PUT UNFORMATTED
string('"' + tt_lang + '"') SKIP
string('"' + tt_term + '"') FORMAT "x(80)" .
PUT SKIP.
PUT
string('"' + tt_long + '"') FORMAT "x(80)" SPACE
string('"' + tt_short + '"') FORMAT "x(80)" SPACE
string('"' + tt_small + '"') FORMAT "x(80)" SPACE
string('"' + tt_stack + '"') FORMAT "x(80)" SPACE
string('"' + tt_desc + '"') FORMAT "x(80)" SKIP
"." SKIP.
OUTPUT CLOSE.
cimloop:
DO TRANSACTION ON ERROR UNDO cimloop, LEAVE cimloop:
OUTPUT TO VALUE(m_file_path + m_out_file).
INPUT FROM VALUE(m_file_path + m_cim_file).
{gprun.i ""gplblmt.p""}
INPUT CLOSE.
OUTPUT CLOSE.
INPUT FROM VALUE(m_file_path + m_out_file).
REPEAT:
ASSIGN
m_cim_errline = "".
IMPORT UNFORMATTED m_cim_errline.
IF INDEX(m_cim_errline,"**") <> 0 OR
INDEX(m_cim_errline,"ERROR") <> 0 THEN
DO:
OUTPUT TO VALUE(m_file_path + "error.err") APPEND.
PUT tt_lang tt_term m_cim_errline SKIP. /*SG1*/ /* add m_cim_errline*/
OUTPUT CLOSE.
ASSIGN
m_cim_err = "YES"
m_cim_errdesc = m_cim_errline NO-ERROR.
LEAVE.
END. /* end of index */
END. /* End of Repeat*/
INPUT CLOSE.
IF m_cim_err = "YES" THEN UNDO cimloop, LEAVE cimloop.
ELSE
DO:
m_cim_err = "NO".
OS-DELETE VALUE(m_file_path + m_cim_file).
OS-DELETE VALUE(m_file_path + m_out_file).
END. /* m_cim_err */
END. /*DO*/
ASSIGN
tt_err = m_cim_err
tt_errdesc = m_cim_errdesc.
END. /*For each*/
MESSAGE "Procedure complete " . /*SG1*/
END. /*repeat*/
DEFINE VARIABLE m_file_path AS CHARACTER FORMAT "x(50)" NO-UNDO INITIAL "/home/mfg/" .
DEFINE VARIABLE m_csv_file AS CHARACTER FORMAT "x(50)" NO-UNDO INITIAL "Demo1.csv".
DEFINE VARIABLE m_cim_file AS CHARACTER FORMAT "x(40)" NO-UNDO.
DEFINE VARIABLE m_out_file AS CHARACTER FORMAT "x(40)" NO-UNDO.
DEFINE VARIABLE m_cim_errline AS CHARACTER FORMAT "x(75)".
DEFINE VARIABLE m_cim_err AS CHARACTER NO-UNDO INITIAL NO.
DEFINE VARIABLE m_cim_errdesc AS CHARACTER NO-UNDO FORMAT "x(85)".
DEFINE TEMP-TABLE tt_label
FIELD tt_lang AS CHARACTER
FIELD tt_term AS CHARACTER FORMAT "x(80)"
FIELD tt_long AS CHARACTER FORMAT "x(80)"
FIELD tt_short AS CHARACTER FORMAT "x(80)"
FIELD tt_small AS CHARACTER FORMAT "x(80)"
FIELD tt_stack AS CHARACTER FORMAT "x(80)"
FIELD tt_desc AS CHARACTER FORMAT "x(80)"
FIELD tt_err AS CHARACTER FORMAT "x(50)"
FIELD tt_errdesc AS CHARACTER FORMAT "x(50)" .
FORM
m_file_path COLON 25 LABEL "Input/Output Path"
m_csv_file COLON 25 LABEL "CSV File Name"
WITH FRAME a SIDE-LABELS.
EMPTY TEMP-TABLE tt_label.
REPEAT:
UPDATE
m_file_path
m_csv_file
WITH FRAME a.
FOR EACH tt_label:
DELETE tt_label.
END.
INPUT FROM VALUE (m_file_path + m_csv_file).
REPEAT:
CREATE tt_label.
IMPORT DELIMITER "," tt_label.
END.
INPUT CLOSE.
FOR EACH tt_label :
m_cim_file = tt_term + tt_lang + ".cim". /*SG1*/ /*add tt_lang */
m_out_file = REPLACE(m_cim_file,"cim","out") NO-ERROR.
OUTPUT TO VALUE(m_file_path + m_cim_file).
PUT UNFORMATTED
string('"' + tt_lang + '"') SKIP
string('"' + tt_term + '"') FORMAT "x(80)" .
PUT SKIP.
PUT
string('"' + tt_long + '"') FORMAT "x(80)" SPACE
string('"' + tt_short + '"') FORMAT "x(80)" SPACE
string('"' + tt_small + '"') FORMAT "x(80)" SPACE
string('"' + tt_stack + '"') FORMAT "x(80)" SPACE
string('"' + tt_desc + '"') FORMAT "x(80)" SKIP
"." SKIP.
OUTPUT CLOSE.
cimloop:
DO TRANSACTION ON ERROR UNDO cimloop, LEAVE cimloop:
OUTPUT TO VALUE(m_file_path + m_out_file).
INPUT FROM VALUE(m_file_path + m_cim_file).
{gprun.i ""gplblmt.p""}
INPUT CLOSE.
OUTPUT CLOSE.
INPUT FROM VALUE(m_file_path + m_out_file).
REPEAT:
ASSIGN
m_cim_errline = "".
IMPORT UNFORMATTED m_cim_errline.
IF INDEX(m_cim_errline,"**") <> 0 OR
INDEX(m_cim_errline,"ERROR") <> 0 THEN
DO:
OUTPUT TO VALUE(m_file_path + "error.err") APPEND.
PUT tt_lang tt_term m_cim_errline SKIP. /*SG1*/ /* add m_cim_errline*/
OUTPUT CLOSE.
ASSIGN
m_cim_err = "YES"
m_cim_errdesc = m_cim_errline NO-ERROR.
LEAVE.
END. /* end of index */
END. /* End of Repeat*/
INPUT CLOSE.
IF m_cim_err = "YES" THEN UNDO cimloop, LEAVE cimloop.
ELSE
DO:
m_cim_err = "NO".
OS-DELETE VALUE(m_file_path + m_cim_file).
OS-DELETE VALUE(m_file_path + m_out_file).
END. /* m_cim_err */
END. /*DO*/
ASSIGN
tt_err = m_cim_err
tt_errdesc = m_cim_errdesc.
END. /*For each*/
MESSAGE "Procedure complete " . /*SG1*/
END. /*repeat*/
Comments