Resources

More about This Product

SAS/C

The SAS/C® Tour


Adding a Post-build Step to the ftoc.c Project

You can use the Developer Studio post-build step to automatically ftp your prelinked output to MVS and submit a batch job to link edit and run your application after the build.

  1. Allocate userid.TEST.OBJ, userid.TEST.LOAD and userid.TEST.CNTL data sets on your MVS system.
  2. Create a file named ftp_mvs.bat in your C:\test\ftoc directory. Enter the following command in the file:
    ftp -n -v
    -s:C:\test\ftoc\ftp_mvs.dat
  3. Create a file named ftp_mvs.dat in your C:\test\ftoc directory. Enter the following command in the file, tailoring it to your site requirements:
    open your-host-name
    user your-mvs-userid
    your-password
    type binary
    put C:\test\ftoc\ftoc.out test.obj(ftoc)
    type ascii
    put c:\test\ftoc\jcl test.cntl(ftoc)
    quote site filetype=jes
    get test.cntl(ftoc) ftoc.jes.txt
    quit
      
  4. Create a file named jcl in your C:\test\ftoc directory. Enter the following JCL statements in the file, tailoring them to your site requirements:
    //your-job-card
    // SET NME=FTOC
    //*
    //LKED    EXECPGM=LINKEDIT,PARM='LIST,MAP'
    //SYSLIN   DD  DISP=SHR,DSN=userid.TEST.OBJ(&NME)
    //SYSLMOD  DD  DISP=SHR,DSN=userid.TEST.LOAD(&NME)
    //SYSPRINT DD  SYSOUT=*
    //SYSTERM  DD  SYSOUT=*
    //SYSIN    DD  *
      ENTRY MAIN
    /*
    //*
    //GO      EXEC PGM=&NME
    //SYSPRINT DD  SYSOUT=*
    //SYSTERM  DD  SYSOUT=*
    //STEPLIB  DD  DISP=SHR,DSN=userid.TEST.LOAD
    //         DD  DISP=SHR,DSN=your-install-location.LINKLIB
      
  5. Open the Project -> Settings dialog box and select the Post-build step tab.

  6. Enter Test1 in the Post-build description box, and c:\test\ftoc\ftp_mvs.bat in the Post-build command(s) box.

  7. Select Build -> Rebuild All .

  8. The output from you build will be similar to the following:
    
    Deleting intermediate files and output files for project 'Test1 - Win32 Release'.
    --------------------Configuration: Test1 - Win32 Release--------------------
    Compiling...
    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' "C:\test\ftoc\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" '-oRelease//ftoc.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.
    You have selected the SAS C/C++ Cross Platform Compiler
    Linking...
    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\cool" -o
     "Release/Test1.out" -L"C:\Program Files\SAS Institute\SASC701"
      Release\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
    You have selected the SAS C/C++ Cross Platform Linker
    Test1
    ftp> ftp> open your-host
    ftp> user userid
    ftp> 
    ftp> type binary
    ftp> put C:\test\ftoc\ftoc.out test.obj(ftoc)
    ftp> type ascii
    ftp> put c:\test\ftoc\jcl test.cntl(ftoc)
    ftp> quote site filetype=jes
    ftp> get test.cntl(ftoc) ftoc.jes.txt
    quit
    
    Test1.out - 0 error(s), 0 warning(s)
    
  9. After the build, the prelinked output file ftoc.out is FTP’d to MVS and the JCL is submitted. The JES LOG for the job will be automatically FTP’d back to your Windows machine in the file c:\test\ftoc\Test1\ftoc.jes.txt. If all went well, you should see a successful link edit and execution of you FTOC load module in the JES LOG.