Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

how to rename by appending a parameter

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
anand.nanda

New User


Joined: 25 Jun 2010
Posts: 10
Location: india

PostPosted: Fri Aug 13, 2010 7:21 pm    Post subject: how to rename by appending a parameter
Reply with quote

how to rename a ps for eg,

aaa.bbb.f&date.t&time

here &date and &time are variable part and are not known till the file is created.

this file has to be renamed as

aaa.bbb.f&date.t&time.test

i tried few ways but not succeded.

regards,
anand
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Aug 13, 2010 7:28 pm    Post subject:
Reply with quote

what did you try?
show us, cut&paste, use CODE tags, as well as output messages.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Fri Aug 13, 2010 8:14 pm    Post subject: Reply to: how to rename by appending a parameter
Reply with quote

I agree. Can't really guess without knowing what you've tried.

RENAME 'AAA.BBB.F&DATE.T&TIME' 'AAA.BBB.F&DATE.T&TIME.TEST' ought to work just fine as long as it's part of the JCL stream.
Back to top
View user's profile Send private message
anand.nanda

New User


Joined: 25 Jun 2010
Posts: 10
Location: india

PostPosted: Mon Aug 16, 2010 10:15 am    Post subject: Reply to: how to rename by appending a parameter
Reply with quote

here is the code that i tried,

Code:
//STEP1    EXEC PGM=ADRDSSU                         
//SYSPRINT DD   SYSOUT=A                             
//SYSIN    DD   *                                   
  COPY DATASET(INCLUDE(AAAA.BB.F*.T*)) -   
  RENAMEUNCONDITIONAL((AAAA.BB.F*.T*, -     
                                        AAAA.BB.F*.T*.TEST))-
        REPLACEUNCONDITIONAL CATALOG TGTGDS(ACTIVE) -
        DELETE -                                     
        ALLDATA(*) ALLEXCP                           
