IDMS

  • 1.  Rexx exec to read segment and produce jcl?

    Posted Jul 21, 2015 04:40 PM

    Does anyone have a rexx exec to read a segment and produce jcl to allocate all the files in it?



  • 2.  Re: Rexx exec to read segment and produce jcl?

    Posted Jul 21, 2015 05:49 PM

    Will,

     

    Where are you wanting to read the information from?

    Catalog, DMCL load module, IDMSLOOK output???

     

    Chuck

     

    Charles (Chuck) Hardee<mailto:Chuck.Hardee@ThermoFisher.com>

    Senior Systems Engineer/Database Administration

    EAS Information Technology

     

    Thermo Fisher Scientific

    300 Industry Drive | Pittsburgh, PA 15275

    Phone +1 (724) 517-2633 | Mobile +1 (412) 877-2809 | FAX: +1 (412) 490-9230

    Chuck.Hardee@ThermoFisher.com<mailto:Chuck.Hardee@ThermoFisher.com>  | www.thermofisher.com

     

    WORLDWIDE CONFIDENTIALITY NOTE: Dissemination, distribution or copying of this e-mail or the information herein by anyone other than the intended recipient, or an employee or agent of a system responsible for delivering the message to the intended recipient, is prohibited. If you are not the intended recipient, please inform the sender and delete all copies.



  • 3.  Re: Rexx exec to read segment and produce jcl?
    Best Answer

    Posted Jul 22, 2015 01:20 AM

    Hi Will,

     

    I was also tired of doing this manualy. So I wrote an REXX to extract all files out of a "PUNCH SEGMENT" output.

     

    /*  REXX  */

     

    /* ----------------------------------------------------------------- */

    /* Author: M.Lang                                     18.10.2013     */

    /* REXX  : IDMSALLO                                                  */

    /* ----------------------------------------------------------------- */

    /*                                                                   */

    /* Beschreibung:                                                     */

    /* Diese REXX, liest eine IDMS-Segment Source ein und erstellt       */

    /* daraus einen Job zur Allokation der einzelnen Files.              */

    /*                                                                   */

    /* Paramter (DD-Statements):                                         */

    /* SEGMENT - Segment Source                                          */

    /* JOBCARD - Vorlage einer Jobkarte fuer die JCL                     */

    /* JCLOUT  - Ausgabe der erstellten JCL                              */

    /* ----------------------------------------------------------------- */

    /* 18.10.2013 - Version 1.0                                          */

    /*            - Ersterstellung                                       */

    /* ----------------------------------------------------------------- */

     

    /* ----------------------------------------------------------------- */

    /* Einlesen der Segment Source                                       */

    "ALLOC FILE(SEGMENT) SHR REUSE"

    "EXECIO * DISKR SEGMENT (STEM segment. FINIS)"

    "FREE FILE(SEGMENT)"

     

    /* ----------------------------------------------------------------- */

    /* Einlesen der Jobkarte                                             */

    "ALLOC FILE(JOBCARD) SHR REUSE"

    "EXECIO * DISKR JOBCARD (STEM jobcard. FINIS)"

    "FREE FILE(JOBCARD)"

     

    /* ----------------------------------------------------------------- */

    /* Anzahl und Name der Files speichern. Zugehörig jeweils noch das   */

    /* DD-Statement und der DS-Name                                      */

    /* File-Anzahl : fileNr                                              */

    /* File-Name   : file.fileNr                                         */

    /* DD-Statement: dd.fileNr                                           */

    /* DS-Name     : dsn.fileNr                                          */

    fileNr = 0

     

    DO i = 1 TO segment.0

       PARSE VALUE segment.i WITH a .

     

       IF a = "CREATE" THEN

       DO UNTIL a = ";"

          i = i + 1

          PARSE VALUE segment.i WITH a b c .

          IF a = "FILE" THEN DO

             fileNr = fileNr + 1

             file.fileNr = SUBWORD(TRANSLATE(b,' ','.'),2)

             size.fileNr = 0

             pages.fileNr = 0

          END

          IF a = "ASSIGN" THEN DO

             dd.fileNr = c

          END

          IF a = "DSNAME" THEN DO

             dsn.fileNr = STRIP(b,,"'")

          END

       END

     

       IF file.fileNr = "" ! dd.fileNr = "" ! dsn.fileNr = "" THEN DO

          SAY "Problem bei File Nummer "fileNr

          SAY "File-Name   : "file.fileNr

          SAY "DD-Statement: "dd.fileNr

          SAY "DS-Name     : "dsn.fileNr

       END

    END

     

    SAY "Anzahl Files: "fileNr

     

    /* ----------------------------------------------------------------- */

    /* Anzahl der Pages und Pagesize pro File speichern.                 */

    /* Pagesize    : size.fileNr                                         */

    /* Anzahl Pages: pages.fileNr                                        */

     

    DO i = 1 TO segment.0

       physical = 0

       filePerArea = 0

       PARSE VALUE segment.i WITH a .

     

       IF a = "CREATE" THEN

       DO UNTIL a = ";"

          i = i + 1

          PARSE VALUE segment.i WITH a b c .

          IF a = "PHYSICAL" THEN DO

             physical = 1

          END

          IF a = "PRIMARY" & b = "SPACE" THEN DO

             pagesGesamt = c

          END

          IF a = "PAGE" & b = "SIZE" THEN DO

             size = c

          END

          IF a = "WITHIN" & b = "FILE" THEN DO

             filePerArea = filePerArea + 1

             fileArea.filePerArea = c

             i = i + 1

             PARSE VALUE segment.i WITH a b c d e .

             IF a = "FROM" & c = "FOR" & e ="BLOCKS" THEN DO

                IF d = "ALL" THEN DO

                   pagesPerFile.filePerArea = pagesGesamt

                END

                IF d ^= "ALL" THEN DO

                   pagesPerFile.filePerArea = d

                END

             END

          END

       END

     

       IF physical = 1 THEN DO

          DO j = 1 To filePerArea

             DO k = 1 TO fileNr

                IF fileArea.j = file.k THEN DO

                   size.k = size

                   pages.k = pages.k + pagesPerFile.j

                END

             END

          END

       End

    END

     

    /* ----------------------------------------------------------------- */

    /* Berechnen der Zylinderanzahl pro File                             */

    /* Anzahl Cyls.: cylinder.fileNr                                     */

     

    DO i = 1 TO fileNr

       SAY "--------------------------"

       SAY "File-Name   : "file.i

       SAY "DD-Statement: "dd.i

       SAY "DS-Name     : "dsn.i

       SAY "Pagesize    : "size.i

       SAY "Anzahl Pages: "pages.i

     

       SELECT

          WHEN size.i <= 22

             THEN cylinder = pages.i / 1290

          WHEN size.i <= 56

             THEN cylinder = pages.i / 1230

          WHEN size.i <= 90

             THEN cylinder = pages.i / 1170

          WHEN size.i <= 124

             THEN cylinder = pages.i / 1125

          WHEN size.i <= 158

             THEN cylinder = pages.i / 1080

          WHEN size.i <= 192

             THEN cylinder = pages.i / 1035

          WHEN size.i <= 226

             THEN cylinder = pages.i / 990

          WHEN size.i <= 254

             THEN cylinder = pages.i / 960

          WHEN size.i <= 288

             THEN cylinder = pages.i / 915

          WHEN size.i <= 322

             THEN cylinder = pages.i / 885

          WHEN size.i <= 356

             THEN cylinder = pages.i / 855

          WHEN size.i <= 390

             THEN cylinder = pages.i / 825

          WHEN size.i <= 424

             THEN cylinder = pages.i / 810

          WHEN size.i <= 458

             THEN cylinder = pages.i / 780

          WHEN size.i <= 486

             THEN cylinder = pages.i / 750

          WHEN size.i <= 520

             THEN cylinder = pages.i / 735

          WHEN size.i <= 554

             THEN cylinder = pages.i / 720

          WHEN size.i <= 588

             THEN cylinder = pages.i / 690

          WHEN size.i <= 622

             THEN cylinder = pages.i / 675

          WHEN size.i <= 656

             THEN cylinder = pages.i / 660

          WHEN size.i <= 690

             THEN cylinder = pages.i / 645

          WHEN size.i <= 718

             THEN cylinder = pages.i / 630

          WHEN size.i <= 752

             THEN cylinder = pages.i / 615

          WHEN size.i <= 786

             THEN cylinder = pages.i / 600

          WHEN size.i <= 820

             THEN cylinder = pages.i / 585

          WHEN size.i <= 854

             THEN cylinder = pages.i / 570

          WHEN size.i <= 888

             THEN cylinder = pages.i / 555

          WHEN size.i <= 950

             THEN cylinder = pages.i / 540

          WHEN size.i <= 984

             THEN cylinder = pages.i / 525

          WHEN size.i <= 1018

             THEN cylinder = pages.i / 510

          WHEN size.i <= 1086

             THEN cylinder = pages.i / 495

          WHEN size.i <= 1154

             THEN cylinder = pages.i / 480

          WHEN size.i <= 1182

             THEN cylinder = pages.i / 465

          WHEN size.i <= 1250

             THEN cylinder = pages.i / 450

          WHEN size.i <= 1318

             THEN cylinder = pages.i / 435

          WHEN size.i <= 1386

             THEN cylinder = pages.i / 420

          WHEN size.i <= 1482

             THEN cylinder = pages.i / 405

          WHEN size.i <= 1550

             THEN cylinder = pages.i / 390

          WHEN size.i <= 1646

             THEN cylinder = pages.i / 375

          WHEN size.i <= 1748

             THEN cylinder = pages.i / 360

          WHEN size.i <= 1850

             THEN cylinder = pages.i / 345

          WHEN size.i <= 1946

             THEN cylinder = pages.i / 330

          WHEN size.i <= 2082

             THEN cylinder = pages.i / 315

          WHEN size.i <= 2212

             THEN cylinder = pages.i / 300

          WHEN size.i <= 2376

             THEN cylinder = pages.i / 285

          WHEN size.i <= 2546

             THEN cylinder = pages.i / 270

          WHEN size.i <= 2710

             THEN cylinder = pages.i / 255

          WHEN size.i <= 2942

             THEN cylinder = pages.i / 240

          WHEN size.i <= 3174

             THEN cylinder = pages.i / 225

          WHEN size.i <= 3440

             THEN cylinder = pages.i / 210

          WHEN size.i <= 3768

             THEN cylinder = pages.i / 195

          WHEN size.i <= 4136

             THEN cylinder = pages.i / 180

          WHEN size.i <= 4566

             THEN cylinder = pages.i / 165

          WHEN size.i <= 5064

             THEN cylinder = pages.i / 150

          WHEN size.i <= 5726

             THEN cylinder = pages.i / 135

          WHEN size.i <= 6518

             THEN cylinder = pages.i / 120

          WHEN size.i <= 7548

             THEN cylinder = pages.i / 105

          WHEN size.i <= 8906

             THEN cylinder = pages.i / 90

          WHEN size.i <= 10796

             THEN cylinder = pages.i / 75

          WHEN size.i <= 13682

             THEN cylinder = pages.i / 60

          WHEN size.i <= 18452

             THEN cylinder = pages.i / 45

          WHEN size.i <= 27998

             THEN cylinder = pages.i / 30

          WHEN size.i <= 56664

             THEN cylinder = pages.i / 15

          OTHERWISE cylinder = 0

       END

     

       IF INDEX(cylinder,'.') = 0 THEN DO

          cylinder.i = cylinder

          SAY "Cylinder    : "cylinder.i

       END

     

       IF INDEX(cylinder,'.') ^= 0 THEN DO

          cylinder.i = SUBWORD(TRANSLATE(cylinder,' ','.'),1,1) + 1

          SAY "Cylinder    : "cylinder.i

       END

    END

     

    /* ----------------------------------------------------------------- */

    /* Erstellt IEFBR14 Statement zur Allokation der einzelnen Files     */

    z = 2

    alloc.1 = '//ALLOC   EXEC PGM=IEFBR14'

    alloc.2 = '//SYSIN     DD DUMMY'

    DO i = 1 TO fileNr

       z = z + 1

       alloc.z = '//'dd.i'    DD DSN='dsn.i','

       z = z + 1

       alloc.z = '//             DISP=(,CATLG),UNIT=SYSDA,'

       z = z + 1

       alloc.z = '//             VOL=SER=******,SPACE=(CYL,('cylinder.i',0)),'

       z = z + 1

       alloc.z = '//             DCB=(RECFM=FB,LRECL='size.i',BLKSIZE='size.i')'

    END

     

    /* ----------------------------------------------------------------- */

    /* Ausgabe der JCL auf Datei                                         */

    "ALLOC FILE(JCLOUT) SHR REUSE"

    "EXECIO * DISKW JCLOUT (STEM jobcard.)"

    "EXECIO * DISKW JCLOUT (STEM alloc.)"

    "EXECIO 0 DISKRU JCLOUT (FINIS)"

    "FREE FILE(JCLOUT)"

     

    EXIT

    This is my REXX JCL:

     

     

    //IDMSALLO JOB (60,M02,0406,11),

    // MSGCLASS=V,

    // class="1"

    /*JOBPARM SYSAFF=SY27

    //* --------------------------------------------------------------------

    //* -- DIE REXX IDMSALLO KANN AUS EINER SEGMENT SOURCE EINEN JOB ZUR

    //* -- ALLOKATION DER FILES ERSTELLEN

    //* --------------------------------------------------------------------

    //STEP1 EXEC PGM=IKJEFT01

    //ISPPLIB DD DSN=SYS1.ISPF.PANELS,DISP=SHR

    //ISPSLIB DD DSN=SYS1.ISPF.SKELS,DISP=SHR

    //ISPMLIB DD DSN=SYS1.ISPF.MSGS,DISP=SHR

    //ISPTLIB DD DSN=SYS1.ISPF.TABLES,DISP=SHR

    //ISPTABL DD DUMMY

    //ISPPROF DD DSN=&&PROFILE,DISP=(,PASS),UNIT=SYSALLDA,

    // DCB=(LRECL=80,RECFM=FB,BLKSIZE=6320),

    // SPACE=(TRK,(1,1,1))

    //SYSEXEC DD DSN=SA81220.USER.REXX,DISP=SHR

    //SYSTSPRT DD SYSOUT=*

    //* --------------------------------------------------------------------

    //* -- DD-STATEMENTS:

    //* -- SEGMENT -> SEGMENT SOURCE

    //* -- JOBCARD -> JOBCARD VORLAGE

    //* -- JCLOUT -> AUSGABE DER VORGEFERTIGTEN JCL

    //* --------------------------------------------------------------------

    //SEGMENT DD DISP=SHR,DSN=XC020.AS.TEST01.IDMS089T.SOURCE(T60Z0101)

    //JOBCARD DD DSN=SA81220.USER.DATA(JOBCARD),DISP=SHR

    //JCLOUT DD DISP=SHR,DSN=XC020.AS.TEST01.IDMS089T.CNTL(T60TALLO)

    //* --------------------------------------------------------------------

    //SYSTSIN DD *

    PROFILE NOPREFIX

    ISPSTART CMD(%IDMSALLO)

    /*

     

    I hope this could help!



  • 4.  Re: Rexx exec to read segment and produce jcl?

    Posted Jul 22, 2015 08:46 AM

    Thanks very much... I knew someone had probably done this before.

     

    I will give it a try and let you know.



  • 5.  Re: Rexx exec to read segment and produce jcl?

    Posted Jul 23, 2015 01:18 AM

    In case of any questions, don't hesitate to ask me!



  • 6.  Re: Rexx exec to read segment and produce jcl?

    Posted Jul 22, 2015 02:55 PM
      |   view attached

    To help make it easier for people to access the solution offered above - I have put the REXX and JCL into a TXT file attached to this reply! It may save some <cut>+<paste> activity?

     

    Thanks Mathias for the solution - which I am sure other Community members will benefit from! Cheers - GaryC

    Attachment(s)



  • 7.  Re: Rexx exec to read segment and produce jcl?

    Posted Jul 23, 2015 09:42 AM
      |   view attached

    I have a Culprit that I use for that same purpose, combined with a PROC for the allocation and an IDCAMS for copying databases.

    The Culprit reads the Catalog to find the dmcl and segment and outputs dd cards and repro statements to a PDS.

     

    It produces 2 outputs for allocation of datasets, one for recreating the files and one for creating the files with a different prefix and suffixed with the DDNAME from the DMCL.

     

    I have attached the CULPRIT code and JCL I use.

    Attachment(s)

    zip
    culprit.txt.zip   1 KB 1 version