View previous topic :: View next topic
|
Author |
Message |
Khadhar Basha
New User
Joined: 28 Oct 2014 Posts: 44 Location: India
|
|
|
|
Hi,
I am trying below code
Code: |
CALL_STMT = "CALL 'MODULE1' USING "
CALL_STMT1 = "CALL "MODULE2" USING "
SAY CALL_STMT
SAY CALL_STMT1
SPACES = " "
DOUBLE_QUOTE = '"'
SINGLE_QUOTE = "'"
TRANSLATE(CALL_STMT,SPACES,SINGLE_QUOTE)
TRANSLATE(CALL_STMT1,SPACES,DOUBLE_QUOTE)
SAY CALL_STMT
SAY CALL_STMT1
|
Expected output is
Code: |
CALL MODULE1 USING
CALL MODULE2 USING
|
I am trying - To read the COBOL program, when there is a call statement in the line, I should take out the single and double quotes which are using to values of literal for cobol static call programs, then called program name will be separated using PARSE VAR CALLDUMMY PGMNAME.
While running above code I am getting below error
Code: |
'CALL"MODULE1"USING"' is not recognized as an internal command
'CALL"MODULE2"USING"' is not recognized as an internal command
|
also when i try to execute below loops but both the loops are not satisfied
Code: |
IF POS(SINGLE_QUOTE,CALL_STM1) THEN
SAY 'LINE HAS SINGLE QUOTE'
IF POS(DOUBLE_QUOTE,CALL_STM1) THEN
SAY 'LINE HAS DOUBLE QUOTE'
|
I need the above check - to make sure it is static call - If i dont have any quotes then i will move the line to dynamic call stem[/code]
help me in achieving above |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
How about a RTFM?
translate \= upper |
|
Back to top |
|
|
Khadhar Basha
New User
Joined: 28 Oct 2014 Posts: 44 Location: India
|
|
|
|
Hi,
When I try to hard code values as mentioned above, it not working for ""
Var1 = "CALL "MODULE2" USING"
here it interprets "CALL " ---> as a literal, MODULE2 ---> as variable/string, " USING" --> as literal, which is why pos and translate are not working.
When I try reading the same from a file - this is working - Strange - not sure how.
However, I am going to read cobol module (input) from file only, so am good. Thank you |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Maybe you should go to the Beginners Forum, as you're very obviously way too clueless to be posting on a forum for experts! |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Read up about quotes. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
re:
Quote: |
While running above code I am getting below error
'CALL"MODULE1"USING"' is not recognized as an internal command
'CALL"MODULE2"USING"' is not recognized as an internal command
|
Show us a trace. I get different results than you:
Code: |
11 *-* TRANSLATE(CALL_STMT,SPACES,SINGLE_QUOTE)
>>> "CALL MODULE1 USING "
INVALID KEYWORD, USING
+++ RC(12) +++ |
Your use of:
Code: |
TRANSLATE(CALL_STMT,SPACES,SINGLE_QUOTE) |
shows a misunderstanding of TRANSLATE. I think it should be:
Code: |
call_stmt = TRANSLATE(CALL_STMT,SPACES,SINGLE_QUOTE) |
|
|
Back to top |
|
|
Khadhar Basha
New User
Joined: 28 Oct 2014 Posts: 44 Location: India
|
|
|
|
Thank you Pedro. I have corrected as above |
|
Back to top |
|
|
|