/*



ERROR MESSAGE:

ERROR IN DATA SET NAME AAAA.BB.F*.T*.TEST
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Mon Aug 16, 2010 10:41 am    Post subject:
Reply with quote

Hi,

see this http://ibmmainframes.com/viewtopic.php?t=50364


Gerry
Back to top
View user's profile Send private message
anand.nanda

New User


Joined: 25 Jun 2010
Posts: 10
Location: india

PostPosted: Mon Aug 16, 2010 11:00 am    Post subject:
Reply with quote

YA,
I HAVE TAKEN THE CODE FROM THAT LINK ONLY. IT WORKS FINE FOR FOLLOWING CONDITION

ORIGINAL NAME: AAAA.BB.CC.*
NEW NAME : AAAA.BB.DD.*

BUT I WANT TO KEEP THE ENTIRE NAME TO BE AS SUCH AND ADD AN EXTRA PARAMETER TO IT AT THE END. LIKE THIS,

ORIGINAL NAME: AAAA.BB.CC.F*.T*
NEW NAME : AAAA.BB.CC.F*.T*.TEST

THE ABOVE CODE FAILS WHEN I TRY THIS.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Mon Aug 16, 2010 2:16 pm    Post subject:
Reply with quote

Yes, one of the downsides of Dfdss. You will need to fully qualify both the input and output dataset names.
Back to top
View user's profile Send private message
anand.nanda

New User


Joined: 25 Jun 2010
Posts: 10
Location: india

PostPosted: Mon Aug 16, 2010 3:03 pm    Post subject: Reply to: how to rename by appending a parameter
Reply with quote

oh.

ok thanks a lot.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Aug 17, 2010 7:27 pm    Post subject:
Reply with quote

OK, so I just had a similar need to copy about 400 files and to add a new qualifier into the existing dataset names. Well, Dfdss is great for copying but not so much fun for renames. And me being me, after creating and editing a dataset list from oldname to newname decided to REXX it up a little. This will build the complete SYSIN dataset for processing a DFdss COPY and RENAME step.

I am running this in an ISPF environment in batch, followed by the DFdss step, and of course I don't need to tell anyone on the forum that this has been discussed zillions of times and that a simple search will find exactly what you are looking for to be able to do this.

OK, first the JCL. Both the INCLUDE and EXCLUDE statements support full use of wildcards for filtering, so yes, you can use the * and % any way that you want to. Do I really need to explain the use of these two DD statements.

CHANGES DD - A few of options here
as shown *NONE* .TESTCOPY will not change anything except to append .TESTCOPY to the end of any existing dataset names found as a result from the INCLUDE / EXCLUDE statement proceeing. The code works around any little problems like VSAM component names and GDS datasets, so no need to worry there.

If you need to do other changes rather than append a new qualifier, you can use the CHANGES DD statements to do this for you. Just change the *NONE* into two fields "Change from" "Change to". These will be used in an ISPF edit macro to make the desired changes to the DFdss COPY rename statements.

You can combine the two together and for example change the HLQ of the new datasets AND append a new LLQ. Example below. You are not limited to only one change statement, use as many as you like.
Code:
//CHANGES  DD *                           
HLQ1.ABC.  HLQ2.XYZ. .TESTCOPY

JCL to run the REXX and ISPF macro
Code:

//*--------------------------------------------------------------------
//STEP0020 EXEC ISPFBAT,PARM='ISPSTART CMD(%CSIRENAM)'                 
//INCLUDE  DD *                                                       
HLQ.**                                                                 
/*                                                                     
//EXCLUDE  DD *                                                       
HLQ.ISPC*                                                               
HLQ.ISPL*                                                               
HLQ.SPFTEM*.**                                                         
HLQ.DFDSS.**                                                           
/*                                                                     
//CHANGES  DD *                                                       
*NONE* .TESTCOPY                                                       
/*                                                                     
//WORKOUT  DD DSN=XX.DFDSS.SYSIN,DISP=(,CATLG,CATLG),                 
//            RECFM=FB,LRECL=80,SPACE=(TRK,(45,45),RLSE)                 
//TOOLIN   DD *                                                       
 SELECT FROM(WORK01) TO(WORK02) ON(11,44,CH)  NODUPS                   
/*                                                                     
//*--------------------------------------------------------------------

And now the actual REXX code
Code:
/* REXX *** GENERATE DFDSS RENAME STATEMENTS FOR SELECTED DATASETS
            USES FULL WILDCARD CAPABILITY FOR BOTH INCLUDE EXCLUDE   */

SIGNAL ON SYNTAX NAME ERR
CARD = COPIES(' ',70)||'-'
VSAMLST = "CLUSTER DATA INDEX AIX PATH"

X = MSG('OFF')

"FREE  FI(WORK01,WORK02)"
"ALLOC FI(WORK01) TRACKS SPACE(45 45) RECFM(F B) LRECL(80)"
"ALLOC FI(WORK02) TRACKS SPACE(45 45) RECFM(F B) LRECL(80)"

"EXECIO * DISKR INCLUDE ( STEM CAT. FINIS"
"EXECIO * DISKR INCLUDE ( STEM INS. FINIS"
CALL CSIUTIL
DROP CAT.

"EXECIO * DISKR EXCLUDE ( STEM CAT. FINIS"
CALL CSIUTIL

"EXECIO 0 DISKW WORK01 ( FINIS"
"CALL *(ICETOOL)"

"EXECIO * DISKR CHANGES ( STEM CHG. FINIS"
IF CHGS.0 = 0 THEN EXIT

"EXECIO * DISKR WORK02 ( STEM DSNS. FINIS"
IF DSNS.0 = 0 THEN DO
   SAY "NO DATASETS SELECTED FOR PROCESSING - STEP TERMINATES RC 04"
   SAY "NO DATASETS SELECTED FOR PROCESSING - STEP TERMINATES RC 04"
   SAY "NO DATASETS SELECTED FOR PROCESSING - STEP TERMINATES RC 04"
   ZISPFRC = 4
   "ISPEXEC VPUT (ZISPFRC) SHARED"
   EXIT
