/*---------------------------------------------------------------------+ | Copyright (c) 1995, SAS Institute Inc. | | Unpublished - All Rights Reserved | | S A S / C S A M P L E | | | | | | NAME: SASCSAMP | | LANGUAGE: C (CICS) | | PURPOSE: Sample program used in the tutorial chapter of the | | SAS/C CICS User's Guide. The program produces a | | list of all the SAS/C CICS transient programs that | | begin with the string "lsh". | | MVS - | | PREPROCESS, COMPILE, LINK: Submit prefix.SAMPLE.AUX(LCCCPCL) | | where "prefix" is the installation defined | | high-level qualifier for the SAS/C product. | | EXECUTE: Execute as a transaction from CICS. See the "CICS and | | the Sample Program" and "Running the Example under | | CICS" sections of the tutorial chapter of the SAS/C | | CICS User's Guide for additional information. | | TSO - | | PREPROCESS: LCCCP CLIST | | COMPILE: LC370 CLIST using the RENT option. | | LINK: CLK370B CLIST using the CICS and RENT options. | | EXECUTE: see EXECUTE under MVS above | | CMS - | | PREPROCESS: LCCCP EXEC | | COMPILE: LC370 EXEC using the RENT option. | | CLINK: CLINK EXEC using the CICS option; resulting object code| | must be ported to an MVS operating system for final | | link-editing with the CICS Execution Interface stub | | routines. | | LINK: Use the LCCCXXL cataloged procedure using the NOCLINK | | and RENT options. Input must be specified via the | | SYSLIN DD statement, not the SYSIN DD statement. | | EXECUTE: see EXECUTE under MVS above | | | +---------------------------------------------------------------------*/ /*-------------------------------------------------*/ /* This sample program produces a list of all the */ /* CICS programs that begin with the string "lsh". */ /*-------------------------------------------------*/ #pragma options xopts(xref) #include #include #include char msg [80] ; short msglen; void main() { int next_resp = 0; char header [] = "This is a list of SAS/C transient programs\n"; short hdrlen = sizeof(header) - 1; char pgmname [8] ; void errhndlr(); EXEC CICS HANDLE CONDITION ERROR(errhndlr); EXEC CICS SEND TEXT FROM(header) LENGTH(hdrlen) ACCUM PAGING; EXEC CICS INQUIRE PROGRAM START; while(next_resp == 0) { EXEC CICS INQUIRE PROGRAM(pgmname) NEXT RESP(next_resp); if (memcmp(pgmname, "LSH", 3)) continue; msglen = sprintf(msg, " %.8s\n", pgmname); EXEC CICS SEND TEXT FROM(msg) LENGTH(msglen) ACCUM PAGING; } EXEC CICS INQUIRE PROGRAM END; EXEC CICS SEND PAGE; } void errhndlr(int errcode) /* Something has gone wrong. Send */ { /* a message to give a clue why. */ char savefn [2] ; /* Where to save EIBFN. */ memcpy(savefn, _eibptr->EIBFN, 2); EXEC CICS HANDLE CONDITION ERROR; /* Make sure we don't recurse. */ EXEC CICS PURGE MESSAGE; /* Purge any partial messages. */ msglen = sprintf(msg, "CICS Function %02x%02x received error code %d", savefn [0] , savefn [1] , errcode); EXEC CICS SEND TEXT FROM(msg) LENGTH(msglen) ERASE; exit(-1); }