| 
      
      
      From: David E. <de...@us...> - 2005-05-20 01:01:54
      
     | 
| Burke Cabaniss wrote: > 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'. UN*X and function calls (both C and TC) are case sensitive. The COBOL grammar and identifiers are NOT case sensitive. > 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 ? TC was enhanced to fit with the standard UN*X environment. For example DISPLAY/ACCEPT can be used to read/write to/from standard-output (and standard-error), standard-input. This feature enables a TC program to be used in a pipe. Example 1: ls -l | some-cobol-program | another-cobol-program > some-file Example 2: 01 VAR1. 05 FILLER X(25) VALUE 'ls -l > some-file'. 05 FILLER X(01) VALUE x'00'. ... CALL 'system' USING VAR1. ... OPEN INPUT FILEIN. ... READ FILEIN INTO ... In the above example, what ever is in the variable (identifier) VAR1, is passed as a parameter to the 'system' function, and in turn executed by the shell. To read/write UN*X type text files (variable length, with a <LF> as a record delimiter), just define a file as 'LINE-SEQUENTIAL'. To ensure that truncation does not occur, the work identifier should be larger than the maximum record length. > If there are other call library functions, is there a place where I can > read about them ? Perhaps I should clarify in mainframe-speak. Think of functions as the equivalent to COBOL sub-programs. Libraries are groups of sub-programs (functions) which are archived to form static and shared (dynamic) libraries. When a program executable is created, the link step resolves any dependencies to these calls, depending on which type of 'CALL' statement used. The 'CALL literal ...' statement is resolved at compile time. And the 'CALL identifier ...' statement is resolved dynamically at run-time, when the statement first is encountered. So basically you can call any function in any library. You can also create your own libraries consisting of C and COBOL sub-programs (functions). Unfortunately TC does not have much in the way of documentation. But the 'test.code' directories, enclosed with the compiler source code, contain many working examples. Hope this helps. |