END

DSI = LISTDSI(WORK02 FILE)
DO A = 1 TO CHG.0
 IF WORD(CHG.A,1) = "*NONE*"
    THEN PARSE VAR CHG.A PFXO ADDON
    ELSE PARSE VAR CHG.A PFXO PFXN ADDON
 IF PFXO = "*NONE*"
    THEN PFXN = PFXO
 PFXO  = STRIP(PFXO)
 PFXN  = STRIP(PFXN)
 ADDON = STRIP(ADDON)
 IF SUBSTR(ADDON,1,1) <> '.'
    THEN ADDON = '.'ADDON
 "ISPEXEC VPUT (PFXO PFXN ADDON) SHARED"
 "ISPEXEC EDIT DATASET('"STRIP(SYSDSNAME)"') VOLUME("SYSVOLUME")
      MACRO(CSIDFSMM)"
END
"EXECIO * DISKR WORK02 ( STEM DSN2. FINIS"
"FREE  FI(WORK01,WORK02)"

QUEUE   OVERLAY('COPY  DATASET(INCLUDE(',CARD,2)
DO AA = 1 TO INS.0
   INS.AA = STRIP(INS.AA)
   IF AA = INS.0
      THEN INS.AA = INS.AA')'
   QUEUE OVERLAY(INS.AA,CARD,24)
END

IF CAT.0 > 0 THEN DO AA = 1 TO CAT.0
   POS = 24
   CAT.AA = STRIP(CAT.AA)
   IF AA = 1 THEN DO
      POS = 16
      CAT.AA = 'EXCLUDE('CAT.AA
   END
   IF AA = CAT.0
      THEN CAT.AA = CAT.AA')'
   QUEUE OVERLAY(CAT.AA,CARD,POS)
END
QUEUE OVERLAY(')',CARD,24)
QUEUE OVERLAY('RENAMEUNCONDITIONAL(',CARD,16)

DO AA = 1 TO DSNS.0
  DTYPE = SUBSTR(DSNS.AA,2,8)
  DSNS.AA = STRIP(SUBSTR(DSNS.AA,11))
  DSN2.AA = STRIP(SUBSTR(DSN2.AA,11))
  IF DTYPE = "GDS" | DTYPE = "AIX" | DTYPE = "PATH" THEN DO
    REVGDS = REVERSE(DSN2.AA)
    POS1 = POS('.',REVGDS)
    NNAME = SUBSTR(REVGDS,1,POS1)
    REVGDS = SUBSTR(REVGDS,POS1+1)
    POS1 = POS('.',REVGDS)
    GNAME = SUBSTR(REVGDS,1,POS1)
    REVGDS = SUBSTR(REVGDS,POS1+1)
    DSN2.AA = REVERSE(REVGDS)||REVERSE(NNAME)||REVERSE(GNAME)
  END
  IF POS('..',DSN2.AA) > 0 THEN DO
    PART1 = SUBSTR(DSN2.AA,1,POS('..',DSN2.AA))
    PART2 = SUBSTR(DSN2.AA,POS('..',DSN2.AA)+2)
    DSN2.AA = PART1||PART2
  END
  IF RIGHT(DSN2.AA,1) = '.'
     THEN DSN2.AA = SUBSTR(DSN2.AA,1,LENGTH(DSN2.AA)-1)
  QUEUE OVERLAY('('DSNS.AA',',CARD,16)
  QUEUE OVERLAY(DSN2.AA')',CARD,24)
END
QUEUE OVERLAY(')',CARD,16)
QUEUE OVERLAY('REPLACEUNCONDITIONAL CATALOG TOL(ENQF)',CARD,16)
QUEUE OVERLAY('TGTGDS(ACTIVE)',CARD,16)
QUEUE OVERLAY('ALLDATA(*) ALLEXCP SPHERE 'COPIES(' ',60),CARD,16)
"EXECIO "QUEUED()" DISKW WORKOUT ( FINIS"

