www.sas.com > Service and Support > Technical Support
 
Technical Support SAS - The power to know(tm)
  TS Home | Intro to Services | News and Info | Contact TS | Site Map | FAQ | Feedback


 #pragma title PDS2UPDT(Main/Utility/Testing Functions)
/*--------------------------------------------------------------------+
|                                                                     |
|                 Copyright (c) 1996, SAS Institute Inc.              |
|                   Unpublished - All Rights Reserved                 |
|                                                                     |
|                     S A S / C  S A M P L E                          |
|                                                                     |
|         Name: PDS2UPDT                                              |
|                                                                     |
|     Language: C                                                     |
|                                                                     |
|   EntryPoint: MAIN                                                  |
|                                                                     |
|   Entry Type: Standard OS Entry Linkage                             |
|                                                                     |
|   Files Note: 'prefix' is the installation defined high level       |
|               qualifier for the SAS/C product.                      |
|                                                                     |
|     Function: Convert a RECFM=F/LRECL=80 partioned dataset (PDS) to |
|               a sequential file suitable as input to IEBUPDTE.      |
|                                                                     |
|               This includes creating an ADD statement for each      |
|               member, an ALIAS statement for each alias, and        |
|               terminating the dataset with the ENDUP statement.     |
|                                                                     |
|               PDS2UPDTE recognizes two 'anomaly' conditions, these  |
|               are not errors, but should be brought to the callers  |
|               attention, they result in a return code of 4, and a   |
|               brief message in stderr indicating they have occured  |
|               and how to find details in stdout.  The two anomaly   |
|               conditions are:                                       |
|                                                                     |
|                 - Empty Member :                                    |
|                     This indicates that a real member or an alias   |
|                     entry being treated as a real member is empty,  |
|                     no data records exist for the member.           |
|                                                                     |
|                 - Orphan Alias :                                    |
|                     This indicates that an alias entry has no       |
|                     corresponding real member, this is based on     |
|                     the TTR of the alias member.                    |
|                                                                     |
|                                                                     |
|                                                                     |
| Restrictions:                                                       |
|              - Input DDN SYSLIB    - Must be:                       |
|                                      .RECFM= F or FB                |
|                                      .LRECL=80                      |
|                                      .DSORG= PO or PDSE             |
|                                                                     |
|                                      Note: Orphan alias members are |
|                                            not supported for PDSE's.|
|                                                                     |
|              - Output DDN SYSPUNCH - Must be:                       |
|                                      .RECFM= F or FB or FBS         |
|                                      .LRECL=80                      |
|                                                                     |
|      Returns:                                                       |
|               EXIT_SUCCESS -  normal completion                     |
|                                                                     |
|               ANOMALY      -  normal completion, however there were |
|                               anomaly conditons detected and        |
|                               recorded in stderr                    |
|                                                                     |
|               EXIT_FAILURE -  abnormal condition has occured, with  |
|                               messages describing the condition     |
|                               written to stderr                     |
|                                                                     |
|        Files:                                                       |
|               P2UPMH    -   common defines and prototypes for       |
|                             all public functions                    |
|               P2UPNODE  -   structure definitions for PDS_MBR,      |
|                             ALIAS_DATA, and NODE, used by all       |
|                             public functions                        |
|                                                                     |
|               PDSREAD   -   source for reading/processing a PDS     |
|               PDSMEMH   -   structure definition for a PDS          |
|                             directory entry                         |
|               PDSREADH  -   common defines and prototypes for       |
|                             internal PDSREAD functions              |
|                                                                     |
|               UPDBLD    -   source for building IEBUPDTE input from |
|                             input PDS                               |
|               UPDBLDH   -   common defines and prototypes for       |
|                             internal UPDBLD functions               |
|                                                                     |
|               P2UPSK    -   source code for building and            |
|                             maintaining skiplist                    |
|               P2UPSKCM  -   source code for skiplist node compare   |
|                             functions                               |
|               P2UPSKH   -   common defines and prototypes for       |
|                             internal P2UPSK functions               |
|                                                                     |
| MVS -  Compile/Link/Go: submit prefix.SAMPLE(P2UPJ)                 |
|                                                                     |
| CMS - Not tested.                                                   |
|                                                                     |
| Misc Notes:                                                         |
|            - PDS2UPDTE requires SAS/C 6.00 or higher.               |
|                                                                     |
|                                                                     |
+--------------------------------------------------------------------*/

#pragma eject
 #include <stdio.h>
 #include <stdlib.h>
 #include <setjmp.h>

 #include "p2upnode.h"            /* struct NODE defintion           */
 #include "p2upmh.h"              /* PDS2UPDT prototypes and various */
                                  /* defines                         */

jmp_buf out_of_memory;

#pragma eject
int main(void)
{

 int exit_rc = 0;

 NODE * member_list = NULL;
 NODE * alias_list  = NULL;

 /*--------------------------------------------------------------------+
 | Ensure stderr is open before starting, SYNAD exit may need it.      |
 +--------------------------------------------------------------------*/
 fprintf(stderr,"\n");
 printf("\n\n--------------------------------------------\n\n");

 /*-------------------------------------------------------------------+
 | Establish longjump() for out of memory conditions.                 |
 +-------------------------------------------------------------------*/
 if ( (exit_rc = setjmp(out_of_memory) ) != 0 )
   {
    exit_rc = EXIT_FAILURE;
   };

 /*-------------------------------------------------------------------+
 | Obtain member names from PDS directory                             |
 +-------------------------------------------------------------------*/
 if (exit_rc == EXIT_SUCCESS)
   {
    exit_rc = pdsgetm(&member_list,&alias_list);
   };

 /*-------------------------------------------------------------------+
 | Build IEBUPDTE input file from PDS pointed to by DDN_SYSLIB        |
 +-------------------------------------------------------------------*/
 if (exit_rc == EXIT_SUCCESS)
   {
    exit_rc = updbld(&member_list,&alias_list);
   };

 /*-------------------------------------------------------------------+
 | Free skiplist nodes, write return code, and if we have an anomaly  |
 | indicate it in stdout.                                             |
 +-------------------------------------------------------------------*/
 freelist(member_list);
 freelist(alias_list);

 printf("\nPDS2UPDT Complete, Return Code: %d", exit_rc);

 if (exit_rc == ANOMALY)
   {
    printf("   Note: There are anomaly members!");
   };

 printf("\n\n");    /* give a little space after last lines          */

 exit(exit_rc);
}


Copyright (c) 2000 SAS Institute Inc. All Rights Reserved.
Terms of Use & Legal Information | Privacy Statement