home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / viscobv6.zip / vac22os2 / ibmcobol / samples / smrtsort / sample6.c < prev    next >
Text File  |  1995-07-18  |  2KB  |  46 lines

  1. /**********************************************************/
  2. /*                                                        */ 
  3. /*  Licensed Material -- Property of IBM                  */    
  4. /*  5765-349                                              */
  5. /*  (c) Copyright IBM Corporation 1995                    */
  6. /*  All rights reserved                                   */
  7. /*                                                        */
  8. /**********************************************************/
  9.  
  10. /**********************************************************/
  11. /*                                                        */
  12. /* SMARTsort -- sample6.c                                 */
  13. /*                                                        */
  14. /* This program demonstrates how SMARTsort can be used    */
  15. /* to create a sorted file consisting of records that     */
  16. /* have been restructured from the original input file.   */
  17. /*                                                        */
  18. /**********************************************************/
  19.  
  20. #pragma linkage (SMARTsort,system)
  21. #include <string.h>
  22.                                           
  23. void main(void)
  24. {
  25.  
  26.  char *sort_command="-s sort -x 'reformat 3b,3 \" - \" 2b,2 \"\\r\" \"\\n\"' -k 2b,2";
  27.  char SMARTcommand[100];
  28.  
  29.  /* Define file names that will be used */
  30.  char *deptall=".\\data\\dept.all"; 
  31.  char *reformat=".\\output\\reformat.out "; 
  32.  int rc;
  33.  
  34.  /*********************************************************/
  35.  /* Build command string and call SMARTsort to create a   */
  36.  /* sorted file consisting of a rearranged subset of the  */
  37.  /* original data                                         */
  38.  /*********************************************************/
  39.  strcpy(SMARTcommand,sort_command);         
  40.  strcat(SMARTcommand," -o ");
  41.  strcat(SMARTcommand,reformat);
  42.  strcat(SMARTcommand,deptall);
  43.  rc=SMARTsort(SMARTcommand,NULL,NULL,NULL,NULL,NULL,NULL);
  44.  
  45. }
  46.