| 
      
      
      From: Burke C. <bu...@bs...> - 2005-05-19 20:32:27
      
     | 
| Burke Cabaniss replied: I am very naive in your TC COBOL. You provide the same syntax I use. I simply did not try lower case 'system' versus traditional (in my programs) 'SYSTEM'. This resolves a big need for me in a simple way. Thank you very much. I also asked about a small thing (to me), which is passing back a string area from a system call. Your example writes `ls` to stdout, but one of my programs (for example) needs the output as a data table in COBOL. I can do this by directing output to a file, and then reading the file in COBOL. But you have parameters on the CALL statement that I do not understand. Is there a different name call library function, or a CALL parameter option that provides this ? If there are other call library functions, is there a place where I can read about them ? David Essex wrote: > Burke Cabaniss wrote: > > > Burke Cabaniss asks: > > > > In a RedHat Linux environment I need to CALL bash and > > pass the commands it will execute; Linux programs and > > other scripts. > > With my current COBOL, this is > > CALL 'SYSTEM' USING [ dataname | literal ] . > > I would guess this might be done by a "canned" C executable, > > but am not a C programmer. I am a COBOL programmer in many > > environments for 40 years. > > `bash` capabilities greatly expand what I could do in previous > > environments. > > > > My COBOL has other useful CALL "canned" modules, such as one to return > > (pass) the string value of a bash environment variable, and the number > > and length of the USING parameters passed to a called COBOL program. > > Note that bash itself returns only an integer, if I understand. > > > > I do not find any of this treated in TC or other COBOL documentation. > > Please advise me about it. > > Yes you can call basically call any program or library function. > > Example: > > 01 VAR1. > 05 FILLER X(15) VALUE 'ls -l some-dir' > 05 FILLER X(01) VALUE x'00' > ... > CALL 'system' USING VAR1. > > Note that 'system' is C library call, and like any C string should be > null terminated. > > Hope this helps. > > > |