Resources

More about This Product

Feedback

SAS/C

The SAS/C® Tour


Compiling and Prelinking ftoc.c

  1. Create a file named ftoc.bat in the C:\test\ftoc directory. Open the ftoc.bat file in an editor and enter the following command:

    sascc370 -v ftoc.c
  2. Run the ftoc.bat script. The output should look like this:

    
    C:\test\ftoc>sascc370 -v ftoc.c 
    SAS/C Compiler Driver V7.00.01
    Copyright (C) 2000 SAS Institute Inc.
    set INCLUDE370='C:\Program Files\SAS Institute\SASC701\Include'
    
    "C:\Program Files\SAS Institute\SASC701\host\wnt\bin\lc1" -dCROSS370=1 -hu -n! '-oC:\TEMP\sascc3.2.q' "ftoc.c"
    SAS/C Release 7.00.01 (Target 370 Cross Compiler)
    Copyright(c) 2000 by SAS Institute Inc.  All Rights Reserved.
    *** No errors; No warnings; No user suppressed warnings
    
    "C:\Program Files\SAS Institute\SASC701\host\wnt\bin\lc2" '-oftoc.obj' "C:\TEMP\sascc3.2.q"
    SAS/C Compiler(Phase 2)Release 7.00.01
    Copyright(c) 2000 by SAS Institute Inc.  All Rights Reserved.
    
    "C:\Program Files\SAS Institute\SASC701\host\wnt\bin\cool" -o a.out -L"C:\Program Files\SAS Institute\SASC701" ftoc.obj "C:\Program Files\SAS Institute\SASC701"/lib/mvs/libc.a
    SAS/C (R) C Object Code Pre-linker Release 7.00.01
    Copyright(c) 2000 by SAS Institute Inc.  All Rights Reserved.
    
    cool: Note 1010: Pre-linking completed with return code = 0
    
  3. Use the DIR command to list the files in the directory. Notice that ftoc.obj and a.out have been created. The ftoc.obj file is the output from the compiler and a.out is the prelinked output from cool.
  4. Add the -o option to the ftoc.bat file as follows
    sascc370 -v -o ftoc.out ftoc.c
  5. Run the ftoc.bat script a second time. The prelinked output from cool will now be directed to the ftoc.out file. Use the DIR command to view the files.
  6. Use the DEL command to delete all of the files except ftoc.c. Change the –o command and add the –c option to the ftoc.bat file as follows:
    sascc370 –v –c –o ftoc.obj ftoc.c
  7. Run the ftoc.bat script a third time and use the DIR command to view the files. You will notice that only an ftoc.obj file has been created and that only the lc1 and lc2 phases of the compiler were invoked. The –c option suppressed prelinking. Your listing will look like this:
    
    C:\test\ftoc>sascc370 -v -c -o ftoc.obj ftoc.c 
    SAS/C Compiler Driver V7.00.01
    Copyright (C) 2000 SAS Institute Inc.
    set INCLUDE370='C:\Program Files\SAS Institute\SASC701\Include'
    
    "C:\Program Files\SAS Institute\SASC701\host\wnt\bin\lc1" -dCROSS370=1 -hu -n! '-oC:\TEMP\sascc3.2.q' "ftoc.c"
    SAS/C Release 7.00.01 (Target 370 Cross Compiler)
    Copyright(c) 2000 by SAS Institute Inc.  All Rights Reserved.
    *** No errors; No warnings; No user suppressed warnings
    
    "C:\Program Files\SAS Institute\SASC701\host\wnt\bin\lc2" '-oftoc.obj' "C:\TEMP\sascc3.2.q"
    SAS/C Compiler(Phase 2)Release 7.00.01
    Copyright(c) 2000 by SAS Institute Inc.  All Rights Reserved.
    
  8. Add a second command to ftoc.bat file so that it executes the driver twice: once to compile and once to prelink. The script should look like this:
    sascc370 -v -c -o ftoc.obj ftoc.c
    sascc370 -v -o ftoc.out ftoc.obj
      
  9. Run the ftoc.bat script a fourth time and use the DIR command to look at the files. You should have an ftoc.obj file that is the output from the compiler and an ftoc.out that is the prelinked output. You willalso notice that listing shows that lc1, lc2 and cool were invoked.