Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
datanibbler
Champion
Champion

"Error in script line: endsub" - no idea - help plz


Hi,

I have worked with subroutines a few times, but not often. Usually I had to pass only one parameter to the subroutine. This is the first intance where I have to pass two:

- A full path (with a lot of \ - I enclose that in square brackets to be sure)

- An ending.

Everything is in place. I use a command like that

>> sub Dateicheck ($(v_checkfolder), $(v_ending)) <<

>> endsub; <<

>> CALL Dateicheck ($(v_folder_to_check), $(v_ending_to_check)); <<

But I keep getting an error_message "error in script line: endsub". I have already tried some variations on this, but I guess the error lies elsewhere. Maybe in the opening sub statement? (I tried without the $() before because it's without in my other subroutines, too, but that didn't work)

Can someone help me here? I am Flasche leer;

Thanks a lot!

Best regards,

DataNibbler

1 Solution

Accepted Solutions
marcus_sommer

It's quite difficult to find here the syntax issue's. The easiest way is most to run this step by step within the debugger.

I would as next remove the chr(39) wrapping from v_folder_to_check or call these variable within the call-statement without the single-quotes then they could be double which then led to an error.

Further I don't understand the sub from text-file. You made a join without a common field and the check to "Aktuell" could be done within the first load.

- Marcus

View solution in original post

13 Replies
marcus_sommer

Hi DataNibbler,

try this:

sub Dateicheck (p1, p2)

// do something

end sub


CALL Dateicheck ($(v_folder_to_check), $(v_ending_to_check))

- Marcus

datanibbler
Champion
Champion
Author

Hi Marcus,

so what exactly is it you are proposing? Just replace the parameter_names? And using > end sub < without a semicolon?

I'll try.

P.S.: Nope - that makes no difference. I still get the message "error in script line: end sub"

I guess the real error must lie somewhere else. There is simply no space for errors among those two little words ...

marcus_sommer

Hi DataNibbler,

yes this was meant and if the variables contained strings they will need additional single-quotes: '$(var)'

- Marcus

datanibbler
Champion
Champion
Author


Hi Marcus,

quotes - in the CALL_statement or in the opening > sub <?

marcus_sommer

This was meant within the call-statement.

datanibbler
Champion
Champion
Author

Okay -

now I have

- >> sub Dateicheck($(p1), $(p2)) <<

- >> end sub <<

- >> CALL Dateicheck ('$(v_folder_to_check)', '$(v_ending_to_check)'); <<

... now I am again getting the message "error in script line: end sub"

marcus_sommer

How looks the content from the variables?

datanibbler
Champion
Champion
Author

Hi,

one of the variables is a full file_path like

>> \\blabla\suffsuff\QlikView\99_ReportToMail\02_Output <<

The other is a file_ending (to identify the ending of the files which should be created by RtM), e.g. pdf or xls

marcus_sommer

Then it should work with:

let var = '\\blabla\suffsuff\QlikView\99_ReportToMail\02_Output';

then '$(var)' meant now the same syntax as if you had put the string directly in the call-statement. But your sub contained a $(p1) and $(p2) - use here only p1 and p2. Most often a sub looks in my case so:

sub Dateicheck (v_folder_to_check, v_ending_to_check)

// do something

end sub

CALL Dateicheck (p1, p2)

- Marcus