EXIT
/*-------------------------------------------------------------------*/
CSIUTIL:
DO KCNT = 1 TO CAT.0
  KEY = SUBSTR(CAT.KCNT,1,44)
  MODRSNRC = SUBSTR(' ',1,4)
  CSIFILTK = SUBSTR(KEY,1,44)
  CSICATNM = SUBSTR(' ',1,44)
  CSIRESNM = SUBSTR(' ',1,44)
  CSIDTYPS = SUBSTR(' ',1,16)
  CSICLDI  = SUBSTR('Y',1,1)
  CSIRESUM = SUBSTR(' ',1,1)
  CSIS1CAT = SUBSTR(' ',1,1)
  CSIRESRV = SUBSTR(' ',1,1)
  CSINUMEN = '0002'X
  CSIFLD1  = 'VOLSER  '
  CSIFLD2  = 'DEVTYP  '
  CSIOPTS  = CSICLDI || CSIRESUM || CSIS1CAT || CSIRESRV
  CSIFIELD = CSIFILTK || CSICATNM || CSIRESNM || CSIDTYPS || CSIOPTS
  CSIFIELD = CSIFIELD || CSINUMEN || CSIFLD1 || CSIFLD2
  WORKLEN = 4096
  DWORK = '00001000'X || COPIES('00'X,WORKLEN-4)
  RESUME = 'Y'
  CATNAMET = SUBSTR(' ',1,44)
  DNAMET = SUBSTR(' ',1,44)
  DO WHILE RESUME = 'Y'
   ADDRESS LINKPGM 'IGGCSI00  MODRSNRC  CSIFIELD  DWORK'
   RESUME = SUBSTR(CSIFIELD,150,1)
   USEDLEN = C2D(SUBSTR(DWORK,9,4))
   POS1=15
   DO WHILE POS1 < USEDLEN
     IF SUBSTR(DWORK,POS1+1,1) = '0'
      THEN DO
           CATNAME=SUBSTR(DWORK,POS1+2,44)
           IF CATNAME <> CATNAMET THEN
            DO
             CATNAMET = CATNAME
            END
           POS1 = POS1 + 50
           END
     DNAME = SUBSTR(DWORK,POS1+2,44)
     IF SUBSTR(DWORK,POS1+1,1) = 'C' THEN DTYPE = 'CLUSTER '
      ELSE IF SUBSTR(DWORK,POS1+1,1) = 'D' THEN DTYPE = 'DATA    '
      ELSE IF SUBSTR(DWORK,POS1+1,1) = 'I' THEN DTYPE = 'INDEX   '
      ELSE IF SUBSTR(DWORK,POS1+1,1) = 'A' THEN DTYPE = 'NONVSAM '
      ELSE IF SUBSTR(DWORK,POS1+1,1) = 'H' THEN DTYPE = 'GDS     '
      ELSE IF SUBSTR(DWORK,POS1+1,1) = 'B' THEN DTYPE = 'GDG     '
      ELSE IF SUBSTR(DWORK,POS1+1,1) = 'R' THEN DTYPE = 'PATH    '
      ELSE IF SUBSTR(DWORK,POS1+1,1) = 'G' THEN DTYPE = 'AIX     '
      ELSE IF SUBSTR(DWORK,POS1+1,1) = 'X' THEN DTYPE = 'ALIAS   '
      ELSE IF SUBSTR(DWORK,POS1+1,1) = 'U' THEN DTYPE = 'UCAT    '
      ELSE DTYPE = '        '
      POS1 = POS1 + 46
      NUMVOL = C2D(SUBSTR(DWORK,POS1+4,2))/6
      POS2 = POS1+8
      VOLSER. = ""
      DO I = 1 TO NUMVOL
        VOLSER.I = SUBSTR(DWORK,POS2,6)
        POS2 = POS2 + 6
      END
      VOLSER.0 = NUMVOL
      DEVTY1 = SUBSTR(DWORK,POS2,4)
      DEVTY2 = C2X(SUBSTR(DWORK,POS2,4))
      IF SUBSTR(DEVTY2,5,2) = '20' THEN DELDEV = 'DASD'
        ELSE
          IF SUBSTR(DEVTY2,5,2) = '80' THEN DELDEV = 'TAPE'
            ELSE
              DELDEV = 'XXXX'
      IF DNAMET <> DNAME THEN
      DO
       DNAMET=DNAME
       IF LEFT(VOLSER.1,6) <> "MIGRAT" & DELDEV = "DASD" THEN DO
         DNAMX = ' 'DTYPE DNAME
         PUSH DNAMX
         "EXECIO 1 DISKW WORK01"
       END
       IF POS(STRIP(DTYPE),VSAMLST) > 0 THEN DO
         DNAMX = ' 'DTYPE DNAME
         PUSH DNAMX
         "EXECIO 1 DISKW WORK01"
       END
      END
      POS1 = POS1 + C2D(SUBSTR(DWORK,POS1,2))
    END
   END
