Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Regarding a SUB and IF Statement

Hi All

I am having an issue writing a  SUB Code that can be used to switch the table load code based on the type of file/table

such as '.qvd' or '.txt' being pulled.

1. vFILE is the variable name for the file being pulled, Its a text field

2. vFILETYPE  is the extension name such as 'qvd'  , 'txt' , 'xls'  etc

and accordingly the load statement below needs to be switched based on the file extension suppplied in the function

SUB LOAD_CLAIMS(vFILE, vFILETYPE)
//===============================================================================
//===============================================================================
IF $(vFILETYPE) = 'txt'

THEN

$(vFILE):
LOAD *
FROM
[$(vPullPath)$(vFILE).txt]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
//===============================================================================
STORE $(vFILE) INTO $(vStorePath)$(vFILE).QVD;
DROP TABLE $(vFILE);
//===============================================================================

ELSE

IF $(vFILETYPE) = 'qvd'

THEN

$(vFILE):
LOAD *
FROM
[$(vPullPath)$(vFILE).qvd]
(qvd);
//===============================================================================
STORE $(vFILE) INTO $(vStorePath)$(vFILE).QVD;
DROP TABLE $(vFILE);
//===============================================================================

ENDIF

//===============================================================================

END SUB

0 Replies