Hi All,
Could you please let me know if i can call COBOL programs from SAS? any example for doing that?
Thanks,
Ramanujam
To start with SAS and COBOL need to be installed on the same computer. Also if COBOL can be run from an OS command line, then the SAS X command as mentioned by @Reeza can execute it.
In most cases, COBOL is a compiled language, which means that COBOL code is first fed to the COBOL compiler, after which you get an executable file (e.g. a .exe under Windows) which can be run from the commandline.
SAS provides several methods to run such external commands (X statement, SYSTEM function, CALL SYSTEM routine, INFILE or FILE statement with the PIPE device), which need the XCMD system option set at SAS startup.
Even if you had a COBOL interpreter at hand, you would still need to run it as an external command to which you feed the COBOL code.
There is no built-in SAS tool for compiling or interpreting COBOL.
Thank you @Reeza @SASKiwi @Kurt_Bremser for your inputs. Could you please clarify how to verify XCMD is setup during SAS startup?
Also, could you please point me to any documentation with examples of using the external commands such as 'X' from @Kurt_Bremser 's post?
I am trying to replace one of FOCUS utility programs with SAS and we have below FOCUS call to COBOL program like below. Please note that am trying to run both the SAS and COBOL in z/OS Mainframe environment.
INCLUDE <<COBOL Executable>>
Please let me know if you need more details.
Thanks.
How would you run a COBOL program directly if you didn't use Focus? You can confirm if the SAS X command is enabled or not by running this:
proc options option = xcmd;
run;
If the result is XCMD, then it is enabled. If it is NOXCMD it is disabled.
Thanks @SASKiwi for the update. I received the response as 'XCMD', so it is enabled in our environment.
I will try to use the XCMD and will let you know if i am successful at it.
This old paper might be of interest to you. There is more out there if you search a bit.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.