END
RETURN
/*-------------------------------------------------------------------*/
ERR:
  SIGNAL OFF SYNTAX
  DROPBUF
  SAY "ERROR ROUTINE STARTING"
  SAY "   "
  SAY RIGHT(SIGL,6) ">>>" SOURCELINE(SIGL)
  SAY "   "
  TRACE I
  INTERPRET SOURCELINE(SIGL)
And finally the ISPF edit macro
Code:
/* REXX *** SOURCE CSIRENAM *** BUILD RENAME CARDS FOR DFDSS COPY    */
"ISREDIT MACRO"
"ISPEXEC VGET (PFXO PFXN ADDON) SHARED"
"ISREDIT X ALL"
"ISREDIT F '"PFXO"'               ALL"
"ISREDIT X '~'               1    ALL"
"ISREDIT (STR,LIN) = FIND_COUNTS"
"ISREDIT C  '"PFXO"' '"PFXN"'  NX ALL"
"ISREDIT C ' ' '~'           1 NX ALL"
"ISREDIT SAVE"
IF LIN > 0 THEN DO
   "ISREDIT C ' ' '"ADDON"' 60 NX ALL"
   "ISREDIT C ' ' ''     11 60 NX ALL"
   "ISREDIT C ' ' '~'        1 NX ALL"
END
IF PFXO = '*NONE*' THEN DO
   "ISREDIT RESET"
   "ISREDIT X '~'            1    ALL"
   "ISREDIT C ' ' '"ADDON"' 60 NX ALL"
   "ISREDIT C ' ' ''     11 60 NX ALL"
   "ISREDIT C ' ' '~'        1 NX ALL"
END
"ISREDIT END"
Back to top
View user's profile Send private message
anand.nanda

New User


Joined: 25 Jun 2010
Posts: 10
Location: india

PostPosted: Wed Aug 18, 2010 9:52 am    Post subject: Reply to: how to rename by appending a parameter
Reply with quote

Thats a great job expat.

Thank you very much.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Aug 18, 2010 2:40 pm    Post subject:
Reply with quote

PROBLEM - If a VSAM cluster had more than one AIX associated with it, the naming for .AIX and .PATH changed, and was not catered for. This has now been changed.

I have changed the code for the REXX and the MACRO in my original post rather than put the whole thing up again.
Back to top
View user's profile Send private message
anand.nanda

New User


Joined: 25 Jun 2010
Posts: 10
Location: india

PostPosted: Wed Aug 18, 2010 4:55 pm    Post subject:
Reply with quote

OK
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts Error during restore rename archanamuthukrishnan All Other Mainframe Topics 2 Fri Oct 14, 2016 3:30 pm
No new posts How to display value of an exit param... lind sh CICS 2 Sun Oct 09, 2016 12:28 pm
No new posts Send parameter for macro STIMERM from... Daniel Teolotitla PL/I & Assembler 13 Tue Jul 05, 2016 9:23 pm
No new posts COND parameter vs IF THEN ELSE Alks JCL & VSAM 11 Fri Jun 17, 2016 5:28 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us