BCS Dynamically Generate Conrol Cards

There are those occasions when control cards need to be rendered dynamically before subsequent processing via clist or rexx exec. The balance of this article delves into idiosyncrasies of dynamically generating control card within clist (or rexx).

PROC 0 RPDS(AB.AB0069.CNTL) CMEM(XXZZ) ABMEM(AB15032) DELALL(N) +
   VIEW(Y)
FREE FI(CTLCD)
ALLOC FI(CTLCD) DA('&RPDS.(&CMEM.)') SHR
OPENFILE CTLCD OUTPUT
SET &CTLCD = &STR(-SEL )&ABMEM.
PUTFILE CTLCD
IF &DELALL = N THEN GOTO E00
SET &CTLCD = &STR(-DEL ALL)
PUTFILE CTLCD
E00: CLOSFILE CTLCD
IF &VIEW = N THEN GOTO E01
ISPEXEC BROWSE DATASET('&RPDS.(&CMEM.)')
E01: EXIT

In our example we are generating control cards to be used as input to CA Librarian.  The general format of those control cards begins with a minus sign followed by a subcommand such as SEL followed by a space and possible some parameters.

This presents our first hurdle to successfully negotiate.  In a clist all variables are scanned and any math (‘-‘) operation is resolved and the processing continues. 

Since we do not desire evaluation of the minus sign in this case we would use the &str variables which turns off evaluation of the string contained within the &str variable.

Now that we have successfully relaxed the math evaluation of the control card we can continue to complete the balance of the control card.

Now let’s examine the clist further.  Notice there are positional parameters in this example that establishes default values.

rpds – output partitioned data set
cmem – output member name
abmem – librarian member to act upon
delall – specifies inclusion of the delete all line control card
view – specifies browse options of generated output control cards

In a typical production environment the values for the variables would be supplied from the variable pools populated by a previously executed dialog management facility.

The ctlcd file allocation specification is used as the file to act upon.

The openfile command opens file ctlcd for output.

The set &ctlcd statement populates the output buffer with the desired content to be added to the file.

The putfile statement write the contents to the file.

The closefile command closes the output file.

The delall variable indicates whether or not to generate the delete all lines control card.  If the delete all lines card is to be generated the output buffer is populated and the content is added to the file by issuing a subsequent putfile command.

The final function of the clist is to display the generated output in the ISPF browser faciliy.  This is just a nicety for the developer which allows inspection of the generated control cards.

As previously stated in a production environment this clist would be modified to facilitate seamless generation of control cards and in most cases the browse feature would remain relaxed after inital design and debugging.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.

BCS COBOL Internal Sort Example

There are those times when you will need the COBOL sort verb to order data generated or used by a COBOL application. The remainder of this article addresses the idiosyncrasies of the COBOL sort verb employing the using and giving option. This is the simplest approach of using COBOL internal sort.

The using input and output procedures of the SORT verb allows for heavy modification of data passed into the sort and data passed out of the sort. This technique will be discussed further in another article.

Below you will notice a sample COBOL program that employs the using and giving option of COBOL.

IDENTIFICATION DIVISION.
       PROGRAM-ID. 'SORTUG-EXAMPLE-COBOLSORT'.
       AUTHOR. ARCH BROOKS.
       INSTALLATION. BROOKS COMPUTING SYSTEMS.
       DATE-WRITTEN. WDATE.
       DATE-COMPILED.
      *
      *COMMENTS ARE HERE.
      *
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SOURCE-COMPUTER. IBM-390-X.
       OBJECT-COMPUTER. IBM-390-X.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT INPUTFILE ASSIGN TO UT-S-INP001.
           SELECT OUTPUTFILE ASSIGN TO UT-S-INP001.
           SELECT SORTWORK ASSIGN TO UT-S-WORKFILE.
       DATA DIVISION.
       FILE SECTION.
       FD INPUTFILE
           RECORDING MODE IS F
           BLOCK CONTAINS 0 CHARACTERS
           RECORD CONTAINS 80 CHARACTERS
           LABEL RECORDS ARE STANDARD
           DATA RECORD IS TARGFILEREC.
       01  INPUTFILEREC PIC X(80).
       FD OUTPUTFILE
           RECORDING MODE IS F
           BLOCK CONTAINS 0 CHARACTERS
           RECORD CONTAINS 80 CHARACTERS
           LABEL RECORDS ARE STANDARD
           DATA RECORD IS TARGFILEREC.
       01  OUTPUTFILEREC PIC X(80).
       SD  SORTWORK
           DATA RECORD IS SORTRECORD.
       01  SORTRECORD.
           05  MEMNAME PIC X(8).
           05  DSNAME PIC X(72).
       PROCEDURE DIVISION.
           SORT SORTWORK ON ASCENDING MEMNAME
               ON ASCENDING DSNAME
               USING INPUTFILE
               GIVING OUTPUTFILE.
           GOBACK.

The next step in the process is to provide the execution JCL that would be required.

//AMBCOB JOB The job card info goes here
/*JOBPARM L=99
//STEP0001 EXEC PGM=SORTUG
//STEPLIB DD DISP=SHR,DSN=Your.LOAD
//INP001 DD DISP=SHR,DSN=your.pds.CNTL(DS01)
//SORTWORK DD UNIT=VIO,SPACE=(CYL,(1,1)),DISP=(,PASS)

This should be enough information to begin using the COBOL internal sort.   Please feel free to comment or make suggestions about this article.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.

BCS Dissamble DMF/ISPF Tasks For Mainframe TSO

Many IBM mainframe installations use the Dialog Management Facility (DMF) of Interactive Structured Programming Facility (ISPF) to automated perfunctory mainframe tasks. To identify what is being used there are ways to bend the mainframes fingers so to speak to make it divulge the name and location of all these extensions.

A good place to start is at the Time Sharing Option (TSO) command prompt. While the following instructions will work while using option 6 of ISPF it is recommend that these commands be executed outside ISPF. Log out of ISPF and continue to the command prompt where you will issue the command “listalc ddnames” minus quotes and press enter.

You will find data set names listed along with the ddnames of the associated file allocation. Traverse the listing to the ddname ISPFPLIB all the data sets between the ISPFPLIB ddname and the preceding ddname comprise all the data set names in the concatenation.

To produce hard copy of associated data set names use ISPF print pds facilities. Typically what I do is capture the printed output via the snap data facility of Interactive Output Facility (IOF) to physical sequential files Those files are then downloaded to the PC where they are stored and subsequently used as input to a multiple document interface (MDI) where the information can be perused and utilized in an intelligent desktop application.

Of course load libraries do not have printable output so to speak. For all load libraries the list of members will suffice as the printed output for all associated partitioned data